Skip to content

Commit 474d962

Browse files
task: setup testing (#58)
* task: setup testing Signed-off-by: Carlos Feria <[email protected]> * Enable ci.yaml in rekor-migration branch --------- Signed-off-by: Carlos Feria <[email protected]>
1 parent 2356b29 commit 474d962

File tree

7 files changed

+1300
-25
lines changed

7 files changed

+1300
-25
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
pull_request:
88
branches:
99
- "main"
10+
- "rekor-migration"
1011
workflow_dispatch:
1112
workflow_call:
1213

client/package.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"format:fix": "prettier --write './src/**/*.{ts,tsx,js,json}'",
1515
"start:dev": "npm run generate && vite --port 3000",
1616
"start": "vite preview",
17+
"test": "vitest",
1718
"generate": "openapi-ts -f ./config/openapi-ts.config.ts",
1819
"preview": "vite preview"
1920
},
@@ -24,15 +25,15 @@
2425
"@patternfly/react-core": "^6.2.0",
2526
"@patternfly/react-table": "^6.2.0",
2627
"@patternfly/react-tokens": "^6.2.0",
28+
"@peculiar/x509": "1.8.4",
2729
"@tanstack/react-query": "^5.61.0",
2830
"@tanstack/react-query-devtools": "^5.85.0",
29-
"@peculiar/x509": "1.8.4",
3031
"axios": "^1.7.2",
3132
"dayjs": "^1.11.7",
32-
"js-yaml": "^4.1.0",
3333
"file-saver": "^2.0.5",
34-
"oidc-client-ts": "^2.4.0",
34+
"js-yaml": "^4.1.0",
3535
"next": "^14.2.29",
36+
"oidc-client-ts": "^2.4.0",
3637
"pvtsutils": "^1.3.6",
3738
"react": "^18.2.0",
3839
"react-dom": "^18.2.0",
@@ -46,15 +47,20 @@
4647
},
4748
"devDependencies": {
4849
"@hey-api/openapi-ts": "^0.80.9",
50+
"@testing-library/jest-dom": "^6.9.1",
4951
"@testing-library/react": "^16.0.0",
5052
"@types/file-saver": "^2.0.2",
5153
"@types/react": "^18.2.0",
5254
"@types/react-dom": "^18.2.0",
5355
"@vitejs/plugin-react": "^5.0.0",
56+
"@vitest/browser": "^3.2.4",
57+
"jsdom": "^27.0.0",
5458
"typescript": "^5.8.3",
5559
"vite": "^7.1.2",
5660
"vite-plugin-ejs": "^1.7.0",
57-
"vite-plugin-static-copy": "^3.1.1"
61+
"vite-plugin-static-copy": "^3.1.1",
62+
"vitest": "^3.2.4",
63+
"vitest-browser-react": "^1.0.1"
5864
},
5965
"browserslist": {
6066
"production": [

client/test-setup.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { expect } from "vitest";
2+
import * as matchers from "@testing-library/jest-dom/matchers";
3+
4+
// // Add jest-dom matchers to Vitest's expect
5+
expect.extend(matchers);

client/tsconfig.node.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@
2121
"noFallthroughCasesInSwitch": true,
2222
"noUncheckedSideEffectImports": true
2323
},
24-
"include": ["vite.config.ts"]
24+
"include": ["vite.config.ts", "test-setup.ts"]
2525
}

client/vite.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/// <reference types="vitest/config" />
2+
13
import fs from "fs";
24
import { createRequire } from "module";
35
import path from "path";
@@ -91,4 +93,9 @@ export default defineConfig({
9193
},
9294
},
9395
},
96+
test: {
97+
globals: true,
98+
environment: "jsdom",
99+
setupFiles: "./test-setup.ts",
100+
},
94101
});

0 commit comments

Comments
 (0)