chore(project): use karma-webpack for testing

* no need to transform test via browserify
* works 🍰
This commit is contained in:
Nico Rehwaldt 2018-07-13 15:50:55 +02:00
parent 311e5d7bc7
commit 6d9b04a5f1
3 changed files with 31 additions and 29 deletions

View File

@ -39,10 +39,6 @@
"*.css" "*.css"
], ],
"devDependencies": { "devDependencies": {
"babel-core": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babelify": "^8.0.0",
"browserify": "^14.5.0",
"chai": "^4.1.2", "chai": "^4.1.2",
"chai-match": "^1.1.1", "chai-match": "^1.1.1",
"cpx": "^1.5.0", "cpx": "^1.5.0",
@ -52,7 +48,6 @@
"execa": "^0.8.0", "execa": "^0.8.0",
"jsondiffpatch": "^0.1.26", "jsondiffpatch": "^0.1.26",
"karma": "^2.0.2", "karma": "^2.0.2",
"karma-browserify": "^5.3.0",
"karma-chrome-launcher": "^2.1.1", "karma-chrome-launcher": "^2.1.1",
"karma-env-preprocessor": "^0.1.1", "karma-env-preprocessor": "^0.1.1",
"karma-firefox-launcher": "^1.0.1", "karma-firefox-launcher": "^1.0.1",
@ -62,12 +57,14 @@
"karma-safari-launcher": "^1.0.0", "karma-safari-launcher": "^1.0.0",
"karma-sinon-chai": "^1.3.2", "karma-sinon-chai": "^1.3.2",
"karma-spec-reporter": "0.0.31", "karma-spec-reporter": "0.0.31",
"karma-webpack": "^3.0.0",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
"mocha": "^5.2.0", "mocha": "^5.2.0",
"mocha-test-container-support": "0.2.0", "mocha-test-container-support": "0.2.0",
"npm-run-all": "^4.1.2", "npm-run-all": "^4.1.2",
"phantomjs-prebuilt": "^2.1.12", "phantomjs-prebuilt": "^2.1.12",
"puppeteer": "^0.13.0", "puppeteer": "^0.13.0",
"raw-loader": "^0.5.1",
"rollup": "^0.57.1", "rollup": "^0.57.1",
"rollup-plugin-commonjs": "^9.1.0", "rollup-plugin-commonjs": "^9.1.0",
"rollup-plugin-json": "^2.3.0", "rollup-plugin-json": "^2.3.0",
@ -77,8 +74,7 @@
"rollup-plugin-uglify": "^3.0.0", "rollup-plugin-uglify": "^3.0.0",
"sinon": "^4.4.6", "sinon": "^4.4.6",
"sinon-chai": "^2.14.0", "sinon-chai": "^2.14.0",
"stringify": "^5.2.0", "webpack": "^4.16.0"
"watchify": "^3.11.0"
}, },
"dependencies": { "dependencies": {
"bpmn-font": "^0.8.0", "bpmn-font": "^0.8.0",

View File

@ -32,17 +32,16 @@ module.exports = function(karma) {
basePath: basePath, basePath: basePath,
frameworks: [ frameworks: [
'browserify',
'mocha', 'mocha',
'sinon-chai' 'sinon-chai'
], ],
files: [ files: [
'test/{spec,integration}/**/*Spec.js' 'test/suite.js'
], ],
preprocessors: { preprocessors: {
'test/{spec,integration}/**/*Spec.js': [ 'browserify', 'env' ] 'test/suite.js': [ 'webpack', 'env' ]
}, },
reporters: [ 'spec' ], reporters: [ 'spec' ],
@ -65,25 +64,29 @@ module.exports = function(karma) {
singleRun: true, singleRun: true,
autoWatch: false, autoWatch: false,
// browserify configuration
browserify: { webpack: {
debug: true, mode: 'development',
paths: [ absoluteBasePath ], module: {
transform: [ rules: [
[ 'babelify', { {
global: true, test: /\.css|\.bpmn$/,
babelrc: false, use: 'raw-loader'
presets: [ 'env' ] }
} ], ]
[ 'stringify', { },
global: true, resolve: {
extensions: [ mainFields: [
'.bpmn', 'dev:module',
'.xml', 'browser',
'.css' 'module',
] 'main'
} ] ],
] modules: [
'node_modules',
absoluteBasePath
]
}
} }
}); });
}; };

3
test/suite.js Normal file
View File

@ -0,0 +1,3 @@
var allTests = require.context('.', true, /(spec|integration).*Spec\.js$/);
allTests.keys().forEach(allTests);