Skip to content

Commit b03dfbd

Browse files
committed
test: convert tests to vitest
1 parent c8d257b commit b03dfbd

File tree

413 files changed

+2795
-2057
lines changed

Some content is hidden

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

413 files changed

+2795
-2057
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ generate-protocol-tests:
1111
./gradlew :smithy-typescript-protocol-test-codegen:build
1212
rm -rf ./private/smithy-rpcv2-cbor
1313
cp -r ./smithy-typescript-protocol-test-codegen/build/smithyprojections/smithy-typescript-protocol-test-codegen/smithy-rpcv2-cbor/typescript-codegen ./private/smithy-rpcv2-cbor
14-
cp ./packages/core/jest.config.js ./private/smithy-rpcv2-cbor
14+
cp ./packages/core/vitest.config.ts ./private/smithy-rpcv2-cbor/vitest.config.js
1515
node ./scripts/post-protocol-test-codegen
1616
npx prettier --write ./private/smithy-rpcv2-cbor
1717
yarn
1818

1919
test-protocols:
20-
(cd ./private/smithy-rpcv2-cbor && npx jest)
20+
(cd ./private/smithy-rpcv2-cbor && npx vitest run --globals)

package.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"build-test-packages": "./gradlew clean build && node ./scripts/build-generated-test-packages",
2323
"g:jest": "cd $INIT_CWD && jest",
2424
"g:karma": "cd $INIT_CWD && karma",
25-
"g:tsc": "cd $INIT_CWD && tsc"
25+
"g:tsc": "cd $INIT_CWD && tsc",
26+
"g:vitest": "cd $INIT_CWD && vitest"
2627
},
2728
"repository": {
2829
"type": "git",
@@ -45,6 +46,7 @@
4546
"eslint": "8.57.0",
4647
"eslint-plugin-simple-import-sort": "7.0.0",
4748
"eslint-plugin-tsdoc": "0.2.17",
49+
"happy-dom": "14.12.3",
4850
"husky": "^4.2.3",
4951
"jest": "29.7.0",
5052
"jest-environment-jsdom": "29.7.0",
@@ -59,9 +61,17 @@
5961
"ts-jest": "29.1.2",
6062
"turbo": "latest",
6163
"typescript": "~5.2.2",
64+
"vite": "4.5.5",
65+
"vitest": "0.34.6",
6266
"webpack": "5.91.0",
6367
"yarn": "1.22.22"
6468
},
69+
"overrides": {
70+
"vite": "4.5.5"
71+
},
72+
"resolutions": {
73+
"vite": "4.5.5"
74+
},
6575
"workspaces": [
6676
"packages/*",
6777
"smithy-typescript-ssdk-libs/*",

packages/abort-controller/jest.config.js

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

packages/abort-controller/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"lint": "eslint -c ../../.eslintrc.js \"src/**/*.ts\"",
1717
"format": "prettier --config ../../prettier.config.js --ignore-path ../.prettierignore --write \"**/*.{ts,md,json}\"",
1818
"extract:docs": "api-extractor run --local",
19-
"test": "yarn g:jest"
19+
"test": "yarn g:vitest run",
20+
"test:watch": "yarn g:vitest watch"
2021
},
2122
"author": {
2223
"name": "AWS SDK for JavaScript Team",

packages/abort-controller/src/AbortController.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { describe, expect,test as it } from "vitest";
2+
13
import { AbortController } from "./AbortController";
24
import { AbortSignal } from "./AbortSignal";
35

packages/abort-controller/src/AbortSignal.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { describe, expect,test as it, vi } from "vitest";
2+
13
import { AbortController } from "./AbortController";
24

35
describe("AbortSignal", () => {
@@ -13,7 +15,7 @@ describe("AbortSignal", () => {
1315
it("should invoke the onabort handler when the signal is aborted", () => {
1416
const controller = new AbortController();
1517
const { signal } = controller;
16-
const abortHandler = jest.fn();
18+
const abortHandler = vi.fn();
1719
signal.onabort = abortHandler;
1820
expect(abortHandler.mock.calls.length).toBe(0);
1921
controller.abort();
@@ -23,7 +25,7 @@ describe("AbortSignal", () => {
2325
it("should not invoke the onabort handler multiple time", () => {
2426
const controller = new AbortController();
2527
const { signal } = controller;
26-
const abortHandler = jest.fn();
28+
const abortHandler = vi.fn();
2729
signal.onabort = abortHandler;
2830
expect(abortHandler.mock.calls.length).toBe(0);
2931
controller.abort();
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { defineConfig } from "vitest/config";
2+
3+
export default defineConfig({
4+
test: {
5+
exclude: ["**/*.{integ,e2e,browser}.spec.ts"],
6+
include: ["**/*.spec.ts"],
7+
environment: "node",
8+
},
9+
});

packages/chunked-blob-reader-native/jest.config.js

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

packages/chunked-blob-reader-native/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo || exit 0",
1212
"lint": "eslint -c ../../.eslintrc.js \"src/**/*.ts\"",
1313
"format": "prettier --config ../../prettier.config.js --ignore-path ../.prettierignore --write \"**/*.{ts,md,json}\"",
14-
"test": "yarn g:jest"
14+
"test": "yarn g:vitest run",
15+
"test:watch": "yarn g:vitest watch"
1516
},
1617
"main": "./dist-cjs/index.js",
1718
"module": "./dist-es/index.js",

packages/chunked-blob-reader-native/src/index.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { describe, expect,test as it } from "vitest";
2+
13
import { blobReader } from "./index";
24

35
describe("blobReader", () => {

0 commit comments

Comments
 (0)