1
0
Fork 0
fetch-compare/fixtures/index-node.js

22 lines
542 B
JavaScript
Raw Permalink Normal View History

2021-09-09 23:47:04 +08:00
import process from 'node:process';
import fetch, {Request, Response, Headers} from 'node-fetch';
2021-09-10 01:55:07 +08:00
import {AbortController} from 'node-abort-controller';
2021-09-09 23:47:04 +08:00
import run from './run.js';
global.Request = Request;
global.Response = Response;
global.Headers = Headers;
global.fetch = fetch;
2021-09-10 01:55:07 +08:00
global.AbortController = AbortController;
2021-09-09 23:47:04 +08:00
async function main(file) {
const tests = await import('./' + file + '.js');
2021-09-10 00:37:10 +08:00
const result = await run(tests.default);
2021-09-09 23:47:04 +08:00
process.send(result);
}
2021-09-10 00:38:22 +08:00
main(process.argv[2]).catch((error) => {
console.error(error);
2021-09-10 00:37:10 +08:00
});