[go: nahoru, domu]

Skip to content

Commit

Permalink
Build: Require Node.js 18 or later
Browse files Browse the repository at this point in the history
Remove old Node version CI jobs.

`semver` package is now unused.

Fixes #1727.
Closes #1731.
  • Loading branch information
NullVoxPopuli authored and Krinkle committed May 29, 2024
1 parent 471349e commit c43ff7f
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 96 deletions.
43 changes: 15 additions & 28 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,52 +12,39 @@ jobs:
matrix:
include:
- name: "Linux: Node 18"
os: ubuntu-20.04
node: 18.x
script: npm run test-nolint

- name: "Linux: Node 16"
# Includes 'firefox', 'chromium', and more.
# https://github.com/actions/virtual-environments/blob/ubuntu20/20220410.2/images/linux/Ubuntu2004-Readme.md
os: ubuntu-20.04
node: 16.x
# Run the lint step only once because, in March 2022, GitHub began
# automatically extracting ESLint warnings from build logs and turning them into
# checks shown inline in PR diffs, but doesn't de-duplicate these.
node: 18.x
script: npm test

- name: "Linux: Node 14"
os: ubuntu-20.04
node: 14.x
script: npm run test-nolint
- name: "Linux: Node 20"
os: ubuntu-22.04
node: 20.x
script: npm run test

- name: "Linux: Node 12"
os: ubuntu-20.04
node: 12.x
script: npm run test-nolint

- name: "Linux: Node 10"
os: ubuntu-20.04
node: 10.x
script: npm run test-nolint
- name: "Linux: Node 22"
os: ubuntu-24.04
node: 22.x
script: npm run test

- name: "Integration"
os: ubuntu-20.04
node: 16.x
node: 18.x
script: npm run test-integration

- name: "Windows: Node 16"
- name: "Windows: Node 18"
os: windows-latest
node: 16.x
node: 18.x
script: npm run test-nolint

# use macos-12 instead of macos-latest
# as proxy for Intel instead of ARM
# because the older Puppeteer/Chromr for Node 10 compat
# because the older Puppeteer/Chrome for Node 10 compat
# didn't support ARM yet.
- name: "macOS: Node 16"
- name: "macOS: Node 18"
os: macos-12
node: 16.x
node: 18.x
script: npm run test-nolint

name: ${{ matrix.name }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/browsers-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:
${{ github.workspace }}/.puppeteer_download
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}

- name: Use Node.js 16
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 18.x

- name: Prepare
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/browsers-quick.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
${{ github.workspace }}/.puppeteer_download
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}

- name: Use Node.js 16
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 18.x

- name: Prepare
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
${{ github.workspace }}/.puppeteer_download
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}

- name: Use Node.js 16
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 18.x

- run: npm ci

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/reproducible.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Use Node.js 16
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 18.x

- run: node build/reproducible-builds.js
5 changes: 2 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
],
"main": "qunit/qunit.js",
"engines": {
"node": ">=10"
"node": ">=18"
},
"dependencies": {
"commander": "7.2.0",
Expand Down Expand Up @@ -79,8 +79,7 @@
"proxyquire": "^1.8.0",
"requirejs": "^2.3.6",
"rimraf": "^3.0.2",
"rollup": "^2.79.1",
"semver": "^7.6.2"
"rollup": "^2.79.1"
},
"scripts": {
"build": "rollup -c && grunt copy:src-css",
Expand Down
96 changes: 42 additions & 54 deletions test/cli/cli-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

const path = require('path');

const semver = require('semver');

const { execute, concurrentMapKeys } = require('./helpers/execute.js');
const { readFixtures } = require('./helpers/fixtures.js');

Expand Down Expand Up @@ -222,34 +220,28 @@ HOOK: BCD1 @ B after`;
assert.equal(execution.code, 0);
});

if (semver.gte(process.versions.node, '12.0.0')) {
QUnit.test('run ESM test suite with import statement', async assert => {
const command = ['qunit', '../../es2018/esm.mjs'];
const execution = await execute(command);

// Node 12 enabled ESM by default, without experimental flag,
// but left the warning in stderr. The warning was removed in Node 14.
// Don't bother checking stderr
const stderr = semver.gte(process.versions.node, '14.0.0') ? execution.stderr : '';
assert.equal(execution.code, 0);
assert.equal(stderr, '');
assert.equal(execution.stdout, `TAP version 13
// TODO: Move to /test/cli/fixtures/
QUnit.test('run ESM test suite with import statement', async assert => {
const command = ['qunit', '../../es2018/esm.mjs'];
const execution = await execute(command);

assert.equal(execution.code, 0);
assert.equal(execution.stderr, '');
assert.equal(execution.stdout, `TAP version 13
ok 1 ESM test suite > sum()
1..1
# pass 1
# skip 0
# todo 0
# fail 0`);
});
}
});

// https://nodejs.org/dist/v12.12.0/docs/api/cli.html#cli_enable_source_maps
if (semver.gte(process.versions.node, '14.0.0')) {
QUnit.test('normal trace with native source map', async assert => {
const command = ['qunit', 'sourcemap/source.js'];
const execution = await execute(command);
// TODO: Move to /test/cli/fixtures/
QUnit.test('normal trace with native source map', async assert => {
const command = ['qunit', 'sourcemap/source.js'];
const execution = await execute(command);

assert.equal(execution.snapshot, `TAP version 13
assert.equal(execution.snapshot, `TAP version 13
ok 1 Example > good
not ok 2 Example > bad
---
Expand All @@ -267,18 +259,18 @@ not ok 2 Example > bad
# fail 1
# exit code: 1`);
});
});

// skip if running in code coverage mode,
// as that leads to conflicting maps-on-maps that invalidate this test
QUnit[process.env.NYC_PROCESS_ID ? 'skip' : 'test'](
'mapped trace with native source map', async function (assert) {
const command = ['qunit', 'sourcemap/source.min.js'];
const execution = await execute(command, {
env: { NODE_OPTIONS: '--enable-source-maps' }
});
// skip if running in code coverage mode,
// as that leads to conflicting maps-on-maps that invalidate this test
QUnit[process.env.NYC_PROCESS_ID ? 'skip' : 'test'](
'mapped trace with native source map', async function (assert) {
const command = ['qunit', 'sourcemap/source.min.js'];
const execution = await execute(command, {
env: { NODE_OPTIONS: '--enable-source-maps' }
});

assert.equal(execution.snapshot, `TAP version 13
assert.equal(execution.snapshot, `TAP version 13
ok 1 Example > good
not ok 2 Example > bad
---
Expand All @@ -296,16 +288,13 @@ not ok 2 Example > bad
# fail 1
# exit code: 1`);
});
}

// https://nodejs.org/docs/v14.0.0/api/v8.html#v8_v8_getheapsnapshot
// Created in Node 11.x, but starts working the way we need from Node 14.
if (semver.gte(process.versions.node, '14.0.0')) {
QUnit.test('memory-leak/module-closure [unfiltered]', async assert => {
const command = ['node', '--expose-gc', '../../../bin/qunit.js', 'memory-leak/module-closure.js'];
const execution = await execute(command);
assert.equal(execution.snapshot, `TAP version 13
});

// TODO: Move to /test/cli/fixtures/
QUnit.test('memory-leak/module-closure [unfiltered]', async assert => {
const command = ['node', '--expose-gc', '../../../bin/qunit.js', 'memory-leak/module-closure.js'];
const execution = await execute(command);
assert.equal(execution.snapshot, `TAP version 13
ok 1 module-closure > example test
ok 2 module-closure > example child module > example child module test
ok 3 module-closure check > memory release
Expand All @@ -314,33 +303,32 @@ ok 3 module-closure check > memory release
# skip 0
# todo 0
# fail 0`);
});
});

QUnit.test('memory-leak/module-closure [filtered module]', async assert => {
const command = ['node', '--expose-gc', '../../../bin/qunit.js', '--filter', '!child', 'memory-leak/module-closure.js'];
const execution = await execute(command);
assert.equal(execution.snapshot, `TAP version 13
QUnit.test('memory-leak/module-closure [filtered module]', async assert => {
const command = ['node', '--expose-gc', '../../../bin/qunit.js', '--filter', '!child', 'memory-leak/module-closure.js'];
const execution = await execute(command);
assert.equal(execution.snapshot, `TAP version 13
ok 1 module-closure > example test
ok 2 module-closure check > memory release
1..2
# pass 2
# skip 0
# todo 0
# fail 0`);
});
});

QUnit.test('memory-leak/test-object', async assert => {
const command = ['node', '--expose-gc', '../../../bin/qunit.js', 'memory-leak/test-object.js'];
const execution = await execute(command);
assert.equal(execution.snapshot, `TAP version 13
QUnit.test('memory-leak/test-object', async assert => {
const command = ['node', '--expose-gc', '../../../bin/qunit.js', 'memory-leak/test-object.js'];
const execution = await execute(command);
assert.equal(execution.snapshot, `TAP version 13
ok 1 test-object > example test
1..1
# pass 1
# skip 0
# todo 0
# fail 0`);
});
}
});

// TODO: Workaround fact that child_process.spawn() args array is a lie on Windows.
// https://github.com/nodejs/node/issues/29532
Expand Down

0 comments on commit c43ff7f

Please sign in to comment.