@@ -10,13 +10,13 @@ describe("getDependencyResolver(root, path, input)", () => {
10
10
const root = "test/input/build/simple-public" ;
11
11
const specifier = "/npm/[email protected] /dist/d3-array.js" ;
12
12
const resolver = await getDependencyResolver ( root , "/_npm/[email protected] /_esm.js" , `import '${ specifier } ';\n` ) ; // prettier-ignore
13
- assert . strictEqual ( resolver ( specifier ) , "../[email protected] /dist/d3-array.js._esm.js " ) ;
13
+ assert . strictEqual ( resolver ( specifier ) , "../[email protected] /dist/d3-array.js" ) ;
14
14
} ) ;
15
15
it ( "finds /npm/ import resolutions and re-resolves their versions" , async ( ) => {
16
16
const root = "test/input/build/simple-public" ;
17
17
const specifier = "/npm/[email protected] /dist/d3-array.js" ;
18
18
const resolver = await getDependencyResolver ( root , "/_npm/[email protected] /_esm.js" , `import.meta.resolve('${ specifier } ');\n` ) ; // prettier-ignore
19
- assert . strictEqual ( resolver ( specifier ) , "../[email protected] /dist/d3-array.js._esm.js " ) ;
19
+ assert . strictEqual ( resolver ( specifier ) , "../[email protected] /dist/d3-array.js" ) ;
20
20
} ) ;
21
21
} ) ;
22
22
@@ -55,14 +55,14 @@ describe("resolveNpmImport(root, specifier)", () => {
55
55
assert . strictEqual ( await resolveNpmImport ( root , "d3-array/foo+bar" ) , "/_npm/[email protected] /foo+bar._esm.js" ) ;
56
56
assert . strictEqual ( await resolveNpmImport ( root , "d3-array/foo+esm" ) , "/_npm/[email protected] /foo+esm._esm.js" ) ;
57
57
} ) ;
58
- it ( "implicitly adds ._esm.js for specifiers with a JavaScript extension" , async ( ) => {
59
- assert . strictEqual ( await resolveNpmImport ( root , "d3-array/src/index.js" ) , "/_npm/[email protected] /src/index.js._esm.js" ) ; // prettier-ignore
60
- } ) ;
61
58
it ( "replaces /+esm with /_esm.js or ._esm.js" , async ( ) => {
62
59
assert . strictEqual ( await resolveNpmImport ( root , "d3-array/+esm" ) , "/_npm/[email protected] /_esm.js" ) ;
63
60
assert . strictEqual ( await resolveNpmImport ( root , "d3-array/src/+esm" ) , "/_npm/[email protected] /src._esm.js" ) ;
64
61
assert . strictEqual ( await resolveNpmImport ( root , "d3-array/src/index.js/+esm" ) , "/_npm/[email protected] /src/index.js._esm.js" ) ; // prettier-ignore
65
62
} ) ;
63
+ it ( "does not add ._esm.js for specifiers with a JavaScript extension" , async ( ) => {
64
+ assert . strictEqual ( await resolveNpmImport ( root , "d3-array/src/index.js" ) , "/_npm/[email protected] /src/index.js" ) ;
65
+ } ) ;
66
66
it ( "does not add ._esm.js for specifiers with a non-JavaScript extension" , async ( ) => {
67
67
assert . strictEqual ( await resolveNpmImport ( root , "d3-array/src/index.css" ) , "/_npm/[email protected] /src/index.css" ) ;
68
68
} ) ;
0 commit comments