Skip to content

Commit

Permalink
- jest to vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
RolginRoman committed Sep 3, 2024
1 parent c6a5ffd commit daaa89a
Show file tree
Hide file tree
Showing 14 changed files with 814 additions and 1,463 deletions.
16 changes: 1 addition & 15 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
{
"version": "1.0.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest: current file",
//"env": { "NODE_ENV": "test" },
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["${fileBasenameNoExtension}", "--config", "jest.config.js"],
"console": "integratedTerminal",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
}
}
]
"configurations": []
}
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,13 @@
},
"devDependencies": {
"@types/eslint": "^8.56.3",
"@types/jest": "29.2.4",
"eslint": "^8.56.0",
"husky": "^8.0.0",
"jest": "^29.7.0",
"lerna": "7.1.4",
"lint-staged": "^13.1.0",
"ts-jest": "^29.1.1",
"typedoc": "0.25.11",
"typescript": "^5.3.3"
"typescript": "^5.3.3",
"vitest": "^2.0.5"
},
"version": "4.0.1",
"workspaces": [
Expand Down
3 changes: 0 additions & 3 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@
"devDependencies": {
"@streamflow/eslint-config": "workspace:*",
"@types/bn.js": "5.1.1",
"@types/jest": "29.2.4",
"date-fns": "2.28.0",
"jest": "29.3.1",
"ts-jest": "29.0.3",
"typescript": "^4.9.5"
},
"dependencies": {
Expand Down
3 changes: 0 additions & 3 deletions packages/distributor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@
"devDependencies": {
"@streamflow/eslint-config": "workspace:*",
"@types/bn.js": "5.1.1",
"@types/jest": "29.2.4",
"date-fns": "2.28.0",
"jest": "29.3.1",
"ts-jest": "29.0.3",
"typescript": "^4.9.5"
},
"dependencies": {
Expand Down
4 changes: 1 addition & 3 deletions packages/eslint-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
module.exports = {
extends: [
"airbnb-typescript",
"plugin:jest/recommended",
"plugin:import/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
],
plugins: ["@typescript-eslint", "jest", "import"],
plugins: ["@typescript-eslint", "import"],
env: {
browser: true,
es6: true,
jest: true,
},
parser: "@typescript-eslint/parser",
parserOptions: {
Expand Down
1 change: 0 additions & 1 deletion packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"eslint": "^8.56.0",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-prettier": "^5.1.3",
"prettier": "^3.2.5"
}
Expand Down
11 changes: 6 additions & 5 deletions packages/stream/__tests__/aptos/streamClient.spec.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { BN } from "bn.js";
import { describe, expect, test, beforeEach, vi } from "vitest";

import AptosStreamClient from "../../aptos/StreamClient";
import { ICluster } from "../../common/types";
import AptosStreamClient from "../../aptos/StreamClient.js";
import { ICluster } from "../../common/types.js";

describe("AptosStreamClient", () => {
describe("init", () => {
it("should successfully create AptosStreamInstance", () => {
test("should successfully create AptosStreamInstance", () => {
const instance = new AptosStreamClient(ICluster.Devnet);

expect(instance).toBeInstanceOf(AptosStreamClient);
});

it("should correctly set passed params", () => {
test("should correctly set passed params", () => {
const pid = "PID";
const gas = "30";
const instance = new AptosStreamClient("https://cluster", ICluster.Devnet, gas, pid);
Expand All @@ -32,7 +33,7 @@ describe("AptosStreamClient", () => {

test("should create a stream with passed parameters", async () => {
// Arrange
const mockSigner = jest.fn();
const mockSigner = vi.fn();
const mockWallet: any = {
signAndSubmitTransaction: mockSigner,
account: { address: "" },
Expand Down
11 changes: 6 additions & 5 deletions packages/stream/__tests__/common/GenericStreamClient.spec.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { Wallet } from "ethers";
import { describe, expect, test } from "vitest";

import { StreamflowAptos, StreamflowEVM, StreamflowSolana, StreamflowSui } from "../../index";
import { StreamflowAptos, StreamflowEVM, StreamflowSolana, StreamflowSui } from "../../index.js";
import {
default as GenericStreamClient,
SolanaStreamClientOptions,
SuiStreamClientOptions,
AptosStreamClientOptions,
EvmStreamClientOptions,
} from "../../common/GenericStreamClient";
import { IChain, ICluster } from "../../common/types";
import { BaseStreamClient } from "../../common/BaseStreamClient";
} from "../../common/GenericStreamClient.js";
import { IChain, ICluster } from "../../common/types.js";
import { BaseStreamClient } from "../../common/BaseStreamClient.js";

type StreamClientOptions =
| SolanaStreamClientOptions
Expand Down Expand Up @@ -51,7 +52,7 @@ describe("GenericStreamClient", () => {
expected: StreamflowSui.SuiStreamClient,
},
])(".init($chain)", (config) => {
it("should successfully create GenericStreamClient instance", () => {
test("should successfully create GenericStreamClient instance", () => {
const instance = new GenericStreamClient(config);

expect(instance).toBeInstanceOf(GenericStreamClient);
Expand Down
7 changes: 0 additions & 7 deletions packages/stream/jest.config.js

This file was deleted.

5 changes: 1 addition & 4 deletions packages/stream/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"build:esm": "rm -rf dist/esm; tsc -p tsconfig.esm.json",
"build": "rm -rf dist; pnpm run build:esm && pnpm run build:cjs",
"pack": "pnpm build && pnpm pack",
"test": "jest .",
"test": "vitest",
"lint": "eslint --fix .",
"prepublishOnly": "npm run lint && npm test && npm run build"
},
Expand All @@ -47,10 +47,7 @@
"@streamflow/eslint-config": "workspace:*",
"@types/bn.js": "5.1.1",
"@types/ethereum-checksum-address": "^0.0.0",
"@types/jest": "29.2.4",
"date-fns": "2.28.0",
"jest": "29.3.1",
"ts-jest": "29.0.3",
"typescript": "^5.3.3"
},
"dependencies": {
Expand Down
Loading

0 comments on commit daaa89a

Please sign in to comment.