Skip to content

Commit

Permalink
Update resolver unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Binns-Smith committed Apr 6, 2022
1 parent 9e07bfa commit 7845dc3
Showing 1 changed file with 88 additions and 0 deletions.
88 changes: 88 additions & 0 deletions packages/utils/node-resolver-core/test/resolver.js
Expand Up @@ -307,6 +307,10 @@ describe('resolver', function () {
fileName: 'node_modules/browserify-zlib',
aboveFilePath: path.join(rootDir, 'foo.js'),
},
{
fileName: 'package.json',
aboveFilePath: require.resolve('browserify-zlib/lib/index.js'),
},
],
invalidateOnFileChange: [
path.join(rootDir, 'package.json'),
Expand Down Expand Up @@ -339,6 +343,10 @@ describe('resolver', function () {
fileName: 'node_modules/browserify-zlib',
aboveFilePath: path.join(rootDir, 'foo.js'),
},
{
fileName: 'package.json',
aboveFilePath: require.resolve('browserify-zlib/lib/index.js'),
},
],
invalidateOnFileChange: [
path.join(rootDir, 'package.json'),
Expand Down Expand Up @@ -465,6 +473,13 @@ describe('resolver', function () {
fileName: 'node_modules/package-main',
aboveFilePath: path.join(rootDir, 'foo.js'),
},
{
fileName: 'package.json',
aboveFilePath: path.join(
rootDir,
'node_modules/package-main/main.js',
),
},
],
invalidateOnFileChange: [
path.join(rootDir, 'package.json'),
Expand Down Expand Up @@ -502,6 +517,13 @@ describe('resolver', function () {
fileName: 'node_modules/package-module',
aboveFilePath: path.join(rootDir, 'foo.js'),
},
{
fileName: 'package.json',
aboveFilePath: path.join(
rootDir,
'node_modules/package-module/module.js',
),
},
],
invalidateOnFileChange: [
path.join(rootDir, 'package.json'),
Expand Down Expand Up @@ -539,6 +561,13 @@ describe('resolver', function () {
fileName: 'node_modules/package-browser',
aboveFilePath: path.join(rootDir, 'foo.js'),
},
{
fileName: 'package.json',
aboveFilePath: path.join(
rootDir,
'node_modules/package-browser/browser.js',
),
},
],
invalidateOnFileChange: [
path.join(rootDir, 'package.json'),
Expand Down Expand Up @@ -576,6 +605,13 @@ describe('resolver', function () {
fileName: 'node_modules/package-browser',
aboveFilePath: path.join(rootDir, 'foo.js'),
},
{
fileName: 'package.json',
aboveFilePath: path.join(
rootDir,
'node_modules/package-browser/main.js',
),
},
],
invalidateOnFileChange: [
path.join(rootDir, 'package.json'),
Expand Down Expand Up @@ -1066,6 +1102,13 @@ describe('resolver', function () {
'bar.json',
),
},
{
fileName: 'package.json',
aboveFilePath: path.join(
rootDir,
'node_modules/side-effects-package-redirect-up/foo/real-bar.js',
),
},
],
invalidateOnFileChange: [
path.join(rootDir, 'package.json'),
Expand Down Expand Up @@ -1139,6 +1182,13 @@ describe('resolver', function () {
'bar.json',
),
},
{
fileName: 'package.json',
aboveFilePath: path.join(
rootDir,
'node_modules/side-effects-package-redirect-down/foo/bar/baz/real-bar.js',
),
},
],
invalidateOnFileChange: [
path.join(rootDir, 'package.json'),
Expand Down Expand Up @@ -1362,6 +1412,13 @@ describe('resolver', function () {
fileName: 'node_modules/package-browser-alias',
aboveFilePath: path.join(rootDir, 'foo.js'),
},
{
fileName: 'package.json',
aboveFilePath: path.join(
rootDir,
'node_modules/package-browser-alias/browser.js',
),
},
],
invalidateOnFileChange: [
path.join(rootDir, 'package.json'),
Expand Down Expand Up @@ -2177,6 +2234,10 @@ describe('resolver', function () {
fileName: 'node_modules/package-browser-exclude',
aboveFilePath: path.join(rootDir, 'foo.js'),
},
{
fileName: 'package.json',
aboveFilePath: path.join(__dirname, '..', 'src', '_empty.js'),
},
],
invalidateOnFileChange: [
path.join(rootDir, 'package.json'),
Expand All @@ -2186,6 +2247,7 @@ describe('resolver', function () {
'package-browser-exclude',
'package.json',
),
path.join(__dirname, '..', 'package.json'),
],
});
});
Expand Down Expand Up @@ -2214,6 +2276,10 @@ describe('resolver', function () {
fileName: 'node_modules/package-alias-exclude',
aboveFilePath: path.join(rootDir, 'foo.js'),
},
{
fileName: 'package.json',
aboveFilePath: path.join(__dirname, '..', 'src', '_empty.js'),
},
],
invalidateOnFileChange: [
path.join(rootDir, 'package.json'),
Expand All @@ -2223,6 +2289,7 @@ describe('resolver', function () {
'package-alias-exclude',
'package.json',
),
path.join(__dirname, '..', 'package.json'),
],
});
});
Expand Down Expand Up @@ -2254,6 +2321,13 @@ describe('resolver', function () {
fileName: 'node_modules/source',
aboveFilePath: path.join(rootDir, 'foo.js'),
},
{
fileName: 'package.json',
aboveFilePath: path.join(
rootDir,
'node_modules/source/source.js',
),
},
],
invalidateOnFileChange: [
path.join(rootDir, 'package.json'),
Expand Down Expand Up @@ -2294,6 +2368,13 @@ describe('resolver', function () {
fileName: 'node_modules/source-pnpm',
aboveFilePath: path.join(rootDir, 'foo.js'),
},
{
fileName: 'package.json',
aboveFilePath: path.join(
rootDir,
'node_modules/source-pnpm/dist.js',
),
},
],
invalidateOnFileChange: [
path.join(rootDir, 'package.json'),
Expand Down Expand Up @@ -2333,6 +2414,13 @@ describe('resolver', function () {
fileName: 'node_modules/source-not-symlinked',
aboveFilePath: path.join(rootDir, 'foo.js'),
},
{
fileName: 'package.json',
aboveFilePath: path.join(
rootDir,
'node_modules/source-not-symlinked/dist.js',
),
},
],
invalidateOnFileChange: [
path.join(rootDir, 'package.json'),
Expand Down

0 comments on commit 7845dc3

Please sign in to comment.