aboutsummaryrefslogtreecommitdiff
path: root/test/parallel/test-module-binding.js
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2018-02-05 21:59:38 -0800
committerRich Trott <rtrott@gmail.com>2018-02-11 14:19:07 -0800
commitbd4773a0431da9c846c3b4a2f6459db1f151c115 (patch)
tree342d61a9d6fcf2851b821fecb21a13dc303ce00b /test/parallel/test-module-binding.js
parent2aa3e3b00ff97e50f87a3345a33bcac9f424d0d7 (diff)
downloadandroid-node-v8-bd4773a0431da9c846c3b4a2f6459db1f151c115.tar.gz
android-node-v8-bd4773a0431da9c846c3b4a2f6459db1f151c115.tar.bz2
android-node-v8-bd4773a0431da9c846c3b4a2f6459db1f151c115.zip
module: use undefined if no main
If the package.json file does not have a "main" entry, return undefined rather than an empty string. This is to make more consistent behavior. For example, when package.json is a directory, "main" is undefined rather than an empty string. PR-URL: https://github.com/nodejs/node/pull/18593 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Benedikt Meurer <benedikt.meurer@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'test/parallel/test-module-binding.js')
-rw-r--r--test/parallel/test-module-binding.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/parallel/test-module-binding.js b/test/parallel/test-module-binding.js
index bea0c91f0c..a3ebaf9e72 100644
--- a/test/parallel/test-module-binding.js
+++ b/test/parallel/test-module-binding.js
@@ -6,8 +6,9 @@ const { readFileSync } = require('fs');
const { strictEqual } = require('assert');
strictEqual(internalModuleReadJSON('nosuchfile'), undefined);
-strictEqual(internalModuleReadJSON(fixtures.path('empty.txt')), '');
-strictEqual(internalModuleReadJSON(fixtures.path('empty-with-bom.txt')), '');
+strictEqual(internalModuleReadJSON(fixtures.path('empty.txt')), undefined);
+strictEqual(internalModuleReadJSON(fixtures.path('empty-with-bom.txt')),
+ undefined);
{
const filename = fixtures.path('require-bin/package.json');
strictEqual(internalModuleReadJSON(filename), readFileSync(filename, 'utf8'));