Logo
Explore Help
Sign In
1berry/nodejs
1
0
Fork 0
You've already forked nodejs
Code Issues Packages Projects Releases Wiki Activity
nodejs/test/parallel/test-module-loading-deprecated.js

11 lines
316 B
JavaScript
Raw Normal View History

module: throw an error for invalid package.json main entries We currently ignore invalid `main` entries in package.json files. This does not seem to be very user friendly as it's certainly an error if the `main` entry is not a valid file name. So instead of trying to resolve the file otherwise, throw an error immediately to improve the user experience. To keep it backwards compatible `index.js` files in the same directory as the `package.json` will continue to be resolved instead but that behavior is now deprecated. PR-URL: https://github.com/nodejs/node/pull/26823 Fixes: https://github.com/nodejs/node/issues/26588 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2019-03-20 17:00:57 +01:00
'use strict';
const common = require('../common');
const assert = require('assert');
common.expectWarning('DeprecationWarning', {
DEP0128: /^Invalid 'main' field in '.+main[/\\]package\.json' of 'doesnotexist\.js'\..+module author/
});
assert.strictEqual(require('../fixtures/packages/missing-main').ok, 'ok');
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.8 Page: 5717ms Template: 2ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API