node/test/parallel/test-require-invalid-main-no-exports.js
Rich Trott dc90f925fb 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 <riclau@uk.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: David Carlier <devnexen@gmail.com>
2020-01-22 22:10:05 -08:00

22 lines
657 B
JavaScript

'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 testFile = fixtures.path('package-main-enoent', 'test.js');
const { error, status, stderr } = spawnSync(process.execPath, [testFile]);
assert.ifError(error);
assert.strictEqual(status, 0, stderr);