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

View File

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