New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to webpack@5.42.0 #723
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
05e8a9d
webpack@5.42.0 update
guybedford 768096c
update tests
guybedford e3d991b
update timeouts
guybedford d973d29
update jest
guybedford 1ee1550
remove duplicated test
guybedford 82a4889
separate integration tests
guybedford da9a64c
fixup integration test
guybedford 634c448
try add teardown timeout
guybedford d70eaaf
try increase teardown timeout
guybedford 599f2b4
bisect on cli / integration tests
guybedford 6ab6030
fixup bisect
guybedford 5ab70a2
reduce timeouts
guybedford 1f57d4e
bisect down to watcher, remove timeouts
guybedford 6a3991d
increase jest watcher timeout
guybedford 9a0c426
try node 14.17.2
guybedford 8046330
use check latest for nodejs
guybedford 1264641
reinstate all tests
guybedford 8453d40
Revert "reinstate all tests"
guybedford a59d1d5
webpack@5.42.1
guybedford 61d8e8a
add teardown timeout
guybedford 72a9f2c
try defer unhandled rejections
guybedford baa4bda
note unhandled rejections
guybedford 9b010a4
add completion delay
guybedford e69b1da
add logging
guybedford 795e05d
try non-sensical stackoverflow answer
guybedford 326440a
note all unhandled rejections
guybedford b769941
easier debugging
guybedford 84bccb8
fixup workflow
guybedford ef0523e
remove fake timers
guybedford 1718f54
process exit
guybedford 1e5adaf
next attempt
guybedford 4ab51df
try all integration tests
guybedford d7c32b2
reinstate full testing
guybedford File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const fs = require("fs"); | ||
const { fork } = require("child_process"); | ||
const coverage = global.coverage; | ||
|
||
jest.setTimeout(20000); | ||
|
||
for (const cliTest of eval(fs.readFileSync(__dirname + "/cli.js").toString())) { | ||
it(`should execute "ncc ${(cliTest.args || []).join(" ")}"`, async () => { | ||
const ps = fork(__dirname + (coverage ? "/../src/cli.js" : "/../dist/ncc/cli.js"), cliTest.args || [], { | ||
stdio: "pipe", | ||
env: { ...process.env, ...cliTest.env }, | ||
}); | ||
let stderr = "", stdout = ""; | ||
ps.stderr.on("data", chunk => stderr += chunk.toString()); | ||
ps.stdout.on("data", chunk => stdout += chunk.toString()); | ||
const expected = cliTest.expect || { code: 0 }; | ||
let timedOut = false; | ||
if (cliTest.timeout) | ||
setTimeout(() => { | ||
timedOut = true; | ||
ps.kill(); | ||
}, cliTest.timeout); | ||
const code = await new Promise(resolve => ps.on("close", resolve)); | ||
if (typeof expected === "function") | ||
expect(expected(code, stdout, stderr, timedOut)).toBe(true); | ||
else { | ||
if ("code" in expected) | ||
expect(code).toBe(expected.code); | ||
if ("timeout" in expected) | ||
expect(timedOut).toBe(true); | ||
} | ||
}); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
const os = require("os"); | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const coverage = global.coverage; | ||
|
||
// the twilio test can take a while (large codebase) | ||
jest.setTimeout(200000); | ||
|
||
let nccRun; | ||
if (coverage) { | ||
nccRun = require(__dirname + "/../src/cli.js"); | ||
} | ||
else { | ||
nccRun = require(__dirname + "/../dist/ncc/cli.js"); | ||
} | ||
|
||
const { Writable } = require('stream'); | ||
|
||
class StoreStream extends Writable { | ||
constructor (options) { | ||
super(options); | ||
this.data = []; | ||
} | ||
_write(chunk, encoding, callback) { | ||
this.data.push(chunk); | ||
callback(); | ||
} | ||
} | ||
|
||
for (const integrationTest of fs.readdirSync(__dirname + "/integration")) { | ||
// ignore e.g.: `.json` files | ||
if (!/\.(mjs|tsx?|js)$/.test(integrationTest)) continue; | ||
|
||
// disabled pending https://github.com/zeit/ncc/issues/141 | ||
if (integrationTest.endsWith('loopback.js')) continue; | ||
|
||
it(`should execute "ncc run ${integrationTest}"`, async () => { | ||
let expectedStdout; | ||
try { | ||
expectedStdout = fs.readFileSync(`${__dirname}/integration/${integrationTest}.stdout`).toString(); | ||
} | ||
catch (e) {} | ||
if (global.gc) global.gc(); | ||
const stdout = new StoreStream(); | ||
const stderr = new StoreStream(); | ||
try { | ||
await nccRun(["run", "--no-cache", "--no-asset-builds", `${__dirname}/integration/${integrationTest}`], stdout, stderr); | ||
} | ||
catch (e) { | ||
if (e.silent) { | ||
let lastErr = stderr.data[stderr.data.length - 1]; | ||
if (lastErr) | ||
throw new Error(lastErr); | ||
else | ||
throw new Error('Process exited with code ' + e.exitCode); | ||
} | ||
throw e; | ||
} | ||
if (expectedStdout) { | ||
let stdoutStr = ''; | ||
for (const chunk of stdout.data) | ||
stdoutStr += chunk.toString(); | ||
expect(stdoutStr.startsWith(expectedStdout)); | ||
} | ||
}); | ||
} | ||
|
||
it(`should execute "ncc build web-vitals" with target config`, async () => { | ||
if (global.gc) global.gc(); | ||
const stdout = new StoreStream(); | ||
const stderr = new StoreStream(); | ||
|
||
const tmpOut = path.join(os.tmpdir(), `ncc_${Math.random()}`) | ||
|
||
try { | ||
await nccRun(["build", "-o", tmpOut, "--target", "es5", require.resolve('web-vitals/dist/web-vitals.es5.min.js')], stdout, stderr); | ||
} | ||
catch (e) { | ||
if (e.silent) { | ||
let lastErr = stderr.data[stderr.data.length - 1]; | ||
if (lastErr) | ||
throw new Error(lastErr); | ||
else | ||
throw new Error('Process exited with code ' + e.exitCode); | ||
} | ||
throw e; | ||
} | ||
|
||
const outFile = path.join(tmpOut, 'index.js') | ||
const output = fs.readFileSync(outFile, 'utf8') | ||
|
||
// cleanup tmp output | ||
fs.unlinkSync(outFile) | ||
fs.rmdirSync(tmpOut) | ||
|
||
expect(output).toContain('function') | ||
// make sure es6 wrapper wasn't used | ||
expect(output).not.toContain('=>') | ||
|
||
await new Promise(resolve => setTimeout(resolve, 5000)); | ||
}); | ||
|
||
afterAll(() => { | ||
if (coverage) | ||
process.exit(0); | ||
}); | ||
|
||
// remove me when node.js makes this the default behavior | ||
process.on("unhandledRejection", e => { | ||
throw e; | ||
}); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which version was it using before this option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it bumped from 14.17.1 to 14.17.3 and that fixed a bug?