From dc90f925fbf46d1d81940f3b07f7b71af9d83be3 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 20 Jan 2020 21:42:29 -0800 Subject: [PATCH] test: remove bluebird remnants from test fixture The test fixture in test/fixtures/bluebird was largely copied from bluebird, where a regression in Node.js was discovered. Simplify the test by removing a lot of things that aren't necessary to replicate the problem. Change name from bluebird to something less likely to cause someone to believe that we are actually loading bluebird (as we are not). PR-URL: https://github.com/nodejs/node/pull/31435 Reviewed-By: Richard Lau Reviewed-By: Ruben Bridgewater Reviewed-By: David Carlier --- .../node_modules/bluebird/package.json | 78 ------------------- test/fixtures/bluebird/package.json | 78 ------------------- test/fixtures/bluebird/test.js | 1 - .../package-main-enoent/fhqwhgads.js} | 0 .../package-main-enoent/package.json | 4 + .../fixtures/package-main-enoent/package.json | 4 + test/fixtures/package-main-enoent/test.js | 8 ++ .../test-require-invalid-main-no-exports.js | 5 +- 8 files changed, 19 insertions(+), 159 deletions(-) delete mode 100644 test/fixtures/bluebird/node_modules/bluebird/package.json delete mode 100644 test/fixtures/bluebird/package.json delete mode 100644 test/fixtures/bluebird/test.js rename test/fixtures/{bluebird/node_modules/bluebird/js/release/bluebird.js => package-main-enoent/node_modules/package-main-enoent/fhqwhgads.js} (100%) create mode 100644 test/fixtures/package-main-enoent/node_modules/package-main-enoent/package.json create mode 100644 test/fixtures/package-main-enoent/package.json create mode 100644 test/fixtures/package-main-enoent/test.js diff --git a/test/fixtures/bluebird/node_modules/bluebird/package.json b/test/fixtures/bluebird/node_modules/bluebird/package.json deleted file mode 100644 index 33f696cb246847..00000000000000 --- a/test/fixtures/bluebird/node_modules/bluebird/package.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "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": "petka_antonov@hotmail.com", - "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" - ] -} diff --git a/test/fixtures/bluebird/package.json b/test/fixtures/bluebird/package.json deleted file mode 100644 index 33f696cb246847..00000000000000 --- a/test/fixtures/bluebird/package.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "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": "petka_antonov@hotmail.com", - "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" - ] -} diff --git a/test/fixtures/bluebird/test.js b/test/fixtures/bluebird/test.js deleted file mode 100644 index b68a3a2ce3d150..00000000000000 --- a/test/fixtures/bluebird/test.js +++ /dev/null @@ -1 +0,0 @@ -require('bluebird') diff --git a/test/fixtures/bluebird/node_modules/bluebird/js/release/bluebird.js b/test/fixtures/package-main-enoent/node_modules/package-main-enoent/fhqwhgads.js similarity index 100% rename from test/fixtures/bluebird/node_modules/bluebird/js/release/bluebird.js rename to test/fixtures/package-main-enoent/node_modules/package-main-enoent/fhqwhgads.js diff --git a/test/fixtures/package-main-enoent/node_modules/package-main-enoent/package.json b/test/fixtures/package-main-enoent/node_modules/package-main-enoent/package.json new file mode 100644 index 00000000000000..4b90985c741238 --- /dev/null +++ b/test/fixtures/package-main-enoent/node_modules/package-main-enoent/package.json @@ -0,0 +1,4 @@ +{ + "name": "package-main-enoent", + "main": "./fhqwhgads.js" +} diff --git a/test/fixtures/package-main-enoent/package.json b/test/fixtures/package-main-enoent/package.json new file mode 100644 index 00000000000000..4b90985c741238 --- /dev/null +++ b/test/fixtures/package-main-enoent/package.json @@ -0,0 +1,4 @@ +{ + "name": "package-main-enoent", + "main": "./fhqwhgads.js" +} diff --git a/test/fixtures/package-main-enoent/test.js b/test/fixtures/package-main-enoent/test.js new file mode 100644 index 00000000000000..d698085e5dd554 --- /dev/null +++ b/test/fixtures/package-main-enoent/test.js @@ -0,0 +1,8 @@ +'use strict'; + +// The path in "main" in "package.json" does not exist here, but it does in +// the copy in node_modules. This is being tested because bluebird tests depend +// on this behavior and it was accidentally broken by a seemingly unrelated +// commit on master. + +require('package-main-enoent'); diff --git a/test/parallel/test-require-invalid-main-no-exports.js b/test/parallel/test-require-invalid-main-no-exports.js index 676053ce3565c3..9be5c01054e70b 100644 --- a/test/parallel/test-require-invalid-main-no-exports.js +++ b/test/parallel/test-require-invalid-main-no-exports.js @@ -13,8 +13,9 @@ 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')]); +const testFile = fixtures.path('package-main-enoent', 'test.js'); + +const { error, status, stderr } = spawnSync(process.execPath, [testFile]); assert.ifError(error); assert.strictEqual(status, 0, stderr);