-
Notifications
You must be signed in to change notification settings - Fork 524
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: port first half of fetch tests to node test runner (#2569)
- Loading branch information
1 parent
d00b822
commit f0a16f9
Showing
22 changed files
with
832 additions
and
939 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,20 @@ | ||
'use strict' | ||
|
||
const { test } = require('tap') | ||
const { test } = require('node:test') | ||
const assert = require('node:assert') | ||
const { fetch } = require('../..') | ||
|
||
test('fetching about: uris', async (t) => { | ||
t.test('about:blank', async (t) => { | ||
await t.rejects(fetch('about:blank')) | ||
await t.test('about:blank', async () => { | ||
await assert.rejects(fetch('about:blank')) | ||
}) | ||
|
||
t.test('All other about: urls should return an error', async (t) => { | ||
await t.test('All other about: urls should return an error', async () => { | ||
try { | ||
await fetch('about:config') | ||
t.fail('fetching about:config should fail') | ||
assert.fail('fetching about:config should fail') | ||
} catch (e) { | ||
t.ok(e, 'this error was expected') | ||
} finally { | ||
t.end() | ||
assert.ok(e, 'this error was expected') | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
'use strict' | ||
|
||
const { test } = require('tap') | ||
const { test } = require('node:test') | ||
const assert = require('node:assert') | ||
const { fetch } = require('../..') | ||
const { fetch: fetchIndex } = require('../../index-fetch') | ||
|
||
test('FETCH: request errors and prints trimmed stack trace', async (t) => { | ||
try { | ||
await fetch('http://a.com') | ||
} catch (error) { | ||
t.match(error.stack, `at Test.<anonymous> (${__filename}`) | ||
assert.ok(error.stack.includes(`at async TestContext.<anonymous> (${__filename}`)) | ||
} | ||
}) | ||
|
||
test('FETCH-index: request errors and prints trimmed stack trace', async (t) => { | ||
try { | ||
await fetchIndex('http://a.com') | ||
} catch (error) { | ||
t.match(error.stack, `at Test.<anonymous> (${__filename}`) | ||
assert.ok(error.stack.includes(`at async TestContext.<anonymous> (${__filename}`)) | ||
} | ||
}) |
Oops, something went wrong.