Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit deceb26

Browse filesBrowse files
joyeecheungtargos
authored andcommitted
test: split test-whatwg-encoding-textdecoder-fatal.js
Split `test-whatwg-encoding-textdecoder-fatal.js` into - `test-whatwg-encoding-custom-textdecoder-fatal.js` which is a customized version of the WPT that tests for Node.js-specific error codes. - `test-whatwg-encoding-custom-textdecoder-invalid-arg` which tests `ERR_INVALID_ARG_TYPE` PR-URL: #25155 Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent a8f5191 commit deceb26
Copy full SHA for deceb26

File tree

Expand file treeCollapse file tree

2 files changed

+20
-12
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+20
-12
lines changed
Open diff view settings
Collapse file

‎…est-whatwg-encoding-textdecoder-fatal.js‎ ‎…twg-encoding-custom-textdecoder-fatal.js‎test/parallel/test-whatwg-encoding-textdecoder-fatal.js renamed to test/parallel/test-whatwg-encoding-custom-textdecoder-fatal.js test/parallel/test-whatwg-encoding-textdecoder-fatal.js renamed to test/parallel/test-whatwg-encoding-custom-textdecoder-fatal.js

Copy file name to clipboardExpand all lines: test/parallel/test-whatwg-encoding-custom-textdecoder-fatal.js
+2-12Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

33
// From: https://github.com/w3c/web-platform-tests/blob/39a67e2fff/encoding/textdecoder-fatal.html
4+
// With the twist that we specifically test for Node.js error codes
45

56
const common = require('../common');
67

@@ -82,21 +83,10 @@ bad.forEach((t) => {
8283
);
8384
});
8485

86+
// TODO(joyeecheung): remove this when WPT is ported
8587
{
8688
assert('fatal' in new TextDecoder());
8789
assert.strictEqual(typeof new TextDecoder().fatal, 'boolean');
8890
assert(!new TextDecoder().fatal);
8991
assert(new TextDecoder('utf-8', { fatal: true }).fatal);
9092
}
91-
92-
{
93-
const notArrayBufferViewExamples = [false, {}, 1, '', new Error()];
94-
notArrayBufferViewExamples.forEach((invalidInputType) => {
95-
common.expectsError(() => {
96-
new TextDecoder(undefined, null).decode(invalidInputType);
97-
}, {
98-
code: 'ERR_INVALID_ARG_TYPE',
99-
type: TypeError
100-
});
101-
});
102-
}
Collapse file
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'use strict';
2+
3+
// This tests that ERR_INVALID_ARG_TYPE are thrown when
4+
// invalid arguments are passed to TextDecoder.
5+
6+
const common = require('../common');
7+
8+
{
9+
const notArrayBufferViewExamples = [false, {}, 1, '', new Error()];
10+
notArrayBufferViewExamples.forEach((invalidInputType) => {
11+
common.expectsError(() => {
12+
new TextDecoder(undefined, null).decode(invalidInputType);
13+
}, {
14+
code: 'ERR_INVALID_ARG_TYPE',
15+
type: TypeError
16+
});
17+
});
18+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.