xref: /third_party/node/test/parallel/test-require-invalid-main-no-exports.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_cirequire('../common');
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci// Test that a nonexistent "main" entry in a package.json that also omits an
61cb0ef41Sopenharmony_ci// "exports" entry will be ignored if it can be found in node_modules instead
71cb0ef41Sopenharmony_ci// rather than throwing.
81cb0ef41Sopenharmony_ci//
91cb0ef41Sopenharmony_ci// Throwing is perhaps "correct" behavior, but it will break bluebird tests
101cb0ef41Sopenharmony_ci// as of this writing.
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_ciconst assert = require('assert');
131cb0ef41Sopenharmony_ciconst { spawnSync } = require('child_process');
141cb0ef41Sopenharmony_ciconst fixtures = require('../common/fixtures');
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ciconst testFile = fixtures.path('package-main-enoent', 'test.js');
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_ciconst { error, status, stderr } = spawnSync(process.execPath, [testFile]);
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_ciassert.ifError(error);
211cb0ef41Sopenharmony_ciassert.strictEqual(status, 0, stderr);
22

Indexes created Thu Nov 07 10:32:03 CST 2024