Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,26 @@ const FastBoot = require('fastboot');
const bodyParser = require('body-parser');
const { deprecate } = require('util');

// Polyfill Promise.withResolvers for Node.js < 22 (e.g. Node 20 LTS).
// While nock v15 claims to support Node >= 20.12.1, its subdependency
// @mswjs/interceptors (>= 0.44.0) requires Node >= 22 and uses Promise.withResolvers(),
// which was added in Node 22 and not backported to Node 20.
if (typeof Promise.withResolvers === 'undefined') {
Promise.withResolvers = function () {
let resolve, reject;
const promise = new Promise((res, rej) => {
resolve = res;
reject = rej;
});
return { promise, resolve, reject };
};
}

let _nock;
function getNock() {
if (!_nock) {
_nock = require('nock');
let nock = require('nock');
_nock = nock.default || nock;
}
return _nock;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"fastboot": "^3.0.3 || ^4.1.5 || ^5.0.0 || ^6.0.0",
"json-fn": "^1.1.1",
"minimist": "^1.2.6",
"nock": "^14.0.17",
"nock": "^14 || ^15",
"resolve": "^1.22.12",
"whatwg-fetch": "^3.6.20"
},
Expand Down
83 changes: 39 additions & 44 deletions pnpm-lock.yaml

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

6 changes: 4 additions & 2 deletions tests/dummy/config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ module.exports = async function () {
// ember-cli-fastboot v3 incorrectly passed args to json-stable-stringify
// which results in TypeError in latest versions of json-stable-stringify,
// hence pinning.
resolutions: {
'json-stable-stringify': '1.0.2',
pnpm: {
overrides: {
'json-stable-stringify': '1.0.2',
},
},
},
},
Expand Down
Loading