Skip to content

Commit

Permalink
test,module: add test for exports cjs loader check
Browse files Browse the repository at this point in the history
Refs: nodejs#31001 (comment)

PR-URL: nodejs#31427
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Shelley Vohr <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
Trott committed Jan 21, 2020
1 parent c2c3274 commit dcba128
Show file tree
Hide file tree
Showing 5 changed files with 177 additions and 0 deletions.
Empty file.
78 changes: 78 additions & 0 deletions test/fixtures/bluebird/node_modules/bluebird/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

78 changes: 78 additions & 0 deletions test/fixtures/bluebird/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"name": "bluebird",
"description": "Full featured Promises/A+ implementation with exceptionally good performance",
"version": "3.7.2",
"keywords": [
"promise",
"performance",
"promises",
"promises-a",
"promises-aplus",
"async",
"await",
"deferred",
"deferreds",
"future",
"flow control",
"dsl",
"fluent interface"
],
"scripts": {
"lint": "node scripts/jshint.js",
"test": "node --expose-gc tools/test.js",
"istanbul": "istanbul",
"prepublish": "npm run generate-browser-core && npm run generate-browser-full",
"generate-browser-full": "node tools/build.js --no-clean --no-debug --release --browser --minify",
"generate-browser-core": "node tools/build.js --features=core --no-debug --release --zalgo --browser --minify && mv js/browser/bluebird.js js/browser/bluebird.core.js && mv js/browser/bluebird.min.js js/browser/bluebird.core.min.js"
},
"homepage": "https://github.com/petkaantonov/bluebird",
"repository": {
"type": "git",
"url": "git://github.com/petkaantonov/bluebird.git"
},
"bugs": {
"url": "http://github.com/petkaantonov/bluebird/issues"
},
"license": "MIT",
"author": {
"name": "Petka Antonov",
"email": "[email protected]",
"url": "http://github.com/petkaantonov/"
},
"devDependencies": {
"acorn": "^6.0.2",
"acorn-walk": "^6.1.0",
"baconjs": "^0.7.43",
"bluebird": "^2.9.2",
"body-parser": "^1.10.2",
"browserify": "^8.1.1",
"cli-table": "~0.3.1",
"co": "^4.2.0",
"cross-spawn": "^0.2.3",
"glob": "^4.3.2",
"grunt-saucelabs": "~8.4.1",
"highland": "^2.3.0",
"istanbul": "^0.3.5",
"jshint": "^2.6.0",
"jshint-stylish": "~0.2.0",
"kefir": "^2.4.1",
"mkdirp": "~0.5.0",
"mocha": "~2.1",
"open": "~0.0.5",
"optimist": "~0.6.1",
"rimraf": "~2.2.6",
"rx": "^2.3.25",
"serve-static": "^1.7.1",
"sinon": "~1.7.3",
"uglify-js": "~2.4.16"
},
"readmeFilename": "README.md",
"main": "./js/release/bluebird.js",
"webpack": "./js/release/bluebird.js",
"browser": "./js/browser/bluebird.js",
"files": [
"js/browser",
"js/release",
"LICENSE"
]
}
1 change: 1 addition & 0 deletions test/fixtures/bluebird/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('bluebird')
20 changes: 20 additions & 0 deletions test/parallel/test-require-invalid-main-no-exports.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

require('../common');

// Test that a nonexistent "main" entry in a package.json that also omits an
// "exports" entry will be ignored if it can be found in node_modules instead
// rather than throwing.
//
// Throwing is perhaps "correct" behavior, but it will break bluebird tests
// as of this writing.

const assert = require('assert');
const { spawnSync } = require('child_process');
const fixtures = require('../common/fixtures');

const { error, status, stderr } =
spawnSync(process.execPath, [fixtures.path('bluebird', 'test.js')]);

assert.ifError(error);
assert.strictEqual(status, 0, stderr);

0 comments on commit dcba128

Please sign in to comment.