Skip to content

Commit 9c7fcf3

Browse files
wacky6ziyoung
authored andcommitted
chore: update test deps and conf (ElemeFE#14735)
* test: run in headless chrome * chore: update travis node version * chore: upgrade test deps * test: fix tests * test: support async await * test: fix tree test case * test: fix tree test cases * test: fix popper test case
1 parent e6cb64b commit 9c7fcf3

18 files changed

+792
-899
lines changed

.eslintrc

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
2-
"env": {
3-
"mocha": true
4-
},
52
"globals": {
6-
"ga": true,
7-
"expect": true,
8-
"sinon": true
3+
"ga": true
94
},
105
"plugins": ["html", "json"],
116
"extends": "elemefe",

.travis.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
sudo: false
22
language: node_js
3-
node_js: 8
3+
node_js: 10
4+
addons:
5+
chrome: stable
46
before_install:
5-
- export CHROME_BIN=chromium-browser
6-
- export DISPLAY=:99.0
7-
- sh -e /etc/init.d/xvfb start
87
- export TRAVIS_COMMIT_MSG="[deploy] $(git log --format='%h - %B' --no-merges -n 1)"
98
- export TRAVIS_COMMIT_USER="$(git log --no-merges -n 1 --format=%an)"
109
- export TRAVIS_COMMIT_EMAIL="$(git log --no-merges -n 1 --format=%ae)"

package.json

+12-11
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,11 @@
8181
"babel-plugin-transform-vue-jsx": "^3.7.0",
8282
"babel-preset-env": "^1.7.0",
8383
"babel-preset-stage-2": "^6.24.1",
84-
"chai": "^3.5.0",
84+
"babel-regenerator-runtime": "^6.5.0",
85+
"chai": "^4.2.0",
8586
"chokidar": "^1.7.0",
8687
"copy-webpack-plugin": "^5.0.0",
87-
"coveralls": "^2.11.14",
88+
"coveralls": "^3.0.3",
8889
"cp-cli": "^1.0.2",
8990
"cross-env": "^3.1.3",
9091
"css-loader": "^2.1.0",
@@ -104,20 +105,20 @@
104105
"html-webpack-plugin": "^3.2.0",
105106
"json-loader": "^0.5.7",
106107
"json-templater": "^1.0.4",
107-
"karma": "^1.3.0",
108+
"karma": "^4.0.1",
108109
"karma-chrome-launcher": "^2.2.0",
109-
"karma-coverage": "^1.1.1",
110-
"karma-mocha": "^1.2.0",
111-
"karma-sinon-chai": "^1.2.4",
110+
"karma-coverage": "^1.1.2",
111+
"karma-mocha": "^1.3.0",
112+
"karma-sinon-chai": "^2.0.2",
112113
"karma-sourcemap-loader": "^0.3.7",
113-
"karma-spec-reporter": "0.0.26",
114-
"karma-webpack": "^3.0.0",
114+
"karma-spec-reporter": "^0.0.32",
115+
"karma-webpack": "^3.0.5",
115116
"markdown-it": "^8.4.1",
116117
"markdown-it-anchor": "^5.0.2",
117118
"markdown-it-chain": "^1.3.0",
118119
"markdown-it-container": "^2.0.0",
119120
"mini-css-extract-plugin": "^0.4.1",
120-
"mocha": "^3.1.1",
121+
"mocha": "^6.0.2",
121122
"node-sass": "^4.11.0",
122123
"optimize-css-assets-webpack-plugin": "^5.0.1",
123124
"perspective.js": "^1.0.0",
@@ -126,8 +127,8 @@
126127
"rimraf": "^2.5.4",
127128
"sass-loader": "^7.1.0",
128129
"select-version-cli": "^0.0.2",
129-
"sinon": "^1.17.6",
130-
"sinon-chai": "^2.8.0",
130+
"sinon": "^7.2.7",
131+
"sinon-chai": "^3.3.0",
131132
"style-loader": "^0.23.1",
132133
"transliteration": "^1.1.11",
133134
"uglifyjs-webpack-plugin": "^2.1.1",

test/.eslintrc

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"env": {
3+
"mocha": true,
4+
"es6": true
5+
},
6+
"globals": {
7+
"expect": true,
8+
"sinon": true
9+
},
10+
"parserOptions": {
11+
"ecmaVersion": 2017
12+
}
13+
}

test/unit/index.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
// Polyfill fn.bind() for PhantomJS
2-
/* eslint-disable no-extend-native */
3-
Function.prototype.bind = require('function-bind');
1+
require('babel-regenerator-runtime'); // add regenerator support for async await
42
require('packages/theme-chalk/lib/index.css');
53

64
// require all test files (files that ends with .spec.js)

test/unit/karma.conf.js

+1-11
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@ const webpackConfig = require('../../build/webpack.test');
22

33
module.exports = function(config) {
44
const configuration = {
5-
browsers: ['Chrome'],
6-
customLaunchers: {
7-
Chrome_travis_ci: {
8-
base: 'Chrome',
9-
flags: ['--no-sandbox']
10-
}
11-
},
5+
browsers: ['ChromeHeadless'],
126
frameworks: ['mocha', 'sinon-chai'],
137
reporters: ['spec', 'coverage'],
148
files: ['./index.js'],
@@ -33,9 +27,5 @@ module.exports = function(config) {
3327
}
3428
};
3529

36-
if (process.env.TRAVIS) {
37-
configuration.browsers = ['Chrome_travis_ci'];
38-
}
39-
4030
config.set(configuration);
4131
};

0 commit comments

Comments
 (0)