From 33777fa763cb801001a032ef1db38aa6bdef08f4 Mon Sep 17 00:00:00 2001 From: Adam Shaw Date: Sun, 28 Jan 2024 21:12:48 -0500 Subject: [PATCH] improved test running --- ...at-norm.txt => expected-failures-node-gte18.txt} | 1 - ...e-node16.txt => expected-failures-node-lt16.txt} | 0 ...e-node18.txt => expected-failures-node-lt18.txt} | 2 ++ packages/temporal-polyfill/scripts/test.js | 13 ++++++++----- 4 files changed, 10 insertions(+), 6 deletions(-) rename packages/temporal-polyfill/scripts/test-config/{expected-failures-intl-format-norm.txt => expected-failures-node-gte18.txt} (99%) rename packages/temporal-polyfill/scripts/test-config/{expected-failures-before-node16.txt => expected-failures-node-lt16.txt} (100%) rename packages/temporal-polyfill/scripts/test-config/{expected-failures-before-node18.txt => expected-failures-node-lt18.txt} (88%) diff --git a/packages/temporal-polyfill/scripts/test-config/expected-failures-intl-format-norm.txt b/packages/temporal-polyfill/scripts/test-config/expected-failures-node-gte18.txt similarity index 99% rename from packages/temporal-polyfill/scripts/test-config/expected-failures-intl-format-norm.txt rename to packages/temporal-polyfill/scripts/test-config/expected-failures-node-gte18.txt index 5f9d0c58..95635b29 100644 --- a/packages/temporal-polyfill/scripts/test-config/expected-failures-intl-format-norm.txt +++ b/packages/temporal-polyfill/scripts/test-config/expected-failures-node-gte18.txt @@ -1,4 +1,3 @@ - # Really picky about whitespace between characters # Nothing we can do about this since it relies on Intl.DateTimeFormat staging/Intl402/Temporal/old/date-time-format.js diff --git a/packages/temporal-polyfill/scripts/test-config/expected-failures-before-node16.txt b/packages/temporal-polyfill/scripts/test-config/expected-failures-node-lt16.txt similarity index 100% rename from packages/temporal-polyfill/scripts/test-config/expected-failures-before-node16.txt rename to packages/temporal-polyfill/scripts/test-config/expected-failures-node-lt16.txt diff --git a/packages/temporal-polyfill/scripts/test-config/expected-failures-before-node18.txt b/packages/temporal-polyfill/scripts/test-config/expected-failures-node-lt18.txt similarity index 88% rename from packages/temporal-polyfill/scripts/test-config/expected-failures-before-node18.txt rename to packages/temporal-polyfill/scripts/test-config/expected-failures-node-lt18.txt index 23978368..1b790140 100644 --- a/packages/temporal-polyfill/scripts/test-config/expected-failures-before-node18.txt +++ b/packages/temporal-polyfill/scripts/test-config/expected-failures-node-lt18.txt @@ -5,6 +5,8 @@ intl402/DateTimeFormat/constructor-options-timeZoneName-valid.js intl402/Temporal/TimeZone/supported-values-of.js intl402/Temporal/TimeZone/prototype/equals/canonical-not-equal.js intl402/Temporal/TimeZone/prototype/equals/timezone-case-insensitive.js +intl402/Temporal/TimeZone/from/timezone-case-insensitive.js +intl402/Temporal/ZonedDateTime/from/timezone-case-insensitive.js intl402/Temporal/TimeZone/prototype/getNextTransition/transition-at-instant-boundaries.js intl402/Temporal/TimeZone/prototype/getPreviousTransition/transition-at-instant-boundaries.js diff --git a/packages/temporal-polyfill/scripts/test.js b/packages/temporal-polyfill/scripts/test.js index 0388ee8d..245baca9 100755 --- a/packages/temporal-polyfill/scripts/test.js +++ b/packages/temporal-polyfill/scripts/test.js @@ -55,6 +55,7 @@ yargs(hideBin(process.argv)) const currentNodeVersion = process.versions.node const currentNodeMajorVersion = parseInt(currentNodeVersion.split('.')[0]) + // If different version of Node requested, spawn a new process if ( options.nodeVersion && options.nodeVersion !== currentNodeVersion && @@ -66,8 +67,7 @@ yargs(hideBin(process.argv)) cwd: process.cwd(), env: { ...filterEnv(process.env), - // will force PNPM to use a specific version (see .npmrc) - NODE_VERSION: options.nodeVersion, + NODE_VERSION: options.nodeVersion, // forces PNPM to use specific version (see .npmrc) } }) } @@ -78,17 +78,18 @@ yargs(hideBin(process.argv)) ] if (currentNodeMajorVersion >= 18) { - expectedFailureFiles.push('expected-failures-intl-format-norm.txt') + expectedFailureFiles.push('expected-failures-node-gte18.txt') } if (currentNodeMajorVersion < 18) { - expectedFailureFiles.push('expected-failures-before-node18.txt') + expectedFailureFiles.push('expected-failures-node-lt18.txt') } if (currentNodeMajorVersion < 16) { - expectedFailureFiles.push('expected-failures-before-node16.txt') + expectedFailureFiles.push('expected-failures-node-lt16.txt') } let { esm, min } = options + // Let CI decide. Try all permutations based on Node LTS version if (process.env.CI) { esm = esm || Boolean(Math.floor(currentNodeMajorVersion / 4) % 2) min = min || Boolean(Math.floor(currentNodeMajorVersion / 2) % 2) @@ -142,6 +143,8 @@ function liveExec(cmdParts, options = {}) { }) } +// Filter away Node-related environment variables because prevents +// PNPM's use-node-version from being reset function filterEnv(oldEnv) { const newEnv = {}