Skip to content

Commit bc3c921

Browse files
authored
feat: support . in exports field (#11919)
1 parent b5aec03 commit bc3c921

File tree

26 files changed

+140
-74
lines changed

26 files changed

+140
-74
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
### Features
44

55
- `[jest-config]` Add `testEnvironmentOptions.html` to apply to jsdom input ([11950](https://github.com/facebook/jest/pull/11950))
6+
- `[jest-resolver]` Support default export (`.`) in `exports` field _if_ `main` is missing ([#11919](https://github.com/facebook/jest/pull/11919))
67

78
### Fixes
89

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');

0 commit comments

Comments
 (0)