Skip to content
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 33 commits into from Jul 6, 2021
Merged
Show file tree
Hide file tree
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 Jul 3, 2021
768096c
update tests
guybedford Jul 3, 2021
e3d991b
update timeouts
guybedford Jul 3, 2021
d973d29
update jest
guybedford Jul 3, 2021
1ee1550
remove duplicated test
guybedford Jul 3, 2021
82a4889
separate integration tests
guybedford Jul 3, 2021
da9a64c
fixup integration test
guybedford Jul 3, 2021
634c448
try add teardown timeout
guybedford Jul 3, 2021
d70eaaf
try increase teardown timeout
guybedford Jul 3, 2021
599f2b4
bisect on cli / integration tests
guybedford Jul 3, 2021
6ab6030
fixup bisect
guybedford Jul 3, 2021
5ab70a2
reduce timeouts
guybedford Jul 3, 2021
1f57d4e
bisect down to watcher, remove timeouts
guybedford Jul 3, 2021
6a3991d
increase jest watcher timeout
guybedford Jul 3, 2021
9a0c426
try node 14.17.2
guybedford Jul 5, 2021
8046330
use check latest for nodejs
guybedford Jul 5, 2021
1264641
reinstate all tests
guybedford Jul 5, 2021
8453d40
Revert "reinstate all tests"
guybedford Jul 5, 2021
a59d1d5
webpack@5.42.1
guybedford Jul 5, 2021
61d8e8a
add teardown timeout
guybedford Jul 5, 2021
72a9f2c
try defer unhandled rejections
guybedford Jul 5, 2021
baa4bda
note unhandled rejections
guybedford Jul 5, 2021
9b010a4
add completion delay
guybedford Jul 5, 2021
e69b1da
add logging
guybedford Jul 5, 2021
795e05d
try non-sensical stackoverflow answer
guybedford Jul 5, 2021
326440a
note all unhandled rejections
guybedford Jul 5, 2021
b769941
easier debugging
guybedford Jul 5, 2021
84bccb8
fixup workflow
guybedford Jul 5, 2021
ef0523e
remove fake timers
guybedford Jul 5, 2021
1718f54
process exit
guybedford Jul 5, 2021
1e5adaf
next attempt
guybedford Jul 5, 2021
4ab51df
try all integration tests
guybedford Jul 5, 2021
d7c32b2
reinstate full testing
guybedford Jul 5, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Expand Up @@ -27,6 +27,7 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
check-latest: true
Copy link
Member

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?

Copy link
Member

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?

- name: Print Node Version
run: node --version
- name: Install Dependencies
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -61,7 +61,7 @@
"hot-shots": "^5.9.2",
"ioredis": "^4.2.0",
"isomorphic-unfetch": "^3.0.0",
"jest": "^26.3.0",
"jest": "^27.0.6",
"jimp": "^0.5.6",
"jugglingdb": "2.0.1",
"koa": "^2.6.2",
Expand Down Expand Up @@ -110,7 +110,7 @@
"vue": "^2.5.17",
"vue-server-renderer": "^2.5.17",
"web-vitals": "^0.2.4",
"webpack": "5.36.2",
"webpack": "5.42.1",
"when": "^3.7.8"
},
"resolutions": {
Expand Down
33 changes: 33 additions & 0 deletions test/cli.test.js
@@ -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);
}
});
}
210 changes: 0 additions & 210 deletions test/index.test.js

This file was deleted.

112 changes: 112 additions & 0 deletions test/integration.test.js
@@ -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;
});