Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,569 changes: 1,379 additions & 190 deletions bun.lock

Large diffs are not rendered by default.

23 changes: 17 additions & 6 deletions docs/src/content/docs/guides/using-jest.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,27 @@ To get started with [Jest](https://jestjs.io), install the relevant packages usi

<Tabs>
<TabItem label="npm" icon="npm">
<Code lang="shell" code="npm i -D jest @types/jest @types/node ts-jest" />
<Code
lang="shell"
code="npm i -D jest @types/jest @types/node @swc/core @swc/jest"
/>
</TabItem>
<TabItem label="pnpm" icon="pnpm">
<Code lang="shell" code="pnpm i -D jest @types/jest @types/node ts-jest" />
<Code
lang="shell"
code="pnpm i -D jest @types/jest @types/node @swc/core @swc/jest"
/>
</TabItem>
<TabItem label="bun" icon="bun">
<Code lang="shell" code="bun add -d jest @types/jest @types/node ts-jest" />
<Code
lang="shell"
code="bun add -d jest @types/jest @types/node @swc/core @swc/jest"
/>
</TabItem>
<TabItem label="yarn" icon="seti:yarn">
<Code
lang="shell"
code="yarn add -D jest @types/jest @types/node ts-jest"
code="yarn add -D jest @types/jest @types/node @swc/core @swc/jest"
/>
</TabItem>
</Tabs>
Expand Down Expand Up @@ -76,7 +85,9 @@ import type { Config } from 'jest';

const config: Config = {
watch: false,
preset: 'ts-jest/presets/js-with-ts',
transform: {
'^.+\\.(t|j)sx?$': '@swc/jest',
},
testEnvironment: 'node',
globalSetup: '<rootDir>/global-setup.ts',
globalTeardown: '<rootDir>/global-teardown.ts',
Expand All @@ -86,7 +97,7 @@ const config: Config = {
export default config;
```

You can also check out the official the [`ts-jest` documentation](https://kulshekhar.github.io/ts-jest/docs/) for more information on configuring this file.
You can also check out the official the [`@swc/jest` documentation](https://swc.rs/docs/usage/jest) for more information on configuring this file.

Then, add a `test` script to your `package.json`:

Expand Down
4 changes: 3 additions & 1 deletion examples/clock/tests/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import type { Config } from 'jest';

const config: Config = {
watch: false,
preset: 'ts-jest/presets/js-with-ts',
transform: {
'^.+\\.(t|j)sx?$': '@swc/jest',
},
testEnvironment: 'node',
globalSetup: '<rootDir>/global-setup.ts',
globalTeardown: '<rootDir>/global-teardown.ts',
Expand Down
4 changes: 3 additions & 1 deletion examples/google_search/tests/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import type { Config } from 'jest';

const config: Config = {
watch: false,
preset: 'ts-jest/presets/js-with-ts',
transform: {
'^.+\\.(t|j)sx?$': '@swc/jest',
},
testEnvironment: 'node',
globalSetup: '<rootDir>/global-setup.ts',
globalTeardown: '<rootDir>/global-teardown.ts',
Expand Down
4 changes: 3 additions & 1 deletion examples/icp_features/tests/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import type { Config } from 'jest';

const config: Config = {
watch: false,
preset: 'ts-jest/presets/js-with-ts',
transform: {
'^.+\\.(t|j)sx?$': '@swc/jest',
},
testEnvironment: 'node',
globalSetup: '<rootDir>/global-setup.ts',
globalTeardown: '<rootDir>/global-teardown.ts',
Expand Down
4 changes: 3 additions & 1 deletion examples/multicanister/tests/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import type { Config } from 'jest';

const config: Config = {
watch: false,
preset: 'ts-jest/presets/js-with-ts',
transform: {
'^.+\\.(t|j)sx?$': '@swc/jest',
},
testEnvironment: 'node',
globalSetup: '<rootDir>/global-setup.ts',
globalTeardown: '<rootDir>/global-teardown.ts',
Expand Down
4 changes: 3 additions & 1 deletion examples/nns_proxy/tests/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import type { Config } from 'jest';

const config: Config = {
watch: false,
preset: 'ts-jest/presets/js-with-ts',
transform: {
'^.+\\.(t|j)sx?$': '@swc/jest',
},
testEnvironment: 'node',
globalSetup: '<rootDir>/global-setup.ts',
globalTeardown: '<rootDir>/global-teardown.ts',
Expand Down
4 changes: 3 additions & 1 deletion examples/todo/tests/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import type { Config } from 'jest';

const config: Config = {
watch: false,
preset: 'ts-jest/presets/js-with-ts',
transform: {
'^.+\\.(t|j)sx?$': '@swc/jest',
},
testEnvironment: 'node',
globalSetup: '<rootDir>/global-setup.ts',
globalTeardown: '<rootDir>/global-teardown.ts',
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,15 @@
"@dfinity/candid": "^3.2.4",
"@dfinity/identity": "^3.2.4",
"@dfinity/principal": "^3.2.4",
"@swc/core": "^1.15.3",
"@swc/jest": "^0.2.39",
"@tsconfig/node24": "^24.0.3",
"@types/jest": "^29.5.14",
"@types/node": "^22.13.10",
"bip39": "^3.1.0",
"jest": "^29.7.0",
"jest": "^30.2.0",
"npm-run-all": "^4.1.5",
"prettier": "3.4.1",
"ts-jest": "^29.2.6",
"ts-node": "^10.9.2",
"typescript": "^5.8.2",
"vitest": "^4.0.15"
Expand Down
7 changes: 3 additions & 4 deletions packages/pic/jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import type { Config } from 'jest';
import { createJsWithTsPreset } from 'ts-jest';

const config: Config = {
...createJsWithTsPreset({
tsconfig: '<rootDir>/tsconfig.test.json',
}),
transform: {
'^.+\\.(t|j)sx?$': '@swc/jest',
},
watch: false,
testEnvironment: 'node',
globalSetup: '<rootDir>/tests/global-setup.ts',
Expand Down
Loading