Skip to content

Commit

Permalink
chore(test): jest to vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
watany-dev committed Dec 21, 2023
1 parent 4f88db6 commit a01ce40
Show file tree
Hide file tree
Showing 4 changed files with 596 additions and 18 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@nx/workspace": "^16.10.0",
"@types/node": "18.11.19",
"@types/prettier": "2.6.0",
"@vitest/coverage-v8": "^1.1.0",
"@yarnpkg/lockfile": "^1.1.0",
"aws-sdk-js-codemod": "^0.28.2",
"cdk-generate-synthetic-examples": "^0.1.299",
Expand All @@ -36,7 +37,8 @@
"standard-version": "^9.5.0",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.2",
"typescript": "~5.1.6"
"typescript": "~5.1.6",
"vitest": "^1.1.0"
},
"resolutions": {
"colors": "1.4.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
MachineImage,
Vpc,
} from '../../lib';
import { Vitest, vi } from 'vitest';

describe('RequireImdsv2Aspect', () => {
let app: cdk.App;
Expand All @@ -29,7 +30,7 @@ describe('RequireImdsv2Aspect', () => {
suppressWarnings: true,
});
const errmsg = 'ERROR';
const visitMock = jest.spyOn(aspect, 'visit').mockImplementation((node) => {
const visitMock = vi.spyOn(aspect, 'visit').mockImplementation((node) => {
// @ts-ignore
aspect.warn(node, errmsg);
});
Expand Down
12 changes: 12 additions & 0 deletions packages/aws-cdk-lib/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig } from 'vitest/config';

export default defineConfig({
test: {
include: ['**/test/**/*.(test).ts'],
globals: true,
coverage: {
provider: 'v8',
reporter: ['text'],
},
},
});
Loading

0 comments on commit a01ce40

Please sign in to comment.