1
1
import assert from 'node:assert' ;
2
- import { test } from 'node:test' ;
3
- import { bundler } from '../../source/bundler.entry-point.js'
4
- import { loadPackageJson } from '../load-package-json.js'
2
+ import { test } from 'node:test' ;
3
+ import { bundler } from '../../source/bundler.entry-point.js' ;
4
+ import { loadPackageJson } from '../load-package-json.js' ;
5
5
import path from 'node:path' ;
6
6
7
7
test ( 'correctly resolves CommonJS files' , async ( ) => {
@@ -10,34 +10,34 @@ test('correctly resolves CommonJS files', async () => {
10
10
name : 'the-package-name' ,
11
11
version : '42.0.0' ,
12
12
sourcesFolder : path . join ( fixture , 'src' ) ,
13
- entryPoints : [ { js : path . join ( fixture , 'src/entry.js' ) } ] ,
14
- mainPackageJson : await loadPackageJson ( fixture )
13
+ entryPoints : [ { js : path . join ( fixture , 'src/entry.js' ) } ] ,
14
+ mainPackageJson : await loadPackageJson ( fixture ) ,
15
15
} ) ;
16
16
17
17
assert . deepStrictEqual ( result , {
18
18
packageJson : {
19
19
dependencies : { } ,
20
20
main : 'entry.js' ,
21
21
name : 'the-package-name' ,
22
- version : '42.0.0'
22
+ version : '42.0.0' ,
23
23
} ,
24
24
contents : [
25
25
{
26
26
kind : 'source' ,
27
27
source : '{\n "name": "the-package-name",\n "version": "42.0.0",\n "dependencies": {},\n "main": "entry.js"\n}' ,
28
- targetFilePath : 'package.json'
28
+ targetFilePath : 'package.json' ,
29
29
} ,
30
30
{
31
- kind : " reference" ,
31
+ kind : ' reference' ,
32
32
sourceFilePath : path . join ( fixture , 'src/entry.js' ) ,
33
- targetFilePath : 'entry.js'
33
+ targetFilePath : 'entry.js' ,
34
34
} ,
35
35
{
36
- kind : " reference" ,
36
+ kind : ' reference' ,
37
37
sourceFilePath : path . join ( fixture , 'src/foo.js' ) ,
38
- targetFilePath : 'foo.js'
38
+ targetFilePath : 'foo.js' ,
39
39
} ,
40
- ]
40
+ ] ,
41
41
} ) ;
42
42
} ) ;
43
43
@@ -47,8 +47,8 @@ test('correctly resolves ESM files', async () => {
47
47
name : 'the-package-name' ,
48
48
version : '42.0.0' ,
49
49
sourcesFolder : path . join ( fixture , 'src' ) ,
50
- entryPoints : [ { js : path . join ( fixture , 'src/entry.js' ) } ] ,
51
- mainPackageJson : await loadPackageJson ( fixture )
50
+ entryPoints : [ { js : path . join ( fixture , 'src/entry.js' ) } ] ,
51
+ mainPackageJson : await loadPackageJson ( fixture ) ,
52
52
} ) ;
53
53
54
54
assert . deepStrictEqual ( result , {
@@ -63,19 +63,19 @@ test('correctly resolves ESM files', async () => {
63
63
{
64
64
kind : 'source' ,
65
65
source : '{\n "name": "the-package-name",\n "version": "42.0.0",\n "dependencies": {},\n "main": "entry.js",\n "type": "module"\n}' ,
66
- targetFilePath : 'package.json'
66
+ targetFilePath : 'package.json' ,
67
67
} ,
68
68
{
69
- kind : " reference" ,
69
+ kind : ' reference' ,
70
70
sourceFilePath : path . join ( fixture , 'src/entry.js' ) ,
71
- targetFilePath : 'entry.js'
71
+ targetFilePath : 'entry.js' ,
72
72
} ,
73
73
{
74
- kind : " reference" ,
74
+ kind : ' reference' ,
75
75
sourceFilePath : path . join ( fixture , 'src/foo.js' ) ,
76
- targetFilePath : 'foo.js'
76
+ targetFilePath : 'foo.js' ,
77
77
} ,
78
- ]
78
+ ] ,
79
79
} ) ;
80
80
} ) ;
81
81
@@ -85,8 +85,8 @@ test('correctly resolves ESM files with export from statements', async () => {
85
85
name : 'the-package-name' ,
86
86
version : '42.0.0' ,
87
87
sourcesFolder : path . join ( fixture , 'src' ) ,
88
- entryPoints : [ { js : path . join ( fixture , 'src/entry.js' ) } ] ,
89
- mainPackageJson : await loadPackageJson ( fixture )
88
+ entryPoints : [ { js : path . join ( fixture , 'src/entry.js' ) } ] ,
89
+ mainPackageJson : await loadPackageJson ( fixture ) ,
90
90
} ) ;
91
91
92
92
assert . deepStrictEqual ( result , {
@@ -95,25 +95,25 @@ test('correctly resolves ESM files with export from statements', async () => {
95
95
main : 'entry.js' ,
96
96
name : 'the-package-name' ,
97
97
version : '42.0.0' ,
98
- type : 'module'
98
+ type : 'module' ,
99
99
} ,
100
100
contents : [
101
101
{
102
102
kind : 'source' ,
103
103
source : '{\n "name": "the-package-name",\n "version": "42.0.0",\n "dependencies": {},\n "main": "entry.js",\n "type": "module"\n}' ,
104
- targetFilePath : 'package.json'
104
+ targetFilePath : 'package.json' ,
105
105
} ,
106
106
{
107
- kind : " reference" ,
107
+ kind : ' reference' ,
108
108
sourceFilePath : path . join ( fixture , 'src/entry.js' ) ,
109
- targetFilePath : 'entry.js'
109
+ targetFilePath : 'entry.js' ,
110
110
} ,
111
111
{
112
- kind : " reference" ,
112
+ kind : ' reference' ,
113
113
sourceFilePath : path . join ( fixture , 'src/foo.js' ) ,
114
- targetFilePath : 'foo.js'
114
+ targetFilePath : 'foo.js' ,
115
115
} ,
116
- ]
116
+ ] ,
117
117
} ) ;
118
118
} ) ;
119
119
@@ -123,8 +123,8 @@ test('correctly resolves ESM files with plain import statements', async () => {
123
123
name : 'the-package-name' ,
124
124
version : '42.0.0' ,
125
125
sourcesFolder : path . join ( fixture , 'src' ) ,
126
- entryPoints : [ { js : path . join ( fixture , 'src/entry.js' ) } ] ,
127
- mainPackageJson : await loadPackageJson ( fixture )
126
+ entryPoints : [ { js : path . join ( fixture , 'src/entry.js' ) } ] ,
127
+ mainPackageJson : await loadPackageJson ( fixture ) ,
128
128
} ) ;
129
129
130
130
assert . deepStrictEqual ( result , {
@@ -133,24 +133,24 @@ test('correctly resolves ESM files with plain import statements', async () => {
133
133
main : 'entry.js' ,
134
134
name : 'the-package-name' ,
135
135
version : '42.0.0' ,
136
- type : 'module'
136
+ type : 'module' ,
137
137
} ,
138
138
contents : [
139
139
{
140
140
kind : 'source' ,
141
141
source : '{\n "name": "the-package-name",\n "version": "42.0.0",\n "dependencies": {},\n "main": "entry.js",\n "type": "module"\n}' ,
142
- targetFilePath : 'package.json'
142
+ targetFilePath : 'package.json' ,
143
143
} ,
144
144
{
145
- kind : " reference" ,
145
+ kind : ' reference' ,
146
146
sourceFilePath : path . join ( fixture , 'src/entry.js' ) ,
147
- targetFilePath : 'entry.js'
147
+ targetFilePath : 'entry.js' ,
148
148
} ,
149
149
{
150
- kind : " reference" ,
150
+ kind : ' reference' ,
151
151
sourceFilePath : path . join ( fixture , 'src/foo.js' ) ,
152
- targetFilePath : 'foo.js'
152
+ targetFilePath : 'foo.js' ,
153
153
} ,
154
- ]
154
+ ] ,
155
155
} ) ;
156
156
} ) ;
0 commit comments