Skip to content

Commit 9c1abbb

Browse files
committed
chore: move test into describe block
1 parent ef1d106 commit 9c1abbb

File tree

1 file changed

+27
-25
lines changed

1 file changed

+27
-25
lines changed

packages/jest-resolve/src/__tests__/resolve.test.ts

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -356,38 +356,40 @@ describe('findNodeModule', () => {
356356
);
357357
});
358358

359-
test('supports array pattern - resolve to first found', () => {
360-
const result = Resolver.findNodeModule('#array-import', {
361-
basedir: path.resolve(importsRoot, './array-import/index.cjs'),
362-
conditions: ['import'],
359+
describe('supports array pattern', () => {
360+
test('resolve to first found', () => {
361+
const result = Resolver.findNodeModule('#array-import', {
362+
basedir: path.resolve(importsRoot, './array-import/index.cjs'),
363+
conditions: ['import'],
364+
});
365+
366+
expect(result).toEqual(
367+
path.resolve(importsRoot, './array-import/node.mjs'),
368+
);
363369
});
364370

365-
expect(result).toEqual(
366-
path.resolve(importsRoot, './array-import/node.mjs'),
367-
);
368-
});
371+
test('ignore not exist internal file', () => {
372+
const result = Resolver.findNodeModule('#array-import', {
373+
basedir: path.resolve(importsRoot, './array-import/index.cjs'),
374+
conditions: ['browser'],
375+
});
369376

370-
test('supports array pattern - ignore not exist internal file', () => {
371-
const result = Resolver.findNodeModule('#array-import', {
372-
basedir: path.resolve(importsRoot, './array-import/index.cjs'),
373-
conditions: ['browser'],
377+
expect(result).toEqual(
378+
path.resolve(importsRoot, './array-import/browser.cjs'),
379+
);
374380
});
375381

376-
expect(result).toEqual(
377-
path.resolve(importsRoot, './array-import/browser.cjs'),
378-
);
379-
});
382+
test('ignore not exist external module', () => {
383+
// this is for optional dependency
384+
const result = Resolver.findNodeModule('#array-import', {
385+
basedir: path.resolve(importsRoot, './array-import/index.cjs'),
386+
conditions: ['require'],
387+
});
380388

381-
test('supports array pattern - ignore not exist external module', () => {
382-
// this is for optional dependency
383-
const result = Resolver.findNodeModule('#array-import', {
384-
basedir: path.resolve(importsRoot, './array-import/index.cjs'),
385-
conditions: ['require'],
389+
expect(result).toEqual(
390+
path.resolve(importsRoot, './array-import/node.cjs'),
391+
);
386392
});
387-
388-
expect(result).toEqual(
389-
path.resolve(importsRoot, './array-import/node.cjs'),
390-
);
391393
});
392394

393395
test('fails for non-existent mapping', () => {

0 commit comments

Comments
 (0)