Skip to content

Commit

Permalink
Run CI tests with Node 19
Browse files Browse the repository at this point in the history
* Update Test262 to latest Node19-compatible tests
* Update GH actions to latest versions
* Test262 against Node 14, 16, 18, and 19
* Use Node19 on all other actions and tests
* Extend expected-failures.txt handling so some tests can be expected
  to fail only on some Node versions.
  • Loading branch information
justingrant committed Dec 19, 2022
1 parent 4211309 commit 3366a88
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 42 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
- name: use node.js v15.x
uses: actions/setup-node@v1
with:
node-version: 15.x
- run: npm ci
- run: npm run build
- uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: out
CLEAN: true
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: use node.js v19.x
uses: actions/setup-node@v3
with:
node-version: 19.x
- run: npm ci
- run: npm run build
- uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: out
CLEAN: true
16 changes: 8 additions & 8 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: use node.js v15.x
uses: actions/setup-node@v1
with:
node-version: 15.x
- run: npm ci
- run: npm run lint
- run: npm run build:spec
- uses: actions/checkout@v2
- name: use node.js v19.x
uses: actions/setup-node@v1
with:
node-version: 19.x
- run: npm ci
- run: npm run lint
- run: npm run build:spec
74 changes: 58 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,92 @@ on:
branches:
- main
jobs:
test-polyfill:
test-demitasse:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: use node.js v18.x
uses: actions/setup-node@v1
- uses: actions/checkout@v3
- name: use node.js v19.x
uses: actions/setup-node@v3
with:
node-version: 18.x
node-version: 19.x
- run: npm ci
- run: npm run test-demitasse
env:
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
test-test262:
test-test262-node19:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: use node.js v19.x
uses: actions/setup-node@v3
with:
node-version: 19.x
- run: npm ci
- run: npm run codecov:test262
env:
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
test-test262-node18:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: use node.js v18.x
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: 18.x
- run: npm ci
- run: npm run codecov:test262
env:
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
test-test262-node16:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: use node.js v16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
- run: npm ci
- run: npm run codecov:test262
env:
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
test-test262-node14:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: use node.js v14.x
uses: actions/setup-node@v3
with:
node-version: 14.x
- run: npm ci
- run: npm run codecov:test262
env:
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
test-cookbook:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: use node.js v18.x
uses: actions/setup-node@v1
- uses: actions/checkout@v3
- name: use node.js v19.x
uses: actions/setup-node@v3
with:
node-version: 18.x
node-version: 19.x
- run: npm ci
- run: npm run test-cookbook
test-validstrings:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: use node.js v18.x
uses: actions/setup-node@v1
- uses: actions/checkout@v3
- name: use node.js v19.x
uses: actions/setup-node@v3
with:
node-version: 18.x
node-version: 19.x
- run: npm ci
- run: |
cd polyfill
Expand Down
17 changes: 15 additions & 2 deletions polyfill/runtest262.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,25 @@ const polyfillCode = fs.readFileSync('script.js', UTF8);
const polyfill = new vm.Script(polyfillCode, { filename: path.resolve('script.js') });

// Read the expected failures file and put the paths into a Set
// If a Node version is provided in a line, that's the minimum major version
// where the test is expected to pass. If the current Node version is equal to
// or greater, then it's not an expected failure here.

const nodeVersion = parseInt(process.versions.node.split('.')[0]);
const expectedFailures = new Set(
fs
.readFileSync('test/expected-failures.txt', UTF8)
.split(/\r?\n/g)
.filter((line) => line && line[0] !== '#')
.filter((line) => {
if (!line) return false;
if (line[0] === '#') return false;

// Is it expected to fail in this Node version?
const [, minNodeVersion] = line.split(' ');
if (minNodeVersion && nodeVersion >= parseInt(minNodeVersion)) return false;
return true;
})
.map((line) => line.split(' ')[0])
);

// This function reads in a test262 harness helper file, specified in 'includes'
Expand Down Expand Up @@ -268,7 +281,7 @@ print(`\n${total} tests finished in ${color.bold(elapsed.toFixed(1))} s`);
print(color.green(` ${passCount} passed`));
print(color.red(` ${failures.length} failed`));
if (expectedFailCount > 0) {
print(color.cyan(` ${expectedFailCount} expected failures`));
print(color.cyan(` ${expectedFailCount} expected failure${expectedFailCount === 1 ? '' : 's'}`));
}

process.exit(failures.length > 0 ? 1 : 0);
18 changes: 18 additions & 0 deletions polyfill/test/expected-failures.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
# expected failures unrelated to Node versions
intl402/Temporal/TimeZone/prototype/getNextTransition/transition-at-instant-boundaries.js
intl402/Temporal/TimeZone/prototype/getPreviousTransition/transition-at-instant-boundaries.js

# Intl.supportedValuesOf("timeZone") is only available starting in Node 18
intl402/Temporal/TimeZone/supported-values-of.js 18

# Before Node 16, dateStyle/timeStyle options didn't conflict with other options
intl402/Temporal/Instant/prototype/toLocaleString/options-conflict.js 16
intl402/Temporal/PlainDate/prototype/toLocaleString/options-conflict.js 16
intl402/Temporal/PlainDateTime/prototype/toLocaleString/options-conflict.js 16
intl402/Temporal/PlainTime/prototype/toLocaleString/options-conflict.js 16
intl402/Temporal/ZonedDateTime/prototype/toLocaleString/options-conflict.js 16

# Before Node 16, calling an uncallable value seems to throw a RangeError, not a TypeError
intl402/Temporal/PlainYearMonth/prototype/toLocaleString/timezone-getoffsetnanosecondsfor-not-callable.js 16
intl402/Temporal/PlainMonthDay/prototype/toLocaleString/timezone-getoffsetnanosecondsfor-not-callable.js 16
intl402/Temporal/PlainDate/prototype/toLocaleString/timezone-getoffsetnanosecondsfor-not-callable.js 16
intl402/Temporal/PlainDateTime/prototype/toLocaleString/timezone-getoffsetnanosecondsfor-not-callable.js 16
intl402/Temporal/PlainTime/prototype/toLocaleString/timezone-getoffsetnanosecondsfor-not-callable.js 16
2 changes: 1 addition & 1 deletion polyfill/test262
Submodule test262 updated 24 files
+3 −2 CONTRIBUTING.md
+5 −0 harness/isConstructor.js
+36 −0 test/built-ins/Array/fromAsync/builtin.js
+26 −0 test/built-ins/Array/fromAsync/length.js
+26 −0 test/built-ins/Array/fromAsync/name.js
+17 −0 test/built-ins/Array/fromAsync/not-a-constructor.js
+21 −0 test/built-ins/Array/fromAsync/prop-desc.js
+63 −0 test/built-ins/Array/prototype/toLocaleString/invoke-element-tolocalestring.js
+7 −4 test/built-ins/Promise/prototype/finally/rejected-observable-then-calls-argument.js
+10 −10 test/harness/isConstructor.js
+61 −0 test/intl402/Array/prototype/toLocaleString/invoke-element-tolocalestring.js
+1 −1 test/intl402/DurationFormat/prototype/format/invalid-arguments-throws.js
+1 −1 test/intl402/DurationFormat/prototype/formatToParts/invalid-arguments-throws.js
+1 −1 test/intl402/NumberFormat/constructor-roundingIncrement.js
+17 −4 test/intl402/Temporal/PlainDateTime/prototype/toLocaleString/resolved-time-zone.js
+14 −4 test/intl402/Temporal/PlainTime/prototype/toLocaleString/resolved-time-zone.js
+355 −258 test/staging/Intl402/Temporal/old/date-time-format.js
+6 −6 test/staging/Intl402/Temporal/old/date-toLocaleString.js
+26 −9 test/staging/Intl402/Temporal/old/datetime-toLocaleString.js
+18 −8 test/staging/Intl402/Temporal/old/instant-toLocaleString.js
+10 −10 test/staging/Intl402/Temporal/old/monthday-toLocaleString.js
+15 −7 test/staging/Intl402/Temporal/old/time-toLocaleString.js
+23 −13 test/staging/Intl402/Temporal/old/yearmonth-toLocaleString.js
+30 −12 test/staging/Intl402/Temporal/old/zoneddatetime-toLocaleString.js

0 comments on commit 3366a88

Please sign in to comment.