Skip to content

Commit 5dd22c9

Browse files
committed
Target Node.js 12.20, 14.15 and 15
1 parent b6a3cb7 commit 5dd22c9

35 files changed

+29
-1858
lines changed

.github/workflows/ci.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
node-version: [^10.18.0, ^12.14.0, ^14.0.0, ^15.0.0]
18+
node-version: [^12.20, ^14.15, ^15]
1919
os: [ubuntu-latest, windows-latest]
2020
steps:
2121
- uses: actions/checkout@v2
@@ -48,7 +48,7 @@ jobs:
4848
fetch-depth: 1
4949
- uses: actions/setup-node@v2
5050
with:
51-
node-version: ^12
51+
node-version: ^12.20
5252
- run: npm ci --no-audit
5353
- run: npm i typescript@${TS_VERSION}
5454
env:
@@ -65,7 +65,7 @@ jobs:
6565
fetch-depth: 1
6666
- uses: actions/setup-node@v2
6767
with:
68-
node-version: ^12.14.0
68+
node-version: ^12.20
6969
- name: Upgrade npm
7070
run: if [[ "$(npm -v)" != "6.14.10" ]]; then npm install --global npm@6.14.10; fi
7171
- run: npm ci --no-audit
@@ -88,7 +88,7 @@ jobs:
8888
fetch-depth: 1
8989
- uses: actions/setup-node@v2
9090
with:
91-
node-version: ^12.14.0
91+
node-version: ^12.20
9292
- run: npm install --no-shrinkwrap --no-audit
9393
- run: npm run cover
9494

@@ -101,6 +101,6 @@ jobs:
101101
fetch-depth: 1
102102
- uses: actions/setup-node@v2
103103
with:
104-
node-version: ^10.18.0
104+
node-version: ^12.20
105105
- run: npm ci
106106
- run: npx xo

ava.config.js

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
1-
const skipTests = [];
2-
if (process.versions.node < '12.17.0') {
3-
skipTests.push(
4-
'!test/config/next-gen.js',
5-
'!test/configurable-module-format/module.js',
6-
'!test/shared-workers/!(requires-newish-node)/**'
7-
);
8-
}
9-
101
export default {
11-
files: ['test/**', '!test/**/{fixtures,helpers}/**', ...skipTests],
2+
files: ['test/**', '!test/**/{fixtures,helpers}/**'],
123
ignoredByWatcher: ['{coverage,docs,media,test-d,test-tap}/**']
134
};

eslint-plugin-helper.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
'use strict';
2+
// TODO: Clean up.
23
let isMainThread = true;
34
let supportsWorkers = false;
45
try {

lib/cli.js

+3-10
Original file line numberDiff line numberDiff line change
@@ -428,16 +428,9 @@ exports.run = async () => { // eslint-disable-line complexity
428428
const {controlFlow} = require('./ipc-flow-control');
429429
const bufferedSend = controlFlow(process);
430430

431-
if (process.versions.node >= '12.16.0') {
432-
plan.status.on('stateChange', evt => {
433-
bufferedSend(evt);
434-
});
435-
} else {
436-
const v8 = require('v8');
437-
plan.status.on('stateChange', evt => {
438-
bufferedSend([...v8.serialize(evt)]);
439-
});
440-
}
431+
plan.status.on('stateChange', evt => {
432+
bufferedSend(evt);
433+
});
441434
}
442435

443436
plan.status.on('stateChange', evt => {

lib/plugin-support/shared-workers.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
const events = require('events');
2-
const serializeError = require('../serialize-error');
2+
const {Worker} = require('worker_threads');
33

4-
let Worker;
5-
try {
6-
({Worker} = require('worker_threads'));
7-
} catch {}
4+
const serializeError = require('../serialize-error');
85

96
const LOADER = require.resolve('./shared-worker-loader');
107

lib/worker/plugin.js

-6
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ function createSharedWorker(filename, initialData, teardown) {
7272
};
7373
}
7474

75-
const supportsSharedWorkers = process.versions.node >= '12.17.0';
76-
7775
function registerSharedWorker({
7876
filename,
7977
initialData,
@@ -84,10 +82,6 @@ function registerSharedWorker({
8482
throw new Error('Shared workers are experimental. Opt in to them in your AVA configuration');
8583
}
8684

87-
if (!supportsSharedWorkers) {
88-
throw new Error('Shared workers require Node.js 12.17 or newer');
89-
}
90-
9185
if (!supportedProtocols.includes('experimental')) {
9286
throw new Error(`This version of AVA (${pkg.version}) does not support any of the desired shared worker protocols: ${supportedProtocols.join()}`);
9387
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"homepage": "https://avajs.dev",
88
"bin": "cli.js",
99
"engines": {
10-
"node": ">=10.18.0 <11 || >=12.14.0 <12.17.0 || >=12.17.0 <13 || >=14.0.0 <15 || >=15"
10+
"node": ">=12.20 <13 || >=14.15 <15 || >=15"
1111
},
1212
"scripts": {
1313
"cover": "c8 --report=none tap && c8 --report=none --no-clean test-ava && c8 report",

test-tap/integration/assorted.js

+8-20
Original file line numberDiff line numberDiff line change
@@ -164,30 +164,18 @@ test('selects .cjs test files', t => {
164164
});
165165
});
166166

167-
test('load .mjs test files (when node supports it)', t => {
167+
test('load .mjs test files', t => {
168168
execCli('mjs.mjs', (err, stdout) => {
169-
if (Number.parseFloat(process.version.slice(1)) >= 12.17) {
170-
t.ifError(err);
171-
t.match(stdout, /1 test passed/);
172-
t.end();
173-
} else {
174-
t.ok(err);
175-
t.match(stdout, /ECMAScript Modules are not supported in this Node.js version./);
176-
t.end();
177-
}
169+
t.ifError(err);
170+
t.match(stdout, /1 test passed/);
171+
t.end();
178172
});
179173
});
180174

181-
test('load .js test files as ESM modules (when node supports it)', t => {
175+
test('load .js test files as ESM modules', t => {
182176
execCli('test.js', {dirname: 'fixture/pkg-type-module'}, (err, stdout) => {
183-
if (Number.parseFloat(process.version.slice(1)) >= 12.17) {
184-
t.ifError(err);
185-
t.match(stdout, /1 test passed/);
186-
t.end();
187-
} else {
188-
t.ok(err);
189-
t.match(stdout, /ECMAScript Modules are not supported in this Node.js version./);
190-
t.end();
191-
}
177+
t.ifError(err);
178+
t.match(stdout, /1 test passed/);
179+
t.end();
192180
});
193181
});

test-tap/reporters/mini.edgecases.v10.log

-54
This file was deleted.

test-tap/reporters/mini.failfast.v10.log

-26
This file was deleted.

test-tap/reporters/mini.failfast2.v10.log

-26
This file was deleted.

test-tap/reporters/mini.js

-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
'use strict';
22
require('../helper/fix-reporter-env')();
33

4-
// Excessive writes occur in Node.js 11. These don't have a visual impact but prevent the integration tests from passing.
5-
if (process.version.startsWith('v11')) {
6-
process.exit(0); // eslint-disable-line unicorn/no-process-exit
7-
}
8-
94
const path = require('path');
105
const {test} = require('tap');
116
const TTYStream = require('../helper/tty-stream');

test-tap/reporters/mini.only.v10.log

-15
This file was deleted.

0 commit comments

Comments
 (0)