diff options
author | cjihrig <cjihrig@gmail.com> | 2019-05-18 10:09:48 -0400 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2019-05-20 10:26:23 -0400 |
commit | 873c372e6772d7378531d6afc8cad8bd513bdc58 (patch) | |
tree | 7536a8840b6b0785a78336e70d3aad6b473f6b8e /test/es-module | |
parent | 1b381d630a3a595405c00892c58335369a368915 (diff) | |
download | node-new-873c372e6772d7378531d6afc8cad8bd513bdc58.tar.gz |
esm: use correct error arguments
ERR_UNKNOWN_FILE_EXTENSION expects a single argument. This
commit fixes the argument count.
PR-URL: https://github.com/nodejs/node/pull/27763
Fixes: https://github.com/nodejs/node/issues/27761
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Diffstat (limited to 'test/es-module')
-rw-r--r-- | test/es-module/test-esm-invalid-extension.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/es-module/test-esm-invalid-extension.js b/test/es-module/test-esm-invalid-extension.js new file mode 100644 index 0000000000..9e676e57d1 --- /dev/null +++ b/test/es-module/test-esm-invalid-extension.js @@ -0,0 +1,13 @@ +'use strict'; +require('../common'); +const fixtures = require('../common/fixtures'); +const assert = require('assert'); +const { spawnSync } = require('child_process'); +const fixture = fixtures.path('/es-modules/import-invalid-ext.mjs'); +const child = spawnSync(process.execPath, ['--experimental-modules', fixture]); +const errMsg = 'TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension'; + +assert.strictEqual(child.status, 1); +assert.strictEqual(child.signal, null); +assert.strictEqual(child.stdout.toString().trim(), ''); +assert(child.stderr.toString().includes(errMsg)); |