From ed15d2e6105fdddae005de6418b43c9c9bac4cc9 Mon Sep 17 00:00:00 2001 From: bludnic Date: Thu, 29 Aug 2024 02:02:22 +0100 Subject: [PATCH] chore: replace `jest` with `vitest` (#48) --- packages/tools/package.json | 9 ++-- ...tion.spec.ts => barSizeToDuration.test.ts} | 1 + ...ec.ts => findHighestCandlestickBy.test.ts} | 13 ++--- ...pec.ts => findLowestCandlestickBy.test.ts} | 13 ++--- .../candlesticks/lastClosedCandleDate.spec.ts | 48 ------------------- .../candlesticks/lastClosedCandleDate.test.ts | 26 ++++++++++ ...ces.spec.ts => countDecimalPlaces.test.ts} | 1 + ...nentAbs.spec.ts => getExponentAbs.test.ts} | 1 + ...ilterPrice.spec.ts => filterPrice.test.ts} | 1 + ...uantity.spec.ts => filterQuantity.test.ts} | 1 + ...reGridLinesPricesSortedInAscOrder.test.ts} | 5 +- ...nt.spec.ts => calculateInvestment.test.ts} | 7 +-- ...teGridLevelsFromCurrentAssetPrice.test.ts} | 27 +++-------- ...Line.spec.ts => isWaitingGridLine.test.ts} | 1 + ...ine.spec.ts => isWaitingPriceLine.test.ts} | 1 + ...olId.spec.ts => decomposeSymbolId.test.ts} | 1 + ...de.spec.ts => isValidExchangeCode.test.ts} | 1 + ...idSymbol.spec.ts => isValidSymbol.test.ts} | 1 + ...mbolId.spec.ts => isValidSymbolId.test.ts} | 1 + packages/tools/vitest.config.ts | 12 +++++ pnpm-lock.yaml | 15 ++---- 21 files changed, 73 insertions(+), 113 deletions(-) rename packages/tools/src/candlesticks/{barSizeToDuration.spec.ts => barSizeToDuration.test.ts} (94%) rename packages/tools/src/candlesticks/{findHighestCandlestickBy.spec.ts => findHighestCandlestickBy.test.ts} (81%) rename packages/tools/src/candlesticks/{findLowestCandlestickBy.spec.ts => findLowestCandlestickBy.test.ts} (81%) delete mode 100644 packages/tools/src/candlesticks/lastClosedCandleDate.spec.ts create mode 100644 packages/tools/src/candlesticks/lastClosedCandleDate.test.ts rename packages/tools/src/currency/common/{countDecimalPlaces.spec.ts => countDecimalPlaces.test.ts} (90%) rename packages/tools/src/currency/common/{getExponentAbs.spec.ts => getExponentAbs.test.ts} (93%) rename packages/tools/src/currency/{filterPrice.spec.ts => filterPrice.test.ts} (93%) rename packages/tools/src/currency/{filterQuantity.spec.ts => filterQuantity.test.ts} (93%) rename packages/tools/src/grid/{areGridLinesPricesSortedInAscOrder.spec.ts => areGridLinesPricesSortedInAscOrder.test.ts} (89%) rename packages/tools/src/grid/{calculateInvestment.spec.ts => calculateInvestment.test.ts} (71%) rename packages/tools/src/grid/{computeGridLevelsFromCurrentAssetPrice.spec.ts => computeGridLevelsFromCurrentAssetPrice.test.ts} (79%) rename packages/tools/src/grid/{isWaitingGridLine.spec.ts => isWaitingGridLine.test.ts} (97%) rename packages/tools/src/grid/{isWaitingPriceLine.spec.ts => isWaitingPriceLine.test.ts} (94%) rename packages/tools/src/symbolId/{decomposeSymbolId.spec.ts => decomposeSymbolId.test.ts} (93%) rename packages/tools/src/symbolId/{isValidExchangeCode.spec.ts => isValidExchangeCode.test.ts} (89%) rename packages/tools/src/symbolId/{isValidSymbol.spec.ts => isValidSymbol.test.ts} (90%) rename packages/tools/src/symbolId/{isValidSymbolId.spec.ts => isValidSymbolId.test.ts} (93%) create mode 100644 packages/tools/vitest.config.ts diff --git a/packages/tools/package.json b/packages/tools/package.json index c80ad3b0..fb9aa2e5 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -6,7 +6,7 @@ "main": "src/index.ts", "types": "src/index.ts", "scripts": { - "test": "jest", + "test": "vitest", "build": "tsup --dts", "lint": "eslint . --quiet", "lint:fix": "eslint . --fix", @@ -15,16 +15,13 @@ "author": "bludnic", "license": "Apache-2.0", "devDependencies": { - "@jest/globals": "^29.7.0", "@opentrader/eslint": "workspace:*", "@opentrader/tsconfig": "workspace:*", "@types/big.js": "^6.2.2", - "@types/jest": "^29.5.12", "eslint": "8.57.0", - "jest": "^29.7.0", - "ts-jest": "^29.2.5", "tsup": "^8.2.4", - "typescript": "5.5.4" + "typescript": "5.5.4", + "vitest": "^2.0.5" }, "dependencies": { "@opentrader/types": "workspace:*", diff --git a/packages/tools/src/candlesticks/barSizeToDuration.spec.ts b/packages/tools/src/candlesticks/barSizeToDuration.test.ts similarity index 94% rename from packages/tools/src/candlesticks/barSizeToDuration.spec.ts rename to packages/tools/src/candlesticks/barSizeToDuration.test.ts index b7ed594e..7f76629d 100644 --- a/packages/tools/src/candlesticks/barSizeToDuration.spec.ts +++ b/packages/tools/src/candlesticks/barSizeToDuration.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from "vitest"; import { barSizeToDuration } from "./barSizeToDuration.js"; describe("barSizeToDuration function", () => { diff --git a/packages/tools/src/candlesticks/findHighestCandlestickBy.spec.ts b/packages/tools/src/candlesticks/findHighestCandlestickBy.test.ts similarity index 81% rename from packages/tools/src/candlesticks/findHighestCandlestickBy.spec.ts rename to packages/tools/src/candlesticks/findHighestCandlestickBy.test.ts index 00b3327f..57bb110b 100644 --- a/packages/tools/src/candlesticks/findHighestCandlestickBy.spec.ts +++ b/packages/tools/src/candlesticks/findHighestCandlestickBy.test.ts @@ -1,22 +1,17 @@ +import { describe, expect, it } from "vitest"; import { CANDLESTICKS } from "../mocks/candlesticks.js"; import { findHighestCandlestickBy } from "./findHighestCandlestickBy.js"; describe("findHighestCandlestickBy", () => { it("highest by close", () => { - expect(findHighestCandlestickBy("close", CANDLESTICKS)).toEqual( - CANDLESTICKS[0], - ); + expect(findHighestCandlestickBy("close", CANDLESTICKS)).toEqual(CANDLESTICKS[0]); }); it("highest by open", () => { - expect(findHighestCandlestickBy("open", CANDLESTICKS)).toEqual( - CANDLESTICKS[2], - ); + expect(findHighestCandlestickBy("open", CANDLESTICKS)).toEqual(CANDLESTICKS[2]); }); it("highest by low", () => { - expect(findHighestCandlestickBy("low", CANDLESTICKS)).toEqual( - CANDLESTICKS[2], - ); + expect(findHighestCandlestickBy("low", CANDLESTICKS)).toEqual(CANDLESTICKS[2]); }); }); diff --git a/packages/tools/src/candlesticks/findLowestCandlestickBy.spec.ts b/packages/tools/src/candlesticks/findLowestCandlestickBy.test.ts similarity index 81% rename from packages/tools/src/candlesticks/findLowestCandlestickBy.spec.ts rename to packages/tools/src/candlesticks/findLowestCandlestickBy.test.ts index 2e55bc9a..4e6e85cd 100644 --- a/packages/tools/src/candlesticks/findLowestCandlestickBy.spec.ts +++ b/packages/tools/src/candlesticks/findLowestCandlestickBy.test.ts @@ -1,22 +1,17 @@ +import { describe, expect, it } from "vitest"; import { CANDLESTICKS } from "../mocks/candlesticks.js"; import { findLowestCandlestickBy } from "./findLowestCandlestickBy.js"; describe("findLowestCandlestickBy", () => { it("lowest by close", () => { - expect(findLowestCandlestickBy("close", CANDLESTICKS)).toEqual( - CANDLESTICKS[2], - ); + expect(findLowestCandlestickBy("close", CANDLESTICKS)).toEqual(CANDLESTICKS[2]); }); it("lowest by open", () => { - expect(findLowestCandlestickBy("open", CANDLESTICKS)).toEqual( - CANDLESTICKS[1], - ); + expect(findLowestCandlestickBy("open", CANDLESTICKS)).toEqual(CANDLESTICKS[1]); }); it("lowest by low", () => { - expect(findLowestCandlestickBy("low", CANDLESTICKS)).toEqual( - CANDLESTICKS[0], - ); + expect(findLowestCandlestickBy("low", CANDLESTICKS)).toEqual(CANDLESTICKS[0]); }); }); diff --git a/packages/tools/src/candlesticks/lastClosedCandleDate.spec.ts b/packages/tools/src/candlesticks/lastClosedCandleDate.spec.ts deleted file mode 100644 index 4ca1d340..00000000 --- a/packages/tools/src/candlesticks/lastClosedCandleDate.spec.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { lastClosedCandleDate } from "./lastClosedCandleDate.js"; - -describe("lastClosedCandleDate", () => { - it("should return the correct date for each bar size", () => { - expect( - lastClosedCandleDate( - new Date("2023-01-21T01:00:00.000Z").getTime(), - "1m", - ), - ).toBe("2023-01-21T00:59:00.000Z"); - }); - - it("should return the correct date for 1m bar size with milliseconds", () => { - expect( - lastClosedCandleDate( - new Date("2023-01-21T01:00:00.123Z").getTime(), - "1m", - ), - ).toBe("2023-01-21T00:59:00.000Z"); - }); - - it("should return the correct date for 5m bar size with milliseconds", () => { - expect( - lastClosedCandleDate( - new Date("2023-01-21T01:00:00.123Z").getTime(), - "5m", - ), - ).toBe("2023-01-21T00:55:00.000Z"); - }); - - it("should return the correct date for 15m bar size with milliseconds", () => { - expect( - lastClosedCandleDate( - new Date("2023-01-21T01:00:00.123Z").getTime(), - "15m", - ), - ).toBe("2023-01-21T00:45:00.000Z"); - }); - - it("should return the correct date for 1h bar size with milliseconds", () => { - expect( - lastClosedCandleDate( - new Date("2023-01-21T01:00:00.123Z").getTime(), - "1h", - ), - ).toBe("2023-01-21T00:00:00.000Z"); - }); -}); diff --git a/packages/tools/src/candlesticks/lastClosedCandleDate.test.ts b/packages/tools/src/candlesticks/lastClosedCandleDate.test.ts new file mode 100644 index 00000000..1e97e299 --- /dev/null +++ b/packages/tools/src/candlesticks/lastClosedCandleDate.test.ts @@ -0,0 +1,26 @@ +import { describe, expect, it } from "vitest"; +import { lastClosedCandleDate } from "./lastClosedCandleDate.js"; + +describe("lastClosedCandleDate", () => { + it("should return the correct date for each bar size", () => { + expect(lastClosedCandleDate(new Date("2023-01-21T01:00:00.000Z").getTime(), "1m")).toBe("2023-01-21T00:59:00.000Z"); + }); + + it("should return the correct date for 1m bar size with milliseconds", () => { + expect(lastClosedCandleDate(new Date("2023-01-21T01:00:00.123Z").getTime(), "1m")).toBe("2023-01-21T00:59:00.000Z"); + }); + + it("should return the correct date for 5m bar size with milliseconds", () => { + expect(lastClosedCandleDate(new Date("2023-01-21T01:00:00.123Z").getTime(), "5m")).toBe("2023-01-21T00:55:00.000Z"); + }); + + it("should return the correct date for 15m bar size with milliseconds", () => { + expect(lastClosedCandleDate(new Date("2023-01-21T01:00:00.123Z").getTime(), "15m")).toBe( + "2023-01-21T00:45:00.000Z", + ); + }); + + it("should return the correct date for 1h bar size with milliseconds", () => { + expect(lastClosedCandleDate(new Date("2023-01-21T01:00:00.123Z").getTime(), "1h")).toBe("2023-01-21T00:00:00.000Z"); + }); +}); diff --git a/packages/tools/src/currency/common/countDecimalPlaces.spec.ts b/packages/tools/src/currency/common/countDecimalPlaces.test.ts similarity index 90% rename from packages/tools/src/currency/common/countDecimalPlaces.spec.ts rename to packages/tools/src/currency/common/countDecimalPlaces.test.ts index 1c2b7552..5bfc05b1 100644 --- a/packages/tools/src/currency/common/countDecimalPlaces.spec.ts +++ b/packages/tools/src/currency/common/countDecimalPlaces.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from "vitest"; import { countDecimalPlaces } from "./countDecimalPlaces.js"; describe(countDecimalPlaces.name, () => { diff --git a/packages/tools/src/currency/common/getExponentAbs.spec.ts b/packages/tools/src/currency/common/getExponentAbs.test.ts similarity index 93% rename from packages/tools/src/currency/common/getExponentAbs.spec.ts rename to packages/tools/src/currency/common/getExponentAbs.test.ts index 71e326c2..fd4949bd 100644 --- a/packages/tools/src/currency/common/getExponentAbs.spec.ts +++ b/packages/tools/src/currency/common/getExponentAbs.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from "vitest"; import { getExponentAbs } from "./getExponentAbs.js"; describe("getExponentAbs", () => { diff --git a/packages/tools/src/currency/filterPrice.spec.ts b/packages/tools/src/currency/filterPrice.test.ts similarity index 93% rename from packages/tools/src/currency/filterPrice.spec.ts rename to packages/tools/src/currency/filterPrice.test.ts index 345907be..5b56d741 100644 --- a/packages/tools/src/currency/filterPrice.spec.ts +++ b/packages/tools/src/currency/filterPrice.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from "vitest"; import { ETH_SYMBOL_FILTER } from "../mocks/symbols.js"; import { filterPrice } from "./filterPrice.js"; diff --git a/packages/tools/src/currency/filterQuantity.spec.ts b/packages/tools/src/currency/filterQuantity.test.ts similarity index 93% rename from packages/tools/src/currency/filterQuantity.spec.ts rename to packages/tools/src/currency/filterQuantity.test.ts index 6b0377cf..f137ae3e 100644 --- a/packages/tools/src/currency/filterQuantity.spec.ts +++ b/packages/tools/src/currency/filterQuantity.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from "vitest"; import { ETH_SYMBOL_FILTER } from "../mocks/symbols.js"; import { filterQuantity } from "./filterQuantity.js"; diff --git a/packages/tools/src/grid/areGridLinesPricesSortedInAscOrder.spec.ts b/packages/tools/src/grid/areGridLinesPricesSortedInAscOrder.test.ts similarity index 89% rename from packages/tools/src/grid/areGridLinesPricesSortedInAscOrder.spec.ts rename to packages/tools/src/grid/areGridLinesPricesSortedInAscOrder.test.ts index ced773b1..7f40cd36 100644 --- a/packages/tools/src/grid/areGridLinesPricesSortedInAscOrder.spec.ts +++ b/packages/tools/src/grid/areGridLinesPricesSortedInAscOrder.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from "vitest"; import { areGridLinesPricesSortedInAscOrder } from "./areGridLinesPricesSortedInAscOrder.js"; describe("areGridLinesPricesSortedInAscOrder", () => { @@ -6,9 +7,7 @@ describe("areGridLinesPricesSortedInAscOrder", () => { }); it("should return `true` when only one grid line is preset", () => { - expect( - areGridLinesPricesSortedInAscOrder([{ price: 10, quantity: 1 }]), - ).toBe(true); + expect(areGridLinesPricesSortedInAscOrder([{ price: 10, quantity: 1 }])).toBe(true); }); it("should return `false` when grid lines are not sorted", () => { diff --git a/packages/tools/src/grid/calculateInvestment.spec.ts b/packages/tools/src/grid/calculateInvestment.test.ts similarity index 71% rename from packages/tools/src/grid/calculateInvestment.spec.ts rename to packages/tools/src/grid/calculateInvestment.test.ts index c66c892a..340eb52e 100644 --- a/packages/tools/src/grid/calculateInvestment.spec.ts +++ b/packages/tools/src/grid/calculateInvestment.test.ts @@ -1,8 +1,5 @@ -import { - BASE_CURRENCY_INVESTMENT, - GRID_LEVELS, - QUOTE_CURRENCY_INVESTMENT, -} from "../mocks/grid-bot.js"; +import { describe, expect, it } from "vitest"; +import { BASE_CURRENCY_INVESTMENT, GRID_LEVELS, QUOTE_CURRENCY_INVESTMENT } from "../mocks/grid-bot.js"; import { calculateInvestment } from "./calculateInvestment.js"; describe("calculateInvestment", () => { diff --git a/packages/tools/src/grid/computeGridLevelsFromCurrentAssetPrice.spec.ts b/packages/tools/src/grid/computeGridLevelsFromCurrentAssetPrice.test.ts similarity index 79% rename from packages/tools/src/grid/computeGridLevelsFromCurrentAssetPrice.spec.ts rename to packages/tools/src/grid/computeGridLevelsFromCurrentAssetPrice.test.ts index 8d2ad058..3c42c0da 100644 --- a/packages/tools/src/grid/computeGridLevelsFromCurrentAssetPrice.spec.ts +++ b/packages/tools/src/grid/computeGridLevelsFromCurrentAssetPrice.test.ts @@ -1,18 +1,12 @@ +import { describe, expect, it } from "vitest"; import type { IGridBotLevel } from "@opentrader/types"; -import { - CURRENT_ASSET_PRICE, - GRID_LINES, - GRID_LEVELS, -} from "../mocks/grid-bot.js"; +import { CURRENT_ASSET_PRICE, GRID_LINES, GRID_LEVELS } from "../mocks/grid-bot.js"; import { calcGridLines } from "./calcGridLines.js"; import { computeGridLevelsFromCurrentAssetPrice } from "./computeGridLevelsFromCurrentAssetPrice.js"; describe("computeGridLevelsFromCurrentAssetPrice", () => { it("should calculate initial grid levels", () => { - const gridLevels = computeGridLevelsFromCurrentAssetPrice( - GRID_LINES, - CURRENT_ASSET_PRICE, - ); + const gridLevels = computeGridLevelsFromCurrentAssetPrice(GRID_LINES, CURRENT_ASSET_PRICE); const expectedGridLevels: IGridBotLevel[] = GRID_LEVELS; expect(gridLevels).toStrictEqual(expectedGridLevels); @@ -22,10 +16,7 @@ describe("computeGridLevelsFromCurrentAssetPrice", () => { const currentAssetPrice = 1.13; const gridLines = calcGridLines(1.14, 1.11, 4, 5); - const gridLevels = computeGridLevelsFromCurrentAssetPrice( - gridLines, - currentAssetPrice, - ); + const gridLevels = computeGridLevelsFromCurrentAssetPrice(gridLines, currentAssetPrice); expect(gridLevels).toMatchObject([ { sell: { price: 1.12 } }, @@ -38,10 +29,7 @@ describe("computeGridLevelsFromCurrentAssetPrice", () => { const currentAssetPrice = 2610; const gridLines = calcGridLines(2800, 2500, 16, 0.1); - const gridLevels = computeGridLevelsFromCurrentAssetPrice( - gridLines, - currentAssetPrice, - ); + const gridLevels = computeGridLevelsFromCurrentAssetPrice(gridLines, currentAssetPrice); expect(gridLevels).toHaveLength(15); expect(gridLevels).toMatchObject([ @@ -68,10 +56,7 @@ describe("computeGridLevelsFromCurrentAssetPrice", () => { const currentAssetPrice = 9.8; const gridLines = calcGridLines(12, 7.5, 10, 10); - const gridLevels = computeGridLevelsFromCurrentAssetPrice( - gridLines, - currentAssetPrice, - ); + const gridLevels = computeGridLevelsFromCurrentAssetPrice(gridLines, currentAssetPrice); expect(gridLevels).toHaveLength(9); expect(gridLevels).toMatchObject([ diff --git a/packages/tools/src/grid/isWaitingGridLine.spec.ts b/packages/tools/src/grid/isWaitingGridLine.test.ts similarity index 97% rename from packages/tools/src/grid/isWaitingGridLine.spec.ts rename to packages/tools/src/grid/isWaitingGridLine.test.ts index cdf18cf1..c61cf3f1 100644 --- a/packages/tools/src/grid/isWaitingGridLine.spec.ts +++ b/packages/tools/src/grid/isWaitingGridLine.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from "vitest"; import type { IGridLine } from "@opentrader/types"; import { isWaitingGridLine } from "./isWaitingGridLine.js"; diff --git a/packages/tools/src/grid/isWaitingPriceLine.spec.ts b/packages/tools/src/grid/isWaitingPriceLine.test.ts similarity index 94% rename from packages/tools/src/grid/isWaitingPriceLine.spec.ts rename to packages/tools/src/grid/isWaitingPriceLine.test.ts index 95f48fe1..a11cf7a7 100644 --- a/packages/tools/src/grid/isWaitingPriceLine.spec.ts +++ b/packages/tools/src/grid/isWaitingPriceLine.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from "vitest"; import { isWaitingPriceLine } from "./isWaitingPriceLine.js"; const priceLines = [1, 3, 2, 4, 5]; diff --git a/packages/tools/src/symbolId/decomposeSymbolId.spec.ts b/packages/tools/src/symbolId/decomposeSymbolId.test.ts similarity index 93% rename from packages/tools/src/symbolId/decomposeSymbolId.spec.ts rename to packages/tools/src/symbolId/decomposeSymbolId.test.ts index b627ebd9..d9233d70 100644 --- a/packages/tools/src/symbolId/decomposeSymbolId.spec.ts +++ b/packages/tools/src/symbolId/decomposeSymbolId.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from "vitest"; import { ExchangeCode } from "@opentrader/types"; import type { DecomposeSymbolIdResult } from "./decomposeSymbolId.js"; import { decomposeSymbolId } from "./decomposeSymbolId.js"; diff --git a/packages/tools/src/symbolId/isValidExchangeCode.spec.ts b/packages/tools/src/symbolId/isValidExchangeCode.test.ts similarity index 89% rename from packages/tools/src/symbolId/isValidExchangeCode.spec.ts rename to packages/tools/src/symbolId/isValidExchangeCode.test.ts index ec011f04..f2b4c9db 100644 --- a/packages/tools/src/symbolId/isValidExchangeCode.spec.ts +++ b/packages/tools/src/symbolId/isValidExchangeCode.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from "vitest"; import { ExchangeCode } from "@opentrader/types"; import { isValidExchangeCode } from "./isValidExchangeCode.js"; diff --git a/packages/tools/src/symbolId/isValidSymbol.spec.ts b/packages/tools/src/symbolId/isValidSymbol.test.ts similarity index 90% rename from packages/tools/src/symbolId/isValidSymbol.spec.ts rename to packages/tools/src/symbolId/isValidSymbol.test.ts index e85d4012..bce17af0 100644 --- a/packages/tools/src/symbolId/isValidSymbol.spec.ts +++ b/packages/tools/src/symbolId/isValidSymbol.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from "vitest"; import { isValidSymbol } from "./isValidSymbol.js"; describe("isValidSymbol", () => { diff --git a/packages/tools/src/symbolId/isValidSymbolId.spec.ts b/packages/tools/src/symbolId/isValidSymbolId.test.ts similarity index 93% rename from packages/tools/src/symbolId/isValidSymbolId.spec.ts rename to packages/tools/src/symbolId/isValidSymbolId.test.ts index ce3155fa..6eef979c 100644 --- a/packages/tools/src/symbolId/isValidSymbolId.spec.ts +++ b/packages/tools/src/symbolId/isValidSymbolId.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from "vitest"; import { isValidSymbolId } from "./isValidSymbolId.js"; describe("isValidSymbolId", () => { diff --git a/packages/tools/vitest.config.ts b/packages/tools/vitest.config.ts new file mode 100644 index 00000000..4b533b67 --- /dev/null +++ b/packages/tools/vitest.config.ts @@ -0,0 +1,12 @@ +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + globals: true, + environment: "node", + coverage: { + reporter: ["text", "json", "html"], + }, + include: ["src/**/*.test.ts"], + }, +}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c266b3d7..a083d1d3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -716,9 +716,6 @@ importers: specifier: ^6.2.1 version: 6.2.1 devDependencies: - '@jest/globals': - specifier: ^29.7.0 - version: 29.7.0 '@opentrader/eslint': specifier: workspace:* version: link:../eslint @@ -728,24 +725,18 @@ importers: '@types/big.js': specifier: ^6.2.2 version: 6.2.2 - '@types/jest': - specifier: ^29.5.12 - version: 29.5.12 eslint: specifier: 8.57.0 version: 8.57.0 - jest: - specifier: ^29.7.0 - version: 29.7.0(@types/node@20.16.2)(ts-node@10.9.2(@types/node@20.16.2)(typescript@5.5.4)) - ts-jest: - specifier: ^29.2.5 - version: 29.2.5(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(jest@29.7.0(@types/node@20.16.2)(ts-node@10.9.2(@types/node@20.16.2)(typescript@5.5.4)))(typescript@5.5.4) tsup: specifier: ^8.2.4 version: 8.2.4(postcss@8.4.41)(tsx@4.19.0)(typescript@5.5.4) typescript: specifier: 5.5.4 version: 5.5.4 + vitest: + specifier: ^2.0.5 + version: 2.0.5(@types/node@20.16.2)(terser@5.31.6) packages/trpc: dependencies: