mirror of https://github.com/nodejs/corepack.git
Use NOCK_ENV=replay by default
Replaying HTTP requests makes the tests faster and aligns them with CI.
This commit is contained in:
parent
d26a552daa
commit
cdae6e514d
|
|
@ -89,5 +89,3 @@ jobs:
|
|||
- run: corepack yarn build # We need the stubs to run the tests
|
||||
|
||||
- run: corepack yarn test
|
||||
env:
|
||||
NOCK_ENV: replay
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ switch (process.env.AUTH_TYPE) {
|
|||
default: throw new Error(`Invalid AUTH_TYPE in env`, {cause: process.env.AUTH_TYPE});
|
||||
}
|
||||
|
||||
if (process.env.NOCK_ENV === `replay`) {
|
||||
if (process.env.NOCK_ENV !== `record`) {
|
||||
const originalFetch = globalThis.fetch;
|
||||
globalThis.fetch = function fetch(i) {
|
||||
if (!`${i}`.startsWith(
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ if (process.env.NOCK_ENV === `record`) {
|
|||
headers: minimalHeaders,
|
||||
});
|
||||
};
|
||||
} else if (process.env.NOCK_ENV === `replay`) {
|
||||
} else {
|
||||
const getNockStatement = db.prepare(`SELECT body, json(headers) as headers, status FROM nocks WHERE hash = ?`);
|
||||
|
||||
globalThis.fetch = async (input, init) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue