Skip to content

Commit ad4af04

Browse files
TrottMylesBorins
authored andcommitted
test,module: add test for exports cjs loader check
Refs: #31001 (comment) PR-URL: #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]>
1 parent db5ec52 commit ad4af04

File tree

5 files changed

+177
-0
lines changed

5 files changed

+177
-0
lines changed

test/fixtures/bluebird/node_modules/bluebird/js/release/bluebird.js

Whitespace-only changes.

test/fixtures/bluebird/node_modules/bluebird/package.json

+78
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/fixtures/bluebird/package.json

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
{
2+
"name": "bluebird",
3+
"description": "Full featured Promises/A+ implementation with exceptionally good performance",
4+
"version": "3.7.2",
5+
"keywords": [
6+
"promise",
7+
"performance",
8+
"promises",
9+
"promises-a",
10+
"promises-aplus",
11+
"async",
12+
"await",
13+
"deferred",
14+
"deferreds",
15+
"future",
16+
"flow control",
17+
"dsl",
18+
"fluent interface"
19+
],
20+
"scripts": {
21+
"lint": "node scripts/jshint.js",
22+
"test": "node --expose-gc tools/test.js",
23+
"istanbul": "istanbul",
24+
"prepublish": "npm run generate-browser-core && npm run generate-browser-full",
25+
"generate-browser-full": "node tools/build.js --no-clean --no-debug --release --browser --minify",
26+
"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"
27+
},
28+
"homepage": "https://github.com/petkaantonov/bluebird",
29+
"repository": {
30+
"type": "git",
31+
"url": "git://github.com/petkaantonov/bluebird.git"
32+
},
33+
"bugs": {
34+
"url": "http://github.com/petkaantonov/bluebird/issues"
35+
},
36+
"license": "MIT",
37+
"author": {
38+
"name": "Petka Antonov",
39+
"email": "[email protected]",
40+
"url": "http://github.com/petkaantonov/"
41+
},
42+
"devDependencies": {
43+
"acorn": "^6.0.2",
44+
"acorn-walk": "^6.1.0",
45+
"baconjs": "^0.7.43",
46+
"bluebird": "^2.9.2",
47+
"body-parser": "^1.10.2",
48+
"browserify": "^8.1.1",
49+
"cli-table": "~0.3.1",
50+
"co": "^4.2.0",
51+
"cross-spawn": "^0.2.3",
52+
"glob": "^4.3.2",
53+
"grunt-saucelabs": "~8.4.1",
54+
"highland": "^2.3.0",
55+
"istanbul": "^0.3.5",
56+
"jshint": "^2.6.0",
57+
"jshint-stylish": "~0.2.0",
58+
"kefir": "^2.4.1",
59+
"mkdirp": "~0.5.0",
60+
"mocha": "~2.1",
61+
"open": "~0.0.5",
62+
"optimist": "~0.6.1",
63+
"rimraf": "~2.2.6",
64+
"rx": "^2.3.25",
65+
"serve-static": "^1.7.1",
66+
"sinon": "~1.7.3",
67+
"uglify-js": "~2.4.16"
68+
},
69+
"readmeFilename": "README.md",
70+
"main": "./js/release/bluebird.js",
71+
"webpack": "./js/release/bluebird.js",
72+
"browser": "./js/browser/bluebird.js",
73+
"files": [
74+
"js/browser",
75+
"js/release",
76+
"LICENSE"
77+
]
78+
}

test/fixtures/bluebird/test.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require('bluebird')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
'use strict';
2+
3+
require('../common');
4+
5+
// Test that a nonexistent "main" entry in a package.json that also omits an
6+
// "exports" entry will be ignored if it can be found in node_modules instead
7+
// rather than throwing.
8+
//
9+
// Throwing is perhaps "correct" behavior, but it will break bluebird tests
10+
// as of this writing.
11+
12+
const assert = require('assert');
13+
const { spawnSync } = require('child_process');
14+
const fixtures = require('../common/fixtures');
15+
16+
const { error, status, stderr } =
17+
spawnSync(process.execPath, [fixtures.path('bluebird', 'test.js')]);
18+
19+
assert.ifError(error);
20+
assert.strictEqual(status, 0, stderr);

0 commit comments

Comments
 (0)