Browse Source

fix: Placeholder for platform-deno

pull/1/head
Ambrose Chua 2 years ago
parent
commit
4c2a24377f
  1. 2
      .github/workflows/node.yml
  2. 2
      README.md
  3. 7
      package.json
  4. 2
      src/index.ts
  5. 9
      src/platform-deno.ts

2
.github/workflows/node.yml

@ -68,6 +68,4 @@ jobs:
- run: npm run lint --if-present
# TODO: Generate and publish a HTML artifact
- run: npm start
# vim: set et ts=2 sw=2:

2
README.md

@ -1,4 +1,3 @@
# Comparing `fetch()` implementations
A small project comparing `fetch()` implementations across various platforms
@ -15,5 +14,4 @@ Browser testing is done using [`webdriver`](https://github.com/webdriverio/webdr
- `node-fetch`
- Deno (TODO)
<!-- vim: set conceallevel=2 et ts=2 sw=2: -->

7
package.json

@ -42,6 +42,11 @@
},
"xo": {
"prettier": true,
"globals": ["Request", "Response", "Headers", "fetch"]
"globals": [
"Request",
"Response",
"Headers",
"fetch"
]
}
}

2
src/index.ts

@ -70,7 +70,7 @@ async function run() {
try {
results[name] = await platforms[name].run(ctx, 'all');
log.debug(name, results[name]);
} catch (error: Error) {
} catch (error: unknown) {
log.error(name, error);
}
}

9
src/platform-deno.ts

@ -1,3 +1,4 @@
import cp from 'node:child_process';
// @ts-expect-error: Missing types
import {binary} from 'deno-prebuilt';
@ -6,5 +7,13 @@ import {Platform, Result} from './types.js';
export default class PlatformDeno implements Platform {
async run(): Promise<Result> {
throw new Error('not implemented');
/* eslint-disable no-unreachable */
const child = cp.spawn(binary, []);
await new Promise((resolve, reject) => {
child.once('error', reject);
child.once('spawn', resolve);
});
child.kill();
/* eslint-enable no-unreachable */
}
}
Loading…
Cancel
Save