Skip to content

Commit

Permalink
chore: Update CI config to include nodejs v20
Browse files Browse the repository at this point in the history
  • Loading branch information
rpl committed Jan 12, 2024
1 parent 1496420 commit f14415e
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 30 deletions.
8 changes: 5 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ references:
# set of nodejs versions that should be tested.
# The nodejs version set as `nodejs_current` is the one used to
# release the package on npm.
#
# See https://nodejs.org/en/about/previous-releases for updates to nodejs versions.
nodejs_versions:
# nvm-windows wants a full Node version, not just `<major>.<minor>`.
- &nodejs_current "16.14.2"
- &nodejs_next "18.15"
- &nodejs_experimental "19.3"
- &nodejs_current "18.19.0"
- &nodejs_next "20.11.0"
- &nodejs_experimental "21.5"

nodejs_enum: &nodejs_enum
type: enum
Expand Down
39 changes: 19 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
"prettyjson": "1.2.5",
"shelljs": "0.8.5",
"sinon": "17.0.1",
"testdouble": "3.16.8",
"testdouble": "3.20.1",
"yauzl": "2.10.0"
},
"author": "Kumar McMillan",
Expand Down
9 changes: 4 additions & 5 deletions scripts/lib/mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,16 @@ const runMocha = (args, execMochaOptions = {}, coverageEnabled) => {
shell.echo(`\nSetting mocha timeout from env var: ${MOCHA_TIMEOUT}\n`);
}

// Pass custom babel-loader node loader to transpile on the fly
// the tests modules.
binArgs.push('-n="loader=./tests/babel-loader.js"');
// Pass testdouble node loader to support ESM module mocking and
// transpiling on the fly the tests modules.
binArgs.push('-n="loader=testdouble"');

const res = spawnSync(binPath, binArgs, {
...execMochaOptions,
env: {
...process.env,
// Make sure NODE_ENV is set to test (which also enable babel
// install plugin for all modules transpiled on the fly by the
// tests/babel-loader.js).
// install plugin for all modules transpiled on the fly).
NODE_ENV: 'test',
},
stdio: 'inherit',
Expand Down
9 changes: 8 additions & 1 deletion tests/unit/test-util/test.submit-addon.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,15 @@ class JSONResponse extends Response {
}

const mockNodeFetch = (nodeFetchStub, url, method, responses) => {
// Trust us... You don't want to know why... but if you really do like nightmares
// take a look to the details and links kindly provided in this comment
// that helped investigating this:
// https://github.com/mozilla/web-ext/issues/2917#issuecomment-1766000545
const urlMatch = url instanceof URL ? url.href : url;
const stubMatcher = nodeFetchStub.withArgs(
url instanceof URL ? url : new URL(url),
sinon.match((urlArg) =>
urlMatch === (urlArg instanceof URL ? urlArg.href : urlArg)
),
sinon.match.has('method', method),
);
for (let i = 0; i < responses.length; i++) {
Expand Down

0 comments on commit f14415e

Please sign in to comment.