Skip to content

Commit b83b912

Browse files
authored
Chore: [AEA-0000] - migrate jest to vitest (#2425)
## Summary - 🤖 Operational or Infrastructure Change ### Details - migrate jest to vitest
1 parent 169d8b3 commit b83b912

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2275
-5158
lines changed

.github/workflows/sam_package_code.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3434
run: |
3535
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> ~/.npmrc
36-
echo "@NHSDigital:registry=https://npm.pkg.github.com" >> ~/.npmrc
36+
echo "@nhsdigital:registry=https://npm.pkg.github.com" >> ~/.npmrc
3737
3838
- name: make install
3939
run: |

jest.default.config.ts

Lines changed: 0 additions & 39 deletions
This file was deleted.

package-lock.json

Lines changed: 1940 additions & 4782 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,16 @@
2727
"devDependencies": {
2828
"@eslint/js": "^10.0.1",
2929
"@types/aws-lambda": "^8.10.161",
30-
"@types/jest": "^30.0.0",
3130
"@types/node": "^25.3.5",
3231
"@typescript-eslint/eslint-plugin": "^8.56.1",
3332
"@typescript-eslint/parser": "^8.54.0",
3433
"eslint": "^10.0.2",
3534
"eslint-plugin-import-newlines": "^2.0.0",
3635
"globals": "^17.4.0",
37-
"jest": "^30.2.0",
38-
"jest-junit": "^16.0.0",
39-
"ts-jest": "^29.4.6",
4036
"ts-node": "^10.9.2",
41-
"typescript": "^5.9.3"
37+
"typescript": "^5.9.3",
38+
"vitest": "^3.2.4",
39+
"@vitest/coverage-v8": "^3.2.4"
4240
},
4341
"dependencies": {
4442
"esbuild": "^0.27.3"

packages/capabilityStatement/.vscode/launch.json

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,22 @@
11
{
2-
// Use IntelliSense to learn about possible attributes.
3-
// Hover to view descriptions of existing attributes.
4-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
52
"version": "0.2.0",
63
"configurations": [
74
{
85
"type": "node",
9-
"name": "vscode-jest-tests.v2",
6+
"name": "Vitest: Run current file",
107
"request": "launch",
8+
"program": "${workspaceFolder}/../../node_modules/vitest/vitest.mjs",
119
"args": [
12-
"--runInBand",
13-
"--watchAll=false",
14-
"--testNamePattern",
15-
"${jest.testNamePattern}",
16-
"--runTestsByPath",
17-
"${jest.testFile}",
10+
"run",
11+
"${file}",
1812
"--config",
19-
"${workspaceFolder}/jest.debug.config.ts"
13+
"${workspaceFolder}/vitest.config.ts"
2014
],
2115
"cwd": "${workspaceFolder}",
2216
"console": "integratedTerminal",
2317
"internalConsoleOptions": "neverOpen",
24-
"disableOptimisticBPs": true,
25-
"program": "${workspaceFolder}/../../node_modules/.bin/jest",
26-
"windows": {
27-
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
28-
},
2918
"env": {
30-
"POWERTOOLS_DEV": true,
31-
"NODE_OPTIONS": "--experimental-vm-modules"
19+
"POWERTOOLS_DEV": "true"
3220
}
3321
}
3422
]
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
{
2-
"jest.jestCommandLine": "/workspaces/prescriptionsforpatients/node_modules/.bin/jest --no-cache",
3-
"jest.nodeEnv": {
4-
"POWERTOOLS_DEV": true,
5-
"NODE_OPTIONS": "--experimental-vm-modules"
6-
}
2+
"vitest.commandLine": "POWERTOOLS_DEV=true /workspaces/prescriptionsforpatients/node_modules/.bin/vitest run --config vitest.config.ts"
73
}

packages/capabilityStatement/jest.config.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

packages/capabilityStatement/jest.debug.config.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

packages/capabilityStatement/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"license": "MIT",
88
"type": "module",
99
"scripts": {
10-
"unit": "POWERTOOLS_DEV=true NODE_OPTIONS=--experimental-vm-modules jest --no-cache --coverage",
10+
"unit": "POWERTOOLS_DEV=true vitest run --coverage --config vitest.config.ts",
1111
"lint": "eslint --max-warnings 0 --fix --config ../../eslint.config.mjs .",
1212
"compile": "tsc",
1313
"test": "npm run compile && npm run unit"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import {createVitestConfig} from "../../vitest.default.config"
2+
3+
export default createVitestConfig({
4+
workspaceRoot: "../../"
5+
})

0 commit comments

Comments
 (0)