-
-
Notifications
You must be signed in to change notification settings - Fork 745
Closed
Labels
Description
Please avoid duplicates
- I checked all open bugs and none of them matched my problem.
Reproducible test case
Code snipped added to "What happened?"
Nock Version
v13.3.2
Node Version
18.15.0
TypeScript Version
No response
What happened?
Hi dear nock-team,
with commit
8aab603
a new breaking change/behaviour has been introduced which crashes our tests of several projects.
It is reordering the interceptors which leads to a different sequence handling.
'use strict';
// Console with nock 13.3.2 (incorrect)
// special file
// all others
// all others
//
// Console with nock 13.3.1 (correct)
// special file
// special file
// all others
const https = require('https');
const nock = require('nock');
nock.back.setMode('lockdown');
const get = uri => {
return new Promise(resolve => {
https.get(uri, res => {
const data = [];
res.on('data', chunk => data.push(chunk));
res.on('end', () => resolve(Buffer.concat(data).toString()));
});
});
};
(async() => {
nock("https://test.com")
.persist()
.get("/special-file.json").reply(200, "special file")
.get(/.*/).reply(200, "all others");
console.log(await get("https://test.com/special-file.json"));
console.log(await get("https://test.com/special-file.json"));
console.log(await get("https://test.com/other-file.json"));
})();
Would you be interested in contributing a fix?
- yes
dominikschreiber