test: improve test coverage SourceMap API

PR-URL: https://github.com/nodejs/node/pull/36089
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
Juan José Arboleda authored and Michaël Zasso committed 2021-05-01 09:44:32 +02:00
1 parent 9b32c9c575
commit 94a877b0a4
1 file changed
+16 -1
+16 -1
View File
@@ -1,11 +1,26 @@
// Flags: --enable-source-maps
'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');
const { findSourceMap, SourceMap } = require('module');
const { readFileSync } = require('fs');
// It should throw with invalid args.
{
[1, true, 'foo'].forEach((invalidArg) =>
assert.throws(
() => new SourceMap(invalidArg),
{
code: 'ERR_INVALID_ARG_TYPE',
name: 'TypeError',
message: 'The "payload" argument must be of type object.' +
common.invalidArgTypeHelper(invalidArg)
}
)
);
}
// findSourceMap() can lookup source-maps based on URIs, in the
// non-exceptional case.
{