Skip to content

Commit 4a54130

Browse files
committed
Upgrade jest
increase timeout fix hanging avoid inspector in CI setup jest caching
1 parent 8adaa74 commit 4a54130

File tree

13 files changed

+424
-449
lines changed

13 files changed

+424
-449
lines changed

.travis.yml

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ branches:
99

1010
cache:
1111
yarn: true
12+
directories:
13+
- ".jest-cache"
14+
- ".eslintcache"
1215

1316
stages:
1417
- basic
@@ -19,31 +22,47 @@ matrix:
1922
include:
2023
- os: linux
2124
node_js: "10"
22-
env: NO_WATCH_TESTS=1 JEST=--maxWorkers=2 JOB_PART=basic
25+
env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=basic
2326
stage: basic
2427
- os: linux
2528
node_js: "10"
2629
env: NO_WATCH_TESTS=1 JOB_PART=lint
2730
stage: advanced
2831
- os: linux
2932
node_js: "10"
30-
env: NO_WATCH_TESTS=1 JEST=--maxWorkers=2 JOB_PART=integration
33+
env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration1
34+
stage: advanced
35+
- os: linux
36+
node_js: "10"
37+
env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration2
3138
stage: advanced
3239
- os: linux
3340
node_js: "10"
3441
env: NO_WATCH_TESTS=1 JOB_PART=unit
3542
stage: advanced
3643
- os: osx
3744
node_js: "10"
38-
env: NO_WATCH_TESTS=1 JEST=--maxWorkers=2 JOB_PART=integration
45+
env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration1
46+
stage: versions
47+
- os: osx
48+
node_js: "10"
49+
env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration2
3950
stage: versions
4051
- os: linux
4152
node_js: "8"
42-
env: NO_WATCH_TESTS=1 JEST=--maxWorkers=2 JOB_PART=integration
53+
env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration1
54+
stage: versions
55+
- os: linux
56+
node_js: "8"
57+
env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration2
58+
stage: versions
59+
- os: linux
60+
node_js: "6"
61+
env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration1
4362
stage: versions
4463
- os: linux
4564
node_js: "6"
46-
env: NO_WATCH_TESTS=1 JEST=--maxWorkers=2 JOB_PART=integration
65+
env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration2
4766
stage: versions
4867
fast_finish: true
4968

@@ -52,7 +71,7 @@ install:
5271
- yarn link --frozen-lockfile || true
5372
- yarn link webpack --frozen-lockfile
5473

55-
script: npm run travis:$JOB_PART
74+
script: yarn travis:$JOB_PART
5675

5776
after_success:
5877
- cat ./coverage/lcov.info | node_modules/.bin/coveralls --verbose

appveyor.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,16 @@ environment:
1515
- nodejs_version: 8
1616
job_part: unit
1717
- nodejs_version: 8
18-
job_part: integration
18+
job_part: integration1
19+
jest: --maxWorkers=2
20+
- nodejs_version: 8
21+
job_part: integration2
22+
jest: --maxWorkers=2
23+
- nodejs_version: 6
24+
job_part: integration1
1925
jest: --maxWorkers=2
2026
- nodejs_version: 6
21-
job_part: integration
27+
job_part: integration2
2228
jest: --maxWorkers=2
2329

2430
install:

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"istanbul": "^0.4.5",
5353
"jade": "^1.11.0",
5454
"jade-loader": "~0.8.0",
55-
"jest": "23.0.0-alpha.5",
55+
"jest": "23.0.0-charlie.3",
5656
"jest-silent-reporter": "0.0.4",
5757
"json-loader": "^0.5.7",
5858
"less": "^2.5.1",
@@ -102,12 +102,14 @@
102102
"test:integration": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.test.js\"",
103103
"test:basic": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/{TestCasesNormal,StatsTestCases,ConfigTestCases}.test.js\"",
104104
"test:unit": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.unittest.js\"",
105-
"travis:integration": "yarn cover:init && yarn cover:integration --ci $JEST && yarn cover:report-min",
105+
"travis:integration1": "yarn cover:init && yarn cover:integration \"test/((?!TestCases)|TestCasesD)\" --ci $JEST && yarn cover:report-min",
106+
"travis:integration2": "yarn cover:init && yarn cover:integration \"test/TestCases(?!D)\" --ci $JEST && yarn cover:report-min",
106107
"travis:basic": "yarn test:basic --ci $JEST",
107108
"travis:unit": "yarn cover:init && yarn cover:unit --ci",
108109
"travis:lint": "yarn lint",
109110
"travis:benchmark": "yarn benchmark --ci",
110-
"appveyor:integration": "yarn cover:init && yarn cover:integration --ci %JEST% && yarn cover:report-min",
111+
"appveyor:integration1": "yarn cover:init && yarn cover:integration \"test/((?!TestCases)|TestCasesD)\" --ci %JEST% && yarn cover:report-min",
112+
"appveyor:integration2": "yarn cover:init && yarn cover:integration \"test/TestCases(?!D)\" --ci %JEST% && yarn cover:report-min",
111113
"appveyor:unit": "yarn cover:init && yarn cover:unit --ci && yarn cover:report-min",
112114
"appveyor:benchmark": "yarn benchmark --ci",
113115
"circleci:test": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --ci",

test/ConfigTestCases.test.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ describe("ConfigTestCases", () => {
1616
const casesPath = path.join(__dirname, "configCases");
1717
let categories = fs.readdirSync(casesPath);
1818

19+
jest.setTimeout(10000);
20+
1921
categories = categories.map(cat => {
2022
return {
2123
name: cat,
@@ -262,7 +264,9 @@ describe("ConfigTestCases", () => {
262264
if (exportedTests.length < filesCount)
263265
return done(new Error("No tests exported by test case"));
264266
if (testConfig.afterExecute) testConfig.afterExecute();
265-
const asyncSuite = describe("exported tests", () => {
267+
const asyncSuite = describe(`ConfigTestCases ${
268+
category.name
269+
} ${testName} exported tests`, () => {
266270
exportedBeforeEach.forEach(beforeEach);
267271
exportedAfterEach.forEach(afterEach);
268272
exportedTests.forEach(

test/Errors.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ const webpack = require("../lib/webpack");
88
const base = path.join(__dirname, "fixtures", "errors");
99

1010
describe("Errors", () => {
11+
jest.setTimeout(20000);
12+
1113
function customOutputFilesystem(c) {
1214
const files = {};
1315
c.outputFileSystem = {

test/HotTestCases.test.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,15 @@ describe("HotTestCases", () => {
177177
if (exportedTests.length < 1)
178178
return done(new Error("No tests exported by test case"));
179179

180-
const asyncSuite = describe("exported tests", () => {
181-
exportedTests.forEach(
182-
({ title, fn, timeout }) =>
183-
fn
184-
? fit(title, fn, timeout)
185-
: fit(title, () => {}).pend("Skipped")
186-
);
180+
const asyncSuite = describe(`HotTestCases ${
181+
category.name
182+
} ${testName} exported tests`, () => {
183+
exportedTests.forEach(({ title, fn, timeout }) => {
184+
jest.setTimeout(10000);
185+
return fn
186+
? fit(title, fn, timeout)
187+
: fit(title, () => {}).pend("Skipped");
188+
});
187189
});
188190
// workaround for jest running clearSpies on the wrong suite (invoked by clearResourcesForRunnable)
189191
asyncSuite.disabled = true;

test/MultiCompiler.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ const createMultiCompiler = () => {
2121
};
2222

2323
describe("MultiCompiler", function() {
24+
jest.setTimeout(20000);
25+
2426
it("should trigger 'run' for each child compiler", done => {
2527
const compiler = createMultiCompiler();
2628
let called = 0;

test/TestCases.template.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ const describeCases = config => {
5252
describe(config.name, () => {
5353
categories.forEach(category => {
5454
describe(category.name, function() {
55+
jest.setTimeout(20000);
56+
5557
category.tests
5658
.filter(test => {
5759
const testDirectory = path.join(casesPath, category.name, test);
@@ -160,10 +162,10 @@ const describeCases = config => {
160162
});
161163
})
162164
};
163-
let exportedTests = [];
164165
it(
165166
testName + " should compile",
166167
done => {
168+
const exportedTests = [];
167169
webpack(options, (err, stats) => {
168170
if (err) done(err);
169171
const statOptions = Stats.presetToOptions("verbose");
@@ -233,7 +235,9 @@ const describeCases = config => {
233235
if (exportedTests.length === 0)
234236
return done(new Error("No tests exported by test case"));
235237

236-
const asyncSuite = describe("exported tests", () => {
238+
const asyncSuite = describe(`${config.name} ${
239+
category.name
240+
} ${testName} exported tests`, () => {
237241
exportedTests.forEach(
238242
({ title, fn, timeout }) =>
239243
fn

test/WatchTestCases.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,9 @@ describe("WatchTestCases", () => {
327327
};
328328

329329
// Run the tests
330-
const asyncSuite = describe(`step ${run.name}`, () => {
330+
const asyncSuite = describe(`WatchTestCases ${
331+
category.name
332+
} ${testName} step ${run.name}`, () => {
331333
exportedTests.forEach(
332334
({ title, fn, timeout }) =>
333335
fn
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = function(config) {
2+
return !process.env.CI;
3+
};

test/configCases/plugins/uglifyjs-plugin/webpack.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,19 @@ module.exports = {
1818
minimize: true,
1919
minimizer: [
2020
new UglifyJsPlugin({
21+
cache: false,
22+
parallel: false,
2123
exclude: ["vendors.js", "extract.js"]
2224
}),
2325
new UglifyJsPlugin({
26+
cache: false,
27+
parallel: false,
2428
extractComments: true,
2529
include: ["extract.js"]
2630
}),
2731
new UglifyJsPlugin({
32+
cache: false,
33+
parallel: false,
2834
uglifyOptions: {
2935
compress: {
3036
passes: 2
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = function(config) {
2+
return !process.env.CI;
3+
};

0 commit comments

Comments
 (0)