Skip to content

Commit da3ab0f

Browse files
committed
feat: support . in exports field
1 parent 3674bbf commit da3ab0f

26 files changed

Lines changed: 119 additions & 72 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
### Features
44

5+
- `[jest-resolver]` Support default export (`.`) in `exports` field _if_ `main` is missing ([#11919](https://github.com/facebook/jest/pull/11919))
6+
57
### Fixes
68

79
- `[jest-runtime]` Ensure absolute paths can be resolved within test modules ([11943](https://github.com/facebook/jest/pull/11943))

e2e/__tests__/resolveConditions.test.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,10 @@
77

88
import {resolve} from 'path';
99
import {onNodeVersions} from '@jest/test-utils';
10-
import {runYarnInstall} from '../Utils';
1110
import runJest from '../runJest';
1211

1312
const dir = resolve(__dirname, '..', 'resolve-conditions');
1413

15-
beforeAll(() => {
16-
runYarnInstall(dir);
17-
});
18-
1914
// The versions where vm.Module exists and commonjs with "exports" is not broken
2015
onNodeVersions('>=12.16.0', () => {
2116
test('resolves package exports correctly with custom resolver', () => {

e2e/resolve-conditions/__tests__/browser.test.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @jest-environment <rootDir>/browser-env.js
88
*/
99

10-
import {fn} from '../fake-dual-dep';
10+
import {fn} from 'fake-dual-dep';
1111

1212
test('returns correct message', () => {
1313
expect(fn()).toEqual('hello from browser');

e2e/resolve-conditions/__tests__/node.test.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @jest-environment <rootDir>/node-env.js
88
*/
99

10-
import {fn} from '../fake-dual-dep';
10+
import {fn} from 'fake-dual-dep';
1111

1212
test('returns correct message', () => {
1313
expect(fn()).toEqual('hello from node');

e2e/resolve-conditions/__tests__/resolveCjs.test.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
const {fn} = require('../fake-dep');
8+
const {fn} = require('fake-dep');
99

1010
test('returns correct message', () => {
1111
expect(fn()).toEqual('hello from CJS');

e2e/resolve-conditions/__tests__/resolveEsm.test.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
import {fn} from '../fake-dep';
8+
import {fn} from 'fake-dep';
99

1010
test('returns correct message', () => {
1111
expect(fn()).toEqual('hello from ESM');
File renamed without changes.
File renamed without changes.
File renamed without changes.

e2e/resolve-conditions/fake-dual-dep/browser.mjs renamed to e2e/resolve-conditions/node_modules/fake-dual-dep/browser.mjs

File renamed without changes.

0 commit comments

Comments
 (0)