Skip to content

Commit 9c8d726

Browse files
committed
Fixes a couple more status check order
1 parent 3d8f46d commit 9c8d726

3 files changed

Lines changed: 40 additions & 40 deletions

File tree

test/es-module/test-esm-package-map.mjs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe('ESM: --experimental-package-map', () => {
4040
], { cwd: fixtures.path('package-map/root') });
4141

4242
assert.match(stdout, /dep-a-value/);
43-
assert.strictEqual(code, 0);
43+
assert.strictEqual(code, 0, stderr);
4444
});
4545

4646
it('resolves a subpath export', async () => {
@@ -51,8 +51,8 @@ describe('ESM: --experimental-package-map', () => {
5151
`import util from 'dep-a/lib/util'; console.log(util);`,
5252
], { cwd: fixtures.path('package-map/root') });
5353

54-
assert.strictEqual(code, 0, stderr);
5554
assert.match(stdout, /dep-a-util/);
55+
assert.strictEqual(code, 0, stderr);
5656
});
5757

5858
it('resolves transitive dependency from allowed package', async () => {
@@ -64,8 +64,8 @@ describe('ESM: --experimental-package-map', () => {
6464
`import depB from 'dep-b'; console.log(depB);`,
6565
], { cwd: fixtures.path('package-map/root') });
6666

67-
assert.strictEqual(code, 0, stderr);
6867
assert.match(stdout, /dep-b using dep-a-value/);
68+
assert.strictEqual(code, 0, stderr);
6969
});
7070
});
7171

@@ -80,8 +80,8 @@ describe('ESM: --experimental-package-map', () => {
8080
`import fs from 'node:fs'; console.log(typeof fs.readFileSync);`,
8181
], { cwd: fixtures.path('package-map/root') });
8282

83-
assert.strictEqual(code, 0, stderr);
8483
assert.match(stdout, /function/);
84+
assert.strictEqual(code, 0, stderr);
8585
});
8686

8787
it('throws when parent not in map', async () => {
@@ -92,8 +92,8 @@ describe('ESM: --experimental-package-map', () => {
9292
`import dep from 'dep-a'; console.log(dep);`,
9393
], { cwd: '/tmp' }); // Not in any mapped package
9494

95-
assert.notStrictEqual(code, 0);
9695
assert.match(stderr, /ERR_PACKAGE_MAP_EXTERNAL_FILE/);
96+
assert.notStrictEqual(code, 0, stderr);
9797
});
9898
});
9999

@@ -108,8 +108,8 @@ describe('ESM: --experimental-package-map', () => {
108108
'--eval', `import x from 'dep-a';`,
109109
], { cwd: fixtures.path('package-map/root') });
110110

111-
assert.notStrictEqual(code, 0);
112111
assert.match(stderr, /ERR_PACKAGE_MAP_INVALID/);
112+
assert.notStrictEqual(code, 0, stderr);
113113
});
114114

115115
it('throws ERR_PACKAGE_MAP_INVALID for missing packages field', async () => {
@@ -120,9 +120,9 @@ describe('ESM: --experimental-package-map', () => {
120120
'--eval', `import x from 'dep-a';`,
121121
], { cwd: fixtures.path('package-map/root') });
122122

123-
assert.notStrictEqual(code, 0);
124123
assert.match(stderr, /ERR_PACKAGE_MAP_INVALID/);
125124
assert.match(stderr, /packages/);
125+
assert.notStrictEqual(code, 0, stderr);
126126
});
127127

128128
it('throws ERR_PACKAGE_MAP_KEY_NOT_FOUND for undefined dependency key', async () => {
@@ -134,8 +134,8 @@ describe('ESM: --experimental-package-map', () => {
134134
`import x from 'nonexistent';`,
135135
], { cwd: fixtures.path('package-map/root') });
136136

137-
assert.notStrictEqual(code, 0);
138137
assert.match(stderr, /ERR_PACKAGE_MAP_KEY_NOT_FOUND/);
138+
assert.notStrictEqual(code, 0, stderr);
139139
});
140140

141141
it('throws for non-existent map file', async () => {
@@ -145,9 +145,9 @@ describe('ESM: --experimental-package-map', () => {
145145
'--eval', `import x from 'dep-a';`,
146146
], { cwd: fixtures.path('package-map/root') });
147147

148-
assert.notStrictEqual(code, 0);
149148
assert.match(stderr, /ERR_PACKAGE_MAP_INVALID/);
150149
assert.match(stderr, /not found/);
150+
assert.notStrictEqual(code, 0, stderr);
151151
});
152152

153153
it('throws ERR_PACKAGE_MAP_INVALID for unsupported URL scheme in path', async () => {
@@ -158,10 +158,10 @@ describe('ESM: --experimental-package-map', () => {
158158
'--eval', `import x from 'dep-a';`,
159159
], { cwd: fixtures.path('package-map/root') });
160160

161-
assert.notStrictEqual(code, 0);
162161
assert.match(stderr, /ERR_PACKAGE_MAP_INVALID/);
163162
assert.match(stderr, /unsupported URL scheme/);
164163
assert.match(stderr, /https:\/\//);
164+
assert.notStrictEqual(code, 0, stderr);
165165
});
166166

167167
it('accepts file:// URLs in path', async () => {
@@ -172,8 +172,8 @@ describe('ESM: --experimental-package-map', () => {
172172
`import dep from 'dep-a'; console.log(dep);`,
173173
], { cwd: fixtures.path('package-map/root') });
174174

175-
assert.strictEqual(code, 0, stderr);
176175
assert.match(stdout, /dep-a-value/);
176+
assert.strictEqual(code, 0, stderr);
177177
});
178178

179179
it('throws ERR_PACKAGE_MAP_INVALID for duplicate package paths', async () => {
@@ -184,10 +184,10 @@ describe('ESM: --experimental-package-map', () => {
184184
'--eval', `import x from 'dep-a';`,
185185
], { cwd: fixtures.path('package-map/root') });
186186

187-
assert.notStrictEqual(code, 0);
188187
assert.match(stderr, /ERR_PACKAGE_MAP_INVALID/);
189188
assert.match(stderr, /pkg-a/);
190189
assert.match(stderr, /pkg-b/);
190+
assert.notStrictEqual(code, 0, stderr);
191191
});
192192
});
193193

@@ -201,8 +201,8 @@ describe('ESM: --experimental-package-map', () => {
201201
`import fs from 'node:fs'; console.log('ok');`,
202202
]);
203203

204-
assert.strictEqual(code, 0, stderr);
205204
assert.match(stdout, /ok/);
205+
assert.strictEqual(code, 0, stderr);
206206
});
207207
});
208208

@@ -217,8 +217,8 @@ describe('ESM: --experimental-package-map', () => {
217217
`import { format } from 'dep-a'; console.log(format);`,
218218
], { cwd: fixtures.path('package-map/root') });
219219

220-
assert.strictEqual(code, 0, stderr);
221220
assert.match(stdout, /esm/); // Should get ESM export
221+
assert.strictEqual(code, 0, stderr);
222222
});
223223

224224
it('respects pattern exports', async () => {
@@ -229,8 +229,8 @@ describe('ESM: --experimental-package-map', () => {
229229
`import util from 'dep-a/lib/util'; console.log(util);`,
230230
], { cwd: fixtures.path('package-map/root') });
231231

232-
assert.strictEqual(code, 0, stderr);
233232
assert.match(stdout, /dep-a-util/);
233+
assert.strictEqual(code, 0, stderr);
234234
});
235235
});
236236

@@ -245,9 +245,9 @@ describe('ESM: --experimental-package-map', () => {
245245
`import dep from 'dep-a';`,
246246
], { cwd: fixtures.path('package-map/root') });
247247

248-
assert.strictEqual(code, 0);
249248
assert.match(stderr, /ExperimentalWarning/);
250249
assert.match(stderr, /Package map/i);
250+
assert.strictEqual(code, 0, stderr);
251251
});
252252
});
253253

@@ -266,8 +266,8 @@ describe('ESM: --experimental-package-map', () => {
266266
`import pkg from 'pkg'; console.log(pkg);`,
267267
], { cwd: fixtures.path('package-map/pkg-other') });
268268

269-
assert.strictEqual(code, 0, stderr);
270269
assert.match(stdout, /pkg-value/);
270+
assert.strictEqual(code, 0, stderr);
271271
});
272272
});
273273

@@ -283,8 +283,8 @@ describe('ESM: --experimental-package-map', () => {
283283
`import dep from 'dep-a'; console.log(dep);`,
284284
], { cwd: fixtures.path('package-map/nested-project/src') });
285285

286-
assert.strictEqual(code, 0, stderr);
287286
assert.match(stdout, /dep-a-value/);
287+
assert.strictEqual(code, 0, stderr);
288288
});
289289
});
290290

@@ -303,9 +303,9 @@ describe('ESM: --experimental-package-map', () => {
303303
`import app18 from 'app-18'; import app19 from 'app-19'; console.log(app18); console.log(app19);`,
304304
], { cwd: fixtures.path('package-map/root') });
305305

306-
assert.strictEqual(code, 0, stderr);
307306
assert.match(stdout, /app-18 using react 18/);
308307
assert.match(stdout, /app-19 using react 19/);
308+
assert.strictEqual(code, 0, stderr);
309309
});
310310
});
311311

@@ -325,8 +325,8 @@ describe('ESM: --experimental-package-map', () => {
325325
`import inner from 'inner'; console.log(inner);`,
326326
], { cwd: fixtures.path('package-map/root') });
327327

328-
assert.strictEqual(code, 0, stderr);
329328
assert.match(stdout, /inner using dep-a-value/);
329+
assert.strictEqual(code, 0, stderr);
330330
});
331331

332332
it('falls back for undeclared dependency in nested package parent', async () => {
@@ -339,8 +339,8 @@ describe('ESM: --experimental-package-map', () => {
339339
`import dep from 'dep-a';`,
340340
], { cwd: fixtures.path('package-map/root') });
341341

342-
assert.notStrictEqual(code, 0);
343342
assert.match(stderr, /ERR_MODULE_NOT_FOUND/);
343+
assert.notStrictEqual(code, 0, stderr);
344344
});
345345
});
346346
});

test/parallel/test-package-map-cli.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe('--experimental-package-map CLI behavior', () => {
4141

4242
assert.match(stderr, /ExperimentalWarning/);
4343
assert.match(stderr, /[Pp]ackage map/);
44-
assert.strictEqual(status, 0);
44+
assert.strictEqual(status, 0, stderr);
4545
});
4646

4747
it('accepts relative path', () => {
@@ -79,9 +79,9 @@ describe('--experimental-package-map CLI behavior', () => {
7979
encoding: 'utf8',
8080
});
8181

82-
assert.strictEqual(status, 0);
8382
assert.doesNotMatch(stderr, /ExperimentalWarning/);
8483
assert.doesNotMatch(stderr, /[Pp]ackage map/);
84+
assert.strictEqual(status, 0, stderr);
8585
});
8686

8787
it('can be combined with other flags', () => {

0 commit comments

Comments
 (0)