Skip to content

Commit a416c49

Browse files
authored
Merge pull request webpack#13775 from webpack/bugfix/azure
fix azure pipeline
2 parents 7fbf3af + 8ee7cf6 commit a416c49

38 files changed

Lines changed: 248 additions & 104 deletions

.github/workflows/test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,14 @@ jobs:
9494
matrix:
9595
os: [ubuntu-latest, windows-latest, macos-latest]
9696
node-version: [10.x, 16.x]
97+
part: [a, b]
9798
include:
9899
- os: ubuntu-latest
99100
node-version: 14.x
101+
part: a
100102
- os: ubuntu-latest
101103
node-version: 12.x
104+
part: a
102105
runs-on: ${{ matrix.os }}
103106
steps:
104107
- uses: actions/checkout@v2
@@ -121,7 +124,7 @@ jobs:
121124
path: .jest-cache
122125
key: jest-integration-${{ env.GITHUB_SHA }}
123126
restore-keys: jest-integration-
124-
- run: yarn cover:integration --ci --cacheDirectory .jest-cache
127+
- run: yarn cover:integration:${{ matrix.part }} --ci --cacheDirectory .jest-cache
125128
- run: yarn cover:merge
126129
- uses: codecov/codecov-action@v1
127130
with:

azure-pipelines.yml

Lines changed: 50 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
export JEST_JUNIT_OUTPUT_NAME=unit-junit.xml
4040
yarn test:unit --ci --reporters=default --reporters=jest-junit
4141
env:
42-
CI: true
42+
CI: "true"
4343
displayName: "Run basic tests"
4444
- task: PublishTestResults@2
4545
inputs:
@@ -93,7 +93,7 @@ jobs:
9393
yarn pretty-lint
9494
yarn spellcheck
9595
env:
96-
CI: true
96+
CI: "true"
9797
displayName: "Run linting"
9898
- task: PublishTestResults@2
9999
inputs:
@@ -109,14 +109,26 @@ jobs:
109109
pool:
110110
vmImage: windows-latest
111111
strategy:
112-
maxParallel: 3
112+
maxParallel: 6
113113
matrix:
114-
node-10:
114+
node-10-a:
115115
node_version: ^10.13.0
116-
node-12:
116+
part: a
117+
node-10-b:
118+
node_version: ^10.13.0
119+
part: b
120+
node-12-a:
121+
node_version: ^12.4.0
122+
part: a
123+
node-12-b:
117124
node_version: ^12.4.0
118-
node-16:
125+
part: b
126+
node-16-a:
127+
node_version: ^16.0.0
128+
part: a
129+
node-16-b:
119130
node_version: ^16.0.0
131+
part: b
120132
steps:
121133
- task: NodeTool@0
122134
inputs:
@@ -142,10 +154,10 @@ jobs:
142154
- script: yarn link webpack --frozen-lockfile
143155
displayName: "Link webpack into node_modules"
144156
- script: |
145-
yarn cover:integration --ci --maxWorkers=2 --reporters=default --reporters=jest-junit
157+
yarn cover:integration:$(part) --ci --maxWorkers=2 --reporters=default --reporters=jest-junit
146158
yarn cover:merge
147159
env:
148-
CI: true
160+
CI: "true"
149161
displayName: "Run tests with coverage"
150162
- task: PublishTestResults@2
151163
inputs:
@@ -161,16 +173,26 @@ jobs:
161173
pool:
162174
vmImage: ubuntu-latest
163175
strategy:
164-
maxParallel: 4
176+
maxParallel: 6
165177
matrix:
166-
node-10:
178+
node-10-a:
179+
node_version: ^10.13.0
180+
part: a
181+
node-10-b:
167182
node_version: ^10.13.0
168-
node-12:
183+
part: b
184+
node-12-a:
169185
node_version: ^12.4.0
170-
node-14:
186+
part: a
187+
node-14-a:
171188
node_version: ^14.0.0
172-
node-16:
189+
part: a
190+
node-16-a:
173191
node_version: ^16.0.0
192+
part: a
193+
node-16-b:
194+
node_version: ^16.0.0
195+
part: b
174196
steps:
175197
- task: NodeTool@0
176198
inputs:
@@ -200,10 +222,10 @@ jobs:
200222
- script: |
201223
set -e
202224
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
203-
yarn cover:integration --ci --maxWorkers=2 --reporters=default --reporters=jest-junit
225+
yarn cover:integration:$(part) --ci --maxWorkers=2 --reporters=default --reporters=jest-junit
204226
yarn cover:merge
205227
env:
206-
CI: true
228+
CI: "true"
207229
displayName: "Run tests with coverage"
208230
- task: PublishTestResults@2
209231
inputs:
@@ -219,12 +241,20 @@ jobs:
219241
pool:
220242
vmImage: macOS-latest
221243
strategy:
222-
maxParallel: 2
244+
maxParallel: 4
223245
matrix:
224-
node-12:
246+
node-12-a:
225247
node_version: ^12.4.0
226-
node-16:
248+
part: a
249+
node-12-b:
250+
node_version: ^12.4.0
251+
part: b
252+
node-16-a:
253+
node_version: ^16.0.0
254+
part: a
255+
node-16-b:
227256
node_version: ^16.0.0
257+
part: b
228258
steps:
229259
- task: NodeTool@0
230260
inputs:
@@ -254,10 +284,10 @@ jobs:
254284
- script: |
255285
set -e
256286
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
257-
yarn cover:integration --ci --reporters=default --reporters=jest-junit
287+
yarn cover:integration:$(part) --ci --reporters=default --reporters=jest-junit
258288
yarn cover:merge
259289
env:
260-
CI: true
290+
CI: "true"
261291
displayName: "Run tests with coverage"
262292
- task: PublishTestResults@2
263293
inputs:

lib/MultiCompiler.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -313,12 +313,12 @@ module.exports = class MultiCompiler {
313313
/**
314314
* @template SetupResult
315315
* @param {function(Compiler, number, Callback<Stats>, function(): boolean, function(): void, function(): void): SetupResult} setup setup a single compiler
316-
* @param {function(Compiler, Callback<Stats>): void} run run/continue a single compiler
316+
* @param {function(Compiler, SetupResult, Callback<Stats>): void} run run/continue a single compiler
317317
* @param {Callback<MultiStats>} callback callback when all compilers are done, result includes Stats of all changed compilers
318318
* @returns {SetupResult[]} result of setup
319319
*/
320320
_runGraph(setup, run, callback) {
321-
/** @typedef {{ compiler: Compiler, result: Stats, state: "pending" | "blocked" | "queued" | "starting" | "running" | "running-outdated" | "done", children: Node[], parents: Node[] }} Node */
321+
/** @typedef {{ compiler: Compiler, setupResult: SetupResult, result: Stats, state: "pending" | "blocked" | "queued" | "starting" | "running" | "running-outdated" | "done", children: Node[], parents: Node[] }} Node */
322322

323323
// State transitions for nodes:
324324
// -> blocked (initial)
@@ -335,6 +335,7 @@ module.exports = class MultiCompiler {
335335
/** @type {Node[]} */
336336
const nodes = this.compilers.map(compiler => ({
337337
compiler,
338+
setupResult: undefined,
338339
result: undefined,
339340
state: "blocked",
340341
children: [],
@@ -444,14 +445,14 @@ module.exports = class MultiCompiler {
444445
const setupResults = [];
445446
nodes.forEach((node, i) => {
446447
setupResults.push(
447-
setup(
448+
(node.setupResult = setup(
448449
node.compiler,
449450
i,
450451
nodeDone.bind(null, node),
451452
() => node.state !== "starting" && node.state !== "running",
452453
() => nodeChange(node),
453454
() => nodeInvalid(node)
454-
)
455+
))
455456
);
456457
});
457458
let processing = true;
@@ -470,7 +471,7 @@ module.exports = class MultiCompiler {
470471
) {
471472
running++;
472473
node.state = "starting";
473-
run(node.compiler, nodeDone.bind(null, node));
474+
run(node.compiler, node.setupResult, nodeDone.bind(null, node));
474475
node.state = "running";
475476
}
476477
}
@@ -522,8 +523,9 @@ module.exports = class MultiCompiler {
522523
}
523524
return watching;
524525
},
525-
(compiler, initial, callback) => {
526-
if (!compiler.watching.running) compiler.watching.invalidate();
526+
(compiler, watching, callback) => {
527+
if (compiler.watching !== watching) return;
528+
if (!watching.running) watching.invalidate();
527529
},
528530
handler
529531
);
@@ -546,7 +548,7 @@ module.exports = class MultiCompiler {
546548
if (this.validateDependencies(callback)) {
547549
this._runGraph(
548550
() => {},
549-
(compiler, callback) => compiler.run(callback),
551+
(compiler, setupResult, callback) => compiler.run(callback),
550552
(err, stats) => {
551553
this.running = false;
552554

package.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@
135135
"jest": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --logHeapUsage",
136136
"test": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --logHeapUsage",
137137
"test:update-snapshots": "yarn jest -u",
138-
"test:integration": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --logHeapUsage --testMatch \"<rootDir>/test/*.test.js\"",
139-
"test:basic": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --logHeapUsage --testMatch \"<rootDir>/te{st/TestCasesNormal,st/StatsTestCases,st/ConfigTestCases}.test.js\"",
138+
"test:integration": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --logHeapUsage --testMatch \"<rootDir>/test/*.{basictest,longtest,test}.js\"",
139+
"test:basic": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --logHeapUsage --testMatch \"<rootDir>/test/*.basictest.js\"",
140140
"test:unit": "node --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.unittest.js\"",
141141
"travis:integration": "yarn cover:integration --ci $JEST",
142142
"travis:basic": "yarn cover:basic --ci $JEST",
@@ -168,11 +168,13 @@
168168
"cover": "yarn cover:all && yarn cover:report",
169169
"cover:clean": "rimraf .nyc_output coverage",
170170
"cover:all": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --logHeapUsage --coverage",
171-
"cover:basic": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --logHeapUsage --testMatch \"<rootDir>/te{st/TestCasesNormal,st/StatsTestCases,st/ConfigTestCases}.test.js\" --coverage",
172-
"cover:integration": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --logHeapUsage --testMatch \"<rootDir>/test/*.test.js\" --coverage",
171+
"cover:basic": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --logHeapUsage --testMatch \"<rootDir>/test/*.basictest.js\" --coverage",
172+
"cover:integration": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --logHeapUsage --testMatch \"<rootDir>/test/*.{basictest,longtest,test}.js\" --coverage",
173+
"cover:integration:a": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --logHeapUsage --testMatch \"<rootDir>/test/*.{basictest,test}.js\" --coverage",
174+
"cover:integration:b": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --logHeapUsage --testMatch \"<rootDir>/test/*.longtest.js\" --coverage",
173175
"cover:unit": "node --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.unittest.js\" --coverage",
174176
"cover:types": "node node_modules/tooling/type-coverage",
175-
"cover:merge": "nyc merge .nyc_output coverage/coverage-nyc.json && rimraf .nyc_output",
177+
"cover:merge": "yarn mkdirp .nyc_output && nyc merge .nyc_output coverage/coverage-nyc.json && rimraf .nyc_output",
176178
"cover:report": "nyc report -t coverage"
177179
},
178180
"lint-staged": {
@@ -193,6 +195,8 @@
193195
],
194196
"testMatch": [
195197
"<rootDir>/test/*.test.js",
198+
"<rootDir>/test/*.basictest.js",
199+
"<rootDir>/test/*.longtest.js",
196200
"<rootDir>/test/*.unittest.js"
197201
],
198202
"watchPathIgnorePatterns": [

test/BuildDependencies.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ const cacheDirectory = path.resolve(__dirname, "js/buildDepsCache");
99
const outputDirectory = path.resolve(__dirname, "js/buildDeps");
1010
const inputDirectory = path.resolve(__dirname, "js/buildDepsInput");
1111

12-
const webpack = require("../");
13-
const coverageEnabled = webpack.toString().includes("++");
14-
1512
const exec = (n, options = {}) => {
1613
return new Promise((resolve, reject) => {
14+
const webpack = require("../");
15+
const coverageEnabled = webpack.toString().includes("++");
16+
1717
const p = child_process.execFile(
1818
process.execPath,
1919
[

test/ChangesAndRemovals.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
"use strict";
22

3+
require("./helpers/warmup-webpack");
4+
35
const path = require("path");
46
const { createFsFromVolume, Volume } = require("memfs");
5-
const webpack = require("..");
67
const fs = require("graceful-fs");
78
const rimraf = require("rimraf");
89

910
const createCompiler = config => {
11+
const webpack = require("..");
1012
const compiler = webpack(config);
1113
compiler.outputFileSystem = createFsFromVolume(new Volume());
1214
return compiler;

test/Compiler-caching.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
"use strict";
22

3+
require("./helpers/warmup-webpack");
4+
35
const path = require("path");
46
const fs = require("graceful-fs");
57
const rimraf = require("rimraf");
68

7-
const webpack = require("..");
89
let fixtureCount = 0;
910

1011
describe("Compiler (caching)", () => {
1112
jest.setTimeout(15000);
1213

1314
function compile(entry, options, callback) {
15+
const webpack = require("..");
1416
options = webpack.config.getNormalizedWebpackOptions(options);
1517
options.mode = "none";
1618
options.cache = true;

0 commit comments

Comments
 (0)