Skip to content

Commit

Permalink
Replace jest with vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerlong committed Jan 27, 2025
1 parent 81da095 commit e311ff7
Show file tree
Hide file tree
Showing 12 changed files with 593 additions and 4,774 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"compile": "lerna exec tsc --scope=@rc-ex/core && lerna exec tsc --no-private --ignore=@rc-ex/core && lerna exec 'cp -r src lib' --no-private",
"prepublishOnly": "yarn reset && yarn compile",
"reset": "lerna exec 'rm -rf lib' && yarn delete-js",
"test": "yarn workspace @rc-ex/test run jest -w 1 --detectOpenHandles -c jest.config.ts $t",
"test": "yarn workspace @rc-ex/test run vitest",
"upgrade-all": "yarn-upgrade-all -W && yarn workspaces run yarn-upgrade-all && yarn install",
"delete-js": "find . -type f \\( -name \"*.js\" -o -name \"*.d.ts\" -o -name \"*.js.map\" \\) -not -path \"*/node_modules/*\" -exec rm -f {} +"
},
Expand Down
2 changes: 1 addition & 1 deletion test/events-extension.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import EventsExtension, { Events } from "@rc-ex/events";
import Utils from "@rc-ex/core/src/Utils.js";
import Utils from "@rc-ex/core/src/Utils";

import ReusableRestClient from "./reusable-rest-client";

Expand Down
2 changes: 1 addition & 1 deletion test/exceptions.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { RestResponse } from "@rc-ex/core/src/types";
import RestException from "@rc-ex/core/src/RestException.js";
import RestException from "@rc-ex/core/src/RestException";

import ReusableRestClient from "./reusable-rest-client";

Expand Down
2 changes: 1 addition & 1 deletion test/fax.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type CreateFaxMessageRequest from "@rc-ex/core/src/definitions/CreateFaxMessageRequest";
import type Attachment from "@rc-ex/core/src/definitions/Attachment";
import type FaxResponse from "@rc-ex/core/src/definitions/FaxResponse";
import Utils from "@rc-ex/core/src/Utils.js";
import Utils from "@rc-ex/core/src/Utils";
import fs from "fs";
import path from "path";

Expand Down
8 changes: 0 additions & 8 deletions test/jest.config.ts

This file was deleted.

2 changes: 1 addition & 1 deletion test/low-level-api.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Utils from "@rc-ex/core/src/Utils.js";
import Utils from "@rc-ex/core/src/Utils";
import type FaxResponse from "@rc-ex/core/src/definitions/FaxResponse";
import type GetSMSMessageInfoResponse from "@rc-ex/core/src/definitions/GetSMSMessageInfoResponse";
import fs from "fs";
Expand Down
7 changes: 2 additions & 5 deletions test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,9 @@
"@rc-ex/rcsdk": "file:../packages/extensions/rcsdk",
"@rc-ex/ws": "file:../packages/extensions/ws",
"@ringcentral/sdk": "^5.0.3",
"@types/jest": "^29.5.14",
"dotenv-override-true": "^6.2.2",
"jest": "^29.7.0",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"wait-for-async": "^0.7.9",
"winston": "^3.17.0"
"winston": "^3.17.0",
"vitest": "^3.0.4"
}
}
13 changes: 13 additions & 0 deletions test/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
globals: true,
environment: "node", // Test environment
setupFiles: "dotenv-override-true/config", // Optional setup file
maxWorkers: 1,
minWorkers: 1,
testTimeout: 64000,
watch: false,
},
});
2 changes: 0 additions & 2 deletions test/ws-extension/auto-recover.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import WebSocketExtension from "@rc-ex/ws";
import waitFor from "wait-for-async";
import ReusableRestClient from "../reusable-rest-client";

jest.setTimeout(999999999);

describe("WebSocket", () => {
test("auto recover", async () => {
const rc = await ReusableRestClient.getInstance();
Expand Down
2 changes: 0 additions & 2 deletions test/ws-extension/session-recovery.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import WebSocketExtension from "@rc-ex/ws";
import waitFor from "wait-for-async";
import ReusableRestClient from "../reusable-rest-client";

jest.setTimeout(99999999); // to test recover failed

describe("WebSocket session recovery", () => {
test("default ", async () => {
const rc = await ReusableRestClient.getInstance();
Expand Down
Loading

0 comments on commit e311ff7

Please sign in to comment.