From c43ff7f65d6591daab78aa4c336e1cfeb74e931b Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Wed, 25 Oct 2023 15:52:22 -0400 Subject: [PATCH] Build: Require Node.js 18 or later Remove old Node version CI jobs. `semver` package is now unused. Fixes https://github.com/qunitjs/qunit/issues/1727. Closes https://github.com/qunitjs/qunit/pull/1731. --- .github/workflows/CI.yaml | 43 +++++------- .github/workflows/browsers-full.yaml | 4 +- .github/workflows/browsers-quick.yaml | 4 +- .github/workflows/coverage.yaml | 4 +- .github/workflows/reproducible.yaml | 4 +- package-lock.json | 5 +- package.json | 5 +- test/cli/cli-main.js | 96 ++++++++++++--------------- 8 files changed, 69 insertions(+), 96 deletions(-) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 5ac6eb377..9d3397f67 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -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 }} diff --git a/.github/workflows/browsers-full.yaml b/.github/workflows/browsers-full.yaml index dbb92db07..08a0fd4b3 100644 --- a/.github/workflows/browsers-full.yaml +++ b/.github/workflows/browsers-full.yaml @@ -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: | diff --git a/.github/workflows/browsers-quick.yaml b/.github/workflows/browsers-quick.yaml index 12b785328..a86649076 100644 --- a/.github/workflows/browsers-quick.yaml +++ b/.github/workflows/browsers-quick.yaml @@ -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: | diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index 5e160a03c..99b5ed8a8 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -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 diff --git a/.github/workflows/reproducible.yaml b/.github/workflows/reproducible.yaml index ad46e6407..8ac61a667 100644 --- a/.github/workflows/reproducible.yaml +++ b/.github/workflows/reproducible.yaml @@ -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 diff --git a/package-lock.json b/package-lock.json index 3778598a2..b41331fbe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -50,11 +50,10 @@ "proxyquire": "^1.8.0", "requirejs": "^2.3.6", "rimraf": "^3.0.2", - "rollup": "^2.79.1", - "semver": "^7.6.2" + "rollup": "^2.79.1" }, "engines": { - "node": ">=10" + "node": ">=18" } }, "node_modules/@ampproject/remapping": { diff --git a/package.json b/package.json index 21cbae73f..7689b2ee1 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ ], "main": "qunit/qunit.js", "engines": { - "node": ">=10" + "node": ">=18" }, "dependencies": { "commander": "7.2.0", @@ -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", diff --git a/test/cli/cli-main.js b/test/cli/cli-main.js index 4e919002f..d83c5496e 100644 --- a/test/cli/cli-main.js +++ b/test/cli/cli-main.js @@ -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'); @@ -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 --- @@ -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 --- @@ -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 @@ -314,12 +303,12 @@ 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 @@ -327,20 +316,19 @@ ok 2 module-closure check > memory release # 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