Skip to content

Commit ab58deb

Browse files
committed
updating test libs
1 parent 73d0c12 commit ab58deb

File tree

28 files changed

+3402
-180
lines changed

28 files changed

+3402
-180
lines changed

jest.config.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
const { pathsToModuleNameMapper } = require('ts-jest');
2-
const { compilerOptions } = require('./tsconfig.json');
1+
import { pathsToModuleNameMapper } from 'ts-jest';
2+
import { readFileSync } from 'fs';
3+
4+
const tsconfig = JSON.parse(readFileSync('./tsconfig.json', 'utf8'));
35

46
const jestConfig = {
57
testEnvironment: 'jsdom',
68
rootDir: './',
79
setupFilesAfterEnv: ['<rootDir>/src/setupTests.ts'],
810
collectCoverageFrom: ['<rootDir>/src/**/*.{ts,tsx}'],
9-
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, {
11+
moduleNameMapper: pathsToModuleNameMapper(tsconfig.compilerOptions.paths, {
1012
prefix: '<rootDir>',
1113
}),
1214
transform: {
@@ -22,4 +24,4 @@ const jestConfig = {
2224
transformIgnorePatterns: ['node_modules/(?!nhsuk-frontend/packages)'],
2325
};
2426

25-
module.exports = jestConfig;
27+
export default jestConfig;

package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
},
4040
"devDependencies": {
4141
"@babel/core": "^7.24.1",
42+
"@babel/plugin-transform-modules-commonjs": "^7.27.1",
43+
"@babel/preset-env": "^7.28.3",
44+
"@babel/preset-react": "^7.27.1",
45+
"@babel/preset-typescript": "^7.27.1",
4246
"@eslint/js": "^9.36.0",
4347
"@rollup/plugin-commonjs": "^25.0.7",
4448
"@rollup/plugin-node-resolve": "^15.2.3",
@@ -47,7 +51,10 @@
4751
"@storybook/addon-docs": "9.1.3",
4852
"@storybook/addon-links": "^9.1.3",
4953
"@storybook/react-vite": "^9.1.3",
54+
"@testing-library/dom": "^10.4.1",
55+
"@testing-library/jest-dom": "^6.8.0",
5056
"@testing-library/react": "^16.3.0",
57+
"@types/babel__preset-env": "^7",
5158
"@types/eslint-plugin-jsx-a11y": "^6",
5259
"@types/jest": "^30.0.0",
5360
"@types/lodash": "^4",
@@ -65,8 +72,11 @@
6572
"eslint-plugin-react-hooks": "^5.2.0",
6673
"eslint-plugin-storybook": "9.1.3",
6774
"globals": "^16.4.0",
75+
"jest": "^30.1.3",
76+
"jest-environment-jsdom": "^30.1.2",
6877
"less": "^4.4.1",
6978
"nhsuk-frontend": "^9.0.1",
79+
"postcss": "^8.5.6",
7080
"react": "^19.1.1",
7181
"react-dom": "^19.1.1",
7282
"rollup": "^4.13.0",
@@ -79,6 +89,7 @@
7989
"sass-embedded": "^1.92.1",
8090
"storybook": "^9.1.3",
8191
"stylus": "^0.64.0",
92+
"ts-jest": "^29.4.4",
8293
"tslib": "^2.8.1",
8394
"typescript": "5.3.3",
8495
"vite": "^7.1.3",

src/components/content-presentation/details/__tests__/__snapshots__/Details.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`Details Details.ExpanderGroup matches snapshot: Details.ExpanderGroup 1`] = `
44
<div>

src/components/content-presentation/do-and-dont-list/__tests__/__snapshots__/DoAndDontList.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`DoAndDontList DoDontList.Item matches snapshot: DoDontList.Item 1`] = `
44
<div>

src/components/content-presentation/hero/__tests__/__snapshots__/Hero.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`Hero Hero.Heading matches snapshot: Hero.Heading 1`] = `
44
<div>

src/components/content-presentation/icons/__tests__/__snapshots__/Icons.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`Icons all icons match snapshots: ArrowLeft 1`] = `
44
<div>

src/components/content-presentation/images/__tests__/__snapshots__/Images.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`Images matches snapshot: Images 1`] = `
44
<div>

src/components/content-presentation/inset-text/__tests__/__snapshots__/InsetText.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`InsetText matches snapshot: InsetText 1`] = `
44
<div>

src/components/content-presentation/summary-list/__tests__/__snapshots__/SummaryList.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`SummaryList SummaryList.Actions matches snapshot 1`] = `
44
<div>

src/components/content-presentation/table/components/__tests__/__snapshots__/TableCaption.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`TableCaption matches snapshot 1`] = `
44
<div>

0 commit comments

Comments
 (0)