Skip to content

Commit 94a877b

Browse files
juanarboltargos
authored andcommitted
test: improve test coverage SourceMap API
PR-URL: #36089 Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 9b32c9c commit 94a877b

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

test/parallel/test-source-map-api.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
11
// Flags: --enable-source-maps
22
'use strict';
33

4-
require('../common');
4+
const common = require('../common');
55
const assert = require('assert');
66
const { findSourceMap, SourceMap } = require('module');
77
const { readFileSync } = require('fs');
88

9+
// It should throw with invalid args.
10+
{
11+
[1, true, 'foo'].forEach((invalidArg) =>
12+
assert.throws(
13+
() => new SourceMap(invalidArg),
14+
{
15+
code: 'ERR_INVALID_ARG_TYPE',
16+
name: 'TypeError',
17+
message: 'The "payload" argument must be of type object.' +
18+
common.invalidArgTypeHelper(invalidArg)
19+
}
20+
)
21+
);
22+
}
23+
924
// findSourceMap() can lookup source-maps based on URIs, in the
1025
// non-exceptional case.
1126
{

0 commit comments

Comments
 (0)