Skip to content

Commit a580250

Browse files
committed
fix: update to latest versions of testing
1 parent a106279 commit a580250

File tree

4 files changed

+48
-65
lines changed

4 files changed

+48
-65
lines changed

karma.conf.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
// eslint-disable-next-line import/no-extraneous-dependencies
2-
const createBaseConfig = require('@open-wc/testing-karma/create-karma-config');
1+
/* eslint-disable import/no-extraneous-dependencies */
2+
const defaultSettings = require('@open-wc/testing-karma/default-settings.js');
3+
const merge = require('webpack-merge');
34

4-
module.exports = (config) => {
5-
const baseConfig = createBaseConfig(config);
5+
module.exports = config => {
6+
config.set(
7+
merge(defaultSettings(config), {
8+
files: [
9+
// allows running single tests with the --grep flag
10+
config.grep ? config.grep : 'test/**/*.test.js',
11+
],
612

7-
config.set({
8-
...baseConfig,
9-
10-
files: [
11-
// allows running single tests with the --grep flag
12-
config.grep ? config.grep : 'test/**/*.test.js',
13-
],
14-
15-
// TODO: not yet within the 90% default
16-
coverageIstanbulReporter: {
17-
thresholds: {
18-
global: {
19-
statements: 80,
20-
branches: 70,
21-
functions: 70,
22-
lines: 80,
13+
// TODO: not yet within the 90% default
14+
coverageIstanbulReporter: {
15+
thresholds: {
16+
global: {
17+
statements: 80,
18+
branches: 70,
19+
functions: 70,
20+
lines: 80,
21+
},
2322
},
2423
},
25-
},
26-
});
24+
}),
25+
);
26+
return config;
2727
};

karma.es5.bs.config.js

Lines changed: 10 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,13 @@
1-
// eslint-disable-next-line import/no-extraneous-dependencies
2-
const createBaseConfig = require('@open-wc/testing-karma-bs/create-karma-es5-bs.config');
3-
4-
module.exports = (config) => {
5-
const baseConfig = createBaseConfig(config);
6-
7-
config.set({
8-
...baseConfig,
9-
10-
files: [
11-
...baseConfig.files,
12-
// allows running single tests with the --grep flag
13-
config.grep ? [config.grep] : 'test/**/*.test.js',
14-
],
1+
/* eslint-disable import/no-extraneous-dependencies */
2+
const merge = require('webpack-merge');
3+
const bsSettings = require('@open-wc/testing-karma-bs/bs-settings.js');
4+
const karmaEs5Config = require('./karma.es5.config.js');
155

6+
module.exports = config => {
7+
config.set(merge(bsSettings(config), karmaEs5Config(config), {
168
browserStack: {
17-
...baseConfig.browserStack,
18-
project: 'example-vanilla-set-game',
19-
},
20-
21-
// just an example build for chrome only
22-
browsers: [
23-
'bs_win10_chrome_latest',
24-
// 'bs_win10_firefox_latest',
25-
// 'bs_win10_edge_latest',
26-
// 'bs_osxmojave_safari_latest',
27-
// 'bs_win10_ie_11',
28-
],
29-
30-
// TODO: not yet within the 90% default
31-
coverageIstanbulReporter: {
32-
thresholds: {
33-
global: {
34-
statements: 80,
35-
branches: 70,
36-
functions: 70,
37-
lines: 80,
38-
},
39-
},
40-
},
41-
});
9+
project: 'your-name',
10+
}
11+
}));
12+
return config;
4213
};

karma.es5.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* eslint-disable import/no-extraneous-dependencies */
2+
const merge = require('webpack-merge');
3+
const es5Settings = require('@open-wc/testing-karma/es5-settings.js');
4+
const karmaConf = require('./karma.conf.js');
5+
6+
module.exports = config => {
7+
config.set(merge(es5Settings(config), karmaConf(config)));
8+
return config;
9+
};

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,17 @@
1717
"storybook:start": "start-storybook -p 9001",
1818
"test": "karma start",
1919
"test:watch": "karma start --auto-watch=true --single-run=false",
20+
"test:es5": "karma start karma.es5.config.js",
21+
"test:es5:watch": "karma start karma.es5.config.js --auto-watch=true --single-run=false",
2022
"test:es5:bs": "karma start karma.es5.bs.config.js"
2123
},
2224
"devDependencies": {
2325
"@open-wc/eslint-config": "^0.3.0",
2426
"@open-wc/storybook": "^0.2.0",
25-
"@open-wc/testing": "^0.7.0",
26-
"@open-wc/testing-karma": "^0.3.0",
27-
"@open-wc/testing-karma-bs": "^0.1.0",
28-
"@open-wc/testing-wallaby": "^0.1.3"
27+
"@open-wc/testing": "^0.8.0",
28+
"@open-wc/testing-karma": "^0.4.0",
29+
"@open-wc/testing-karma-bs": "^0.2.0",
30+
"@open-wc/testing-wallaby": "^0.1.3",
31+
"webpack-merge": "^4.1.5"
2932
}
3033
}

0 commit comments

Comments
 (0)