Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit b9cc97e

Browse files
committed
(feat): export all jest globals as named exports
- have to use some hacky renaming so that TS doesn't give errors
1 parent 321054d commit b9cc97e

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/index.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
const jestWG = jest
2+
const expectWG = expect
3+
// Jest's list of globals: https://jestjs.io/docs/en/api
4+
const afterAllWG = afterAll
5+
const afterEachWG = afterEach
6+
const beforeAllWG = beforeAll
7+
const beforeEachWG = beforeEach
8+
const describeWG = describe
9+
const fdescribeWG = fdescribe // alias for describe.only
10+
const xdescribeWG = xdescribe // alias for describe.skip
11+
const testWG = test
12+
const itWG = it // alias for test
13+
const fitWG = fit // alias for it.only
14+
const xtestWG = xtest // alias for test.skip
15+
const xitWG = xit // alias for it.skip
16+
17+
// all this renamiWG is a workaround for the TS2661 error: "Cannot re-export name that is not defined in the module"
18+
export { jestWG as jest }
19+
export { expectWG as expect }
20+
export { afterAllWG as afterAll }
21+
export { afterEachWG as afterEach }
22+
export { beforeAllWG as beforeAll }
23+
export { beforeEachWG as beforeEach }
24+
export { describeWG as describe }
25+
export { fdescribeWG as fdescribe } // alias for describe.only
26+
export { xdescribeWG as xdescribe } // alias for describe.skip
27+
export { testWG as test }
28+
export { itWG as it } // alias for test
29+
export { fitWG as fit } // alias for it.only
30+
export { xtestWG as xtest } // alias for test.skip
31+
export { xitWG as xit } // alias for it.skip

0 commit comments

Comments
 (0)