Upgrade jest

increase timeout
fix hanging
avoid inspector in CI
setup jest caching
This commit is contained in:
Tobias Koppers 2018-05-18 16:34:01 +02:00
parent 8adaa749e3
commit 4a541303c9
13 changed files with 424 additions and 449 deletions

View File

@ -9,6 +9,9 @@ branches:
cache:
yarn: true
directories:
- ".jest-cache"
- ".eslintcache"
stages:
- basic
@ -19,7 +22,7 @@ matrix:
include:
- os: linux
node_js: "10"
env: NO_WATCH_TESTS=1 JEST=--maxWorkers=2 JOB_PART=basic
env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=basic
stage: basic
- os: linux
node_js: "10"
@ -27,7 +30,11 @@ matrix:
stage: advanced
- os: linux
node_js: "10"
env: NO_WATCH_TESTS=1 JEST=--maxWorkers=2 JOB_PART=integration
env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration1
stage: advanced
- os: linux
node_js: "10"
env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration2
stage: advanced
- os: linux
node_js: "10"
@ -35,15 +42,27 @@ matrix:
stage: advanced
- os: osx
node_js: "10"
env: NO_WATCH_TESTS=1 JEST=--maxWorkers=2 JOB_PART=integration
env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration1
stage: versions
- os: osx
node_js: "10"
env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration2
stage: versions
- os: linux
node_js: "8"
env: NO_WATCH_TESTS=1 JEST=--maxWorkers=2 JOB_PART=integration
env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration1
stage: versions
- os: linux
node_js: "8"
env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration2
stage: versions
- os: linux
node_js: "6"
env: NO_WATCH_TESTS=1 JEST=--maxWorkers=2 JOB_PART=integration
env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration1
stage: versions
- os: linux
node_js: "6"
env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration2
stage: versions
fast_finish: true
@ -52,7 +71,7 @@ install:
- yarn link --frozen-lockfile || true
- yarn link webpack --frozen-lockfile
script: npm run travis:$JOB_PART
script: yarn travis:$JOB_PART
after_success:
- cat ./coverage/lcov.info | node_modules/.bin/coveralls --verbose

View File

@ -15,10 +15,16 @@ environment:
- nodejs_version: 8
job_part: unit
- nodejs_version: 8
job_part: integration
job_part: integration1
jest: --maxWorkers=2
- nodejs_version: 8
job_part: integration2
jest: --maxWorkers=2
- nodejs_version: 6
job_part: integration
job_part: integration1
jest: --maxWorkers=2
- nodejs_version: 6
job_part: integration2
jest: --maxWorkers=2
install:

View File

@ -52,7 +52,7 @@
"istanbul": "^0.4.5",
"jade": "^1.11.0",
"jade-loader": "~0.8.0",
"jest": "23.0.0-alpha.5",
"jest": "23.0.0-charlie.3",
"jest-silent-reporter": "0.0.4",
"json-loader": "^0.5.7",
"less": "^2.5.1",
@ -102,12 +102,14 @@
"test:integration": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.test.js\"",
"test:basic": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/{TestCasesNormal,StatsTestCases,ConfigTestCases}.test.js\"",
"test:unit": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.unittest.js\"",
"travis:integration": "yarn cover:init && yarn cover:integration --ci $JEST && yarn cover:report-min",
"travis:integration1": "yarn cover:init && yarn cover:integration \"test/((?!TestCases)|TestCasesD)\" --ci $JEST && yarn cover:report-min",
"travis:integration2": "yarn cover:init && yarn cover:integration \"test/TestCases(?!D)\" --ci $JEST && yarn cover:report-min",
"travis:basic": "yarn test:basic --ci $JEST",
"travis:unit": "yarn cover:init && yarn cover:unit --ci",
"travis:lint": "yarn lint",
"travis:benchmark": "yarn benchmark --ci",
"appveyor:integration": "yarn cover:init && yarn cover:integration --ci %JEST% && yarn cover:report-min",
"appveyor:integration1": "yarn cover:init && yarn cover:integration \"test/((?!TestCases)|TestCasesD)\" --ci %JEST% && yarn cover:report-min",
"appveyor:integration2": "yarn cover:init && yarn cover:integration \"test/TestCases(?!D)\" --ci %JEST% && yarn cover:report-min",
"appveyor:unit": "yarn cover:init && yarn cover:unit --ci && yarn cover:report-min",
"appveyor:benchmark": "yarn benchmark --ci",
"circleci:test": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --ci",

View File

@ -16,6 +16,8 @@ describe("ConfigTestCases", () => {
const casesPath = path.join(__dirname, "configCases");
let categories = fs.readdirSync(casesPath);
jest.setTimeout(10000);
categories = categories.map(cat => {
return {
name: cat,
@ -262,7 +264,9 @@ describe("ConfigTestCases", () => {
if (exportedTests.length < filesCount)
return done(new Error("No tests exported by test case"));
if (testConfig.afterExecute) testConfig.afterExecute();
const asyncSuite = describe("exported tests", () => {
const asyncSuite = describe(`ConfigTestCases ${
category.name
} ${testName} exported tests`, () => {
exportedBeforeEach.forEach(beforeEach);
exportedAfterEach.forEach(afterEach);
exportedTests.forEach(

View File

@ -8,6 +8,8 @@ const webpack = require("../lib/webpack");
const base = path.join(__dirname, "fixtures", "errors");
describe("Errors", () => {
jest.setTimeout(20000);
function customOutputFilesystem(c) {
const files = {};
c.outputFileSystem = {

View File

@ -177,13 +177,15 @@ describe("HotTestCases", () => {
if (exportedTests.length < 1)
return done(new Error("No tests exported by test case"));
const asyncSuite = describe("exported tests", () => {
exportedTests.forEach(
({ title, fn, timeout }) =>
fn
? fit(title, fn, timeout)
: fit(title, () => {}).pend("Skipped")
);
const asyncSuite = describe(`HotTestCases ${
category.name
} ${testName} exported tests`, () => {
exportedTests.forEach(({ title, fn, timeout }) => {
jest.setTimeout(10000);
return fn
? fit(title, fn, timeout)
: fit(title, () => {}).pend("Skipped");
});
});
// workaround for jest running clearSpies on the wrong suite (invoked by clearResourcesForRunnable)
asyncSuite.disabled = true;

View File

@ -21,6 +21,8 @@ const createMultiCompiler = () => {
};
describe("MultiCompiler", function() {
jest.setTimeout(20000);
it("should trigger 'run' for each child compiler", done => {
const compiler = createMultiCompiler();
let called = 0;

View File

@ -52,6 +52,8 @@ const describeCases = config => {
describe(config.name, () => {
categories.forEach(category => {
describe(category.name, function() {
jest.setTimeout(20000);
category.tests
.filter(test => {
const testDirectory = path.join(casesPath, category.name, test);
@ -160,10 +162,10 @@ const describeCases = config => {
});
})
};
let exportedTests = [];
it(
testName + " should compile",
done => {
const exportedTests = [];
webpack(options, (err, stats) => {
if (err) done(err);
const statOptions = Stats.presetToOptions("verbose");
@ -233,7 +235,9 @@ const describeCases = config => {
if (exportedTests.length === 0)
return done(new Error("No tests exported by test case"));
const asyncSuite = describe("exported tests", () => {
const asyncSuite = describe(`${config.name} ${
category.name
} ${testName} exported tests`, () => {
exportedTests.forEach(
({ title, fn, timeout }) =>
fn

View File

@ -327,7 +327,9 @@ describe("WatchTestCases", () => {
};
// Run the tests
const asyncSuite = describe(`step ${run.name}`, () => {
const asyncSuite = describe(`WatchTestCases ${
category.name
} ${testName} step ${run.name}`, () => {
exportedTests.forEach(
({ title, fn, timeout }) =>
fn

View File

@ -0,0 +1,3 @@
module.exports = function(config) {
return !process.env.CI;
};

View File

@ -18,13 +18,19 @@ module.exports = {
minimize: true,
minimizer: [
new UglifyJsPlugin({
cache: false,
parallel: false,
exclude: ["vendors.js", "extract.js"]
}),
new UglifyJsPlugin({
cache: false,
parallel: false,
extractComments: true,
include: ["extract.js"]
}),
new UglifyJsPlugin({
cache: false,
parallel: false,
uglifyOptions: {
compress: {
passes: 2

View File

@ -0,0 +1,3 @@
module.exports = function(config) {
return !process.env.CI;
};

774
yarn.lock

File diff suppressed because it is too large Load Diff