From 69a8f054884978b4d7917867e809995d9ef6e1d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Arboleda?= Date: Wed, 11 Nov 2020 18:37:33 -0500 Subject: [PATCH] test: improve test coverage SourceMap API PR-URL: https://github.com/nodejs/node/pull/36089 Reviewed-By: Zeyu Yang Reviewed-By: Rich Trott --- test/parallel/test-source-map-api.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-source-map-api.js b/test/parallel/test-source-map-api.js index 1a3d180619fe05..9bebc4c6c9ccae 100644 --- a/test/parallel/test-source-map-api.js +++ b/test/parallel/test-source-map-api.js @@ -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. {