Skip to content

Commit

Permalink
Target Node.js 12.20, 14.15 and 15
Browse files Browse the repository at this point in the history
  • Loading branch information
novemberborn committed Feb 7, 2021
1 parent b6a3cb7 commit 5dd22c9
Show file tree
Hide file tree
Showing 35 changed files with 29 additions and 1,858 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [^10.18.0, ^12.14.0, ^14.0.0, ^15.0.0]
node-version: [^12.20, ^14.15, ^15]
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:
fetch-depth: 1
- uses: actions/setup-node@v2
with:
node-version: ^12
node-version: ^12.20
- run: npm ci --no-audit
- run: npm i typescript@${TS_VERSION}
env:
Expand All @@ -65,7 +65,7 @@ jobs:
fetch-depth: 1
- uses: actions/setup-node@v2
with:
node-version: ^12.14.0
node-version: ^12.20
- name: Upgrade npm
run: if [[ "$(npm -v)" != "6.14.10" ]]; then npm install --global npm@6.14.10; fi
- run: npm ci --no-audit
Expand All @@ -88,7 +88,7 @@ jobs:
fetch-depth: 1
- uses: actions/setup-node@v2
with:
node-version: ^12.14.0
node-version: ^12.20
- run: npm install --no-shrinkwrap --no-audit
- run: npm run cover

Expand All @@ -101,6 +101,6 @@ jobs:
fetch-depth: 1
- uses: actions/setup-node@v2
with:
node-version: ^10.18.0
node-version: ^12.20
- run: npm ci
- run: npx xo
11 changes: 1 addition & 10 deletions ava.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
const skipTests = [];
if (process.versions.node < '12.17.0') {
skipTests.push(
'!test/config/next-gen.js',
'!test/configurable-module-format/module.js',
'!test/shared-workers/!(requires-newish-node)/**'
);
}

export default {
files: ['test/**', '!test/**/{fixtures,helpers}/**', ...skipTests],
files: ['test/**', '!test/**/{fixtures,helpers}/**'],
ignoredByWatcher: ['{coverage,docs,media,test-d,test-tap}/**']
};
1 change: 1 addition & 0 deletions eslint-plugin-helper.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'use strict';
// TODO: Clean up.
let isMainThread = true;
let supportsWorkers = false;
try {
Expand Down
13 changes: 3 additions & 10 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,16 +428,9 @@ exports.run = async () => { // eslint-disable-line complexity
const {controlFlow} = require('./ipc-flow-control');
const bufferedSend = controlFlow(process);

if (process.versions.node >= '12.16.0') {
plan.status.on('stateChange', evt => {
bufferedSend(evt);
});
} else {
const v8 = require('v8');
plan.status.on('stateChange', evt => {
bufferedSend([...v8.serialize(evt)]);
});
}
plan.status.on('stateChange', evt => {
bufferedSend(evt);
});
}

plan.status.on('stateChange', evt => {
Expand Down
7 changes: 2 additions & 5 deletions lib/plugin-support/shared-workers.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
const events = require('events');
const serializeError = require('../serialize-error');
const {Worker} = require('worker_threads');

let Worker;
try {
({Worker} = require('worker_threads'));
} catch {}
const serializeError = require('../serialize-error');

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

Expand Down
6 changes: 0 additions & 6 deletions lib/worker/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ function createSharedWorker(filename, initialData, teardown) {
};
}

const supportsSharedWorkers = process.versions.node >= '12.17.0';

function registerSharedWorker({
filename,
initialData,
Expand All @@ -84,10 +82,6 @@ function registerSharedWorker({
throw new Error('Shared workers are experimental. Opt in to them in your AVA configuration');
}

if (!supportsSharedWorkers) {
throw new Error('Shared workers require Node.js 12.17 or newer');
}

if (!supportedProtocols.includes('experimental')) {
throw new Error(`This version of AVA (${pkg.version}) does not support any of the desired shared worker protocols: ${supportedProtocols.join()}`);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"homepage": "https://avajs.dev",
"bin": "cli.js",
"engines": {
"node": ">=10.18.0 <11 || >=12.14.0 <12.17.0 || >=12.17.0 <13 || >=14.0.0 <15 || >=15"
"node": ">=12.20 <13 || >=14.15 <15 || >=15"
},
"scripts": {
"cover": "c8 --report=none tap && c8 --report=none --no-clean test-ava && c8 report",
Expand Down
28 changes: 8 additions & 20 deletions test-tap/integration/assorted.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,30 +164,18 @@ test('selects .cjs test files', t => {
});
});

test('load .mjs test files (when node supports it)', t => {
test('load .mjs test files', t => {
execCli('mjs.mjs', (err, stdout) => {
if (Number.parseFloat(process.version.slice(1)) >= 12.17) {
t.ifError(err);
t.match(stdout, /1 test passed/);
t.end();
} else {
t.ok(err);
t.match(stdout, /ECMAScript Modules are not supported in this Node.js version./);
t.end();
}
t.ifError(err);
t.match(stdout, /1 test passed/);
t.end();
});
});

test('load .js test files as ESM modules (when node supports it)', t => {
test('load .js test files as ESM modules', t => {
execCli('test.js', {dirname: 'fixture/pkg-type-module'}, (err, stdout) => {
if (Number.parseFloat(process.version.slice(1)) >= 12.17) {
t.ifError(err);
t.match(stdout, /1 test passed/);
t.end();
} else {
t.ok(err);
t.match(stdout, /ECMAScript Modules are not supported in this Node.js version./);
t.end();
}
t.ifError(err);
t.match(stdout, /1 test passed/);
t.end();
});
});
54 changes: 0 additions & 54 deletions test-tap/reporters/mini.edgecases.v10.log

This file was deleted.

26 changes: 0 additions & 26 deletions test-tap/reporters/mini.failfast.v10.log

This file was deleted.

26 changes: 0 additions & 26 deletions test-tap/reporters/mini.failfast2.v10.log

This file was deleted.

5 changes: 0 additions & 5 deletions test-tap/reporters/mini.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
'use strict';
require('../helper/fix-reporter-env')();

// Excessive writes occur in Node.js 11. These don't have a visual impact but prevent the integration tests from passing.
if (process.version.startsWith('v11')) {
process.exit(0); // eslint-disable-line unicorn/no-process-exit
}

const path = require('path');
const {test} = require('tap');
const TTYStream = require('../helper/tty-stream');
Expand Down
15 changes: 0 additions & 15 deletions test-tap/reporters/mini.only.v10.log

This file was deleted.

Loading

0 comments on commit 5dd22c9

Please sign in to comment.