test: update fetch fixtures only when requested
avoids automagic http requests in tests
This commit is contained in:
parent
f3beb72f17
commit
faa6eb6ed7
2 changed files with 7 additions and 1 deletions
|
|
@ -11,6 +11,7 @@
|
|||
"lint:fix": "eslint --fix",
|
||||
"start": "node dist/index.js",
|
||||
"test": "jest",
|
||||
"test:update-fixtures": "TEST_UPDATE_FIXTURES=1 npm run test",
|
||||
"ci": "npm run lint && npm run analyse && npm run test"
|
||||
},
|
||||
"repository": {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,12 @@ export class Fetcher {
|
|||
let response;
|
||||
|
||||
try {
|
||||
response = await callable();
|
||||
if (process.env['TEST_UPDATE_FIXTURES']) {
|
||||
response = await callable();
|
||||
} else {
|
||||
console.error(`No fixture found at "${path}".`);
|
||||
process.exit(1);
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof AxiosError) {
|
||||
const fixtureError = JSON.stringify({
|
||||
|
|
|
|||
Loading…
Reference in a new issue