summaryrefslogtreecommitdiff
path: root/test/sequential/test-module-loading.js
diff options
context:
space:
mode:
authorGus Caplan <me@gus.host>2019-05-18 22:48:46 -0500
committerGus Caplan <me@gus.host>2019-05-26 13:04:29 -0500
commite2c0c0c68074c539ae2ae30debdeafb9f94d989b (patch)
tree4b1748c744aa778f688804258c432cd5986cba64 /test/sequential/test-module-loading.js
parent73c16b11e006256c2d41e70e964a4960ba435759 (diff)
downloadandroid-node-v8-e2c0c0c68074c539ae2ae30debdeafb9f94d989b.tar.gz
android-node-v8-e2c0c0c68074c539ae2ae30debdeafb9f94d989b.tar.bz2
android-node-v8-e2c0c0c68074c539ae2ae30debdeafb9f94d989b.zip
lib: rework logic of stripping BOM+Shebang from commonjs
Fixes https://github.com/nodejs/node/issues/27767 PR-URL: https://github.com/nodejs/node/pull/27768 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'test/sequential/test-module-loading.js')
-rw-r--r--test/sequential/test-module-loading.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/sequential/test-module-loading.js b/test/sequential/test-module-loading.js
index 612cde3ab0..94acdb191b 100644
--- a/test/sequential/test-module-loading.js
+++ b/test/sequential/test-module-loading.js
@@ -352,6 +352,13 @@ process.on('exit', function() {
assert.strictEqual(require('../fixtures/utf8-bom.js'), 42);
assert.strictEqual(require('../fixtures/utf8-bom.json'), 42);
+// Loading files with BOM + shebang.
+// See https://github.com/nodejs/node/issues/27767
+assert.throws(() => {
+ require('../fixtures/utf8-bom-shebang.js');
+}, { name: 'SyntaxError' });
+assert.strictEqual(require('../fixtures/utf8-shebang-bom.js'), 42);
+
// Error on the first line of a module should
// have the correct line number
assert.throws(function() {