From cd9776804698a0578607985f03320fb36949481f Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Tue, 10 Sep 2024 15:12:06 -0400 Subject: [PATCH] Get things working on Node 22 - Specify the tests on the command line (Node 22 needs this) - Test Node 22 in GitHub actions build matrix - Remove option `--experimental-json-modules` I don't think we are importing json files anywhere anymore? And I think it's been unflagged since Node 16 - Add option `--no-experimental-global-navigator` Our tests mock `Navigator`, and this will be an issue eventually Node 22 introduces it as an experimental global - let's not deal with it now --- .github/workflows/build.yml | 2 +- .npmrc | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ecc17f6eef..0669cee9e6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [18, 20] + node-version: ['18', '20', '22'] steps: - uses: actions/checkout@v4 diff --git a/.npmrc b/.npmrc index dfa3201422..ec57b5f760 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1 @@ -node-options="--no-warnings --experimental-json-modules" \ No newline at end of file +node-options="--no-warnings --no-experimental-global-navigator" diff --git a/package.json b/package.json index 60aa4dbfd0..11ec73a39a 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "test": "npm-run-all -s lint build test:unit test:browser", "test:benchmark": "npm run test:unzip-benchmark-data && npx playwright test --workers=1 --config=test/benchmark/playwright.config.mjs && npm run test:cleanup-benchmark-data", "test:browser": "karma start karma.conf.cjs", - "test:unit": "c8 node --test-reporter spec --test test/unit", + "test:unit": "c8 node --test-reporter spec --test test/unit/**/*.test.js", "test:unzip-benchmark-data": "tar -xvf test/benchmark/tokyo_canned_data.zip -C test/benchmark", "test:cleanup-benchmark-data": "rm test/benchmark/tokyo_*_canned_osm_data.js", "translations": "node scripts/update_translations.js"