diff --git a/packages/canyon-backend/package.json b/packages/canyon-backend/package.json index 77230567..a7b1bd11 100755 --- a/packages/canyon-backend/package.json +++ b/packages/canyon-backend/package.json @@ -55,6 +55,7 @@ "@nestjs/schematics": "^10.2.2", "@swc/cli": "0.4.1-nightly.20240914", "@swc/core": "^1.7.40", + "@swc/jest": "^0.2.36", "@types/express": "^5.0.0", "@types/istanbul-lib-coverage": "^2.0.6", "@types/istanbul-lib-source-maps": "^4.0.4", @@ -90,6 +91,9 @@ "rootDir": "test", "moduleNameMapper": { "^src/(.*)$": "/$1" + }, + "transform": { + "^.+\\.(t|j)sx?$": "@swc/jest" } } -} \ No newline at end of file +} diff --git a/packages/canyon-backend/src/coverage/services/common/test-exclude.service.ts b/packages/canyon-backend/src/coverage/services/common/test-exclude.service.ts index 07e188c3..fdc77b98 100644 --- a/packages/canyon-backend/src/coverage/services/common/test-exclude.service.ts +++ b/packages/canyon-backend/src/coverage/services/common/test-exclude.service.ts @@ -1,6 +1,6 @@ import { Injectable } from "@nestjs/common"; import { PrismaService } from "../../../prisma/prisma.service"; -import * as TestExclude from "test-exclude"; +import TestExclude from "test-exclude"; @Injectable() export class TestExcludeService { constructor(private readonly prisma: PrismaService) {} diff --git a/packages/canyon-backend/src/main.ts b/packages/canyon-backend/src/main.ts index 66ce4f48..baecc6b8 100755 --- a/packages/canyon-backend/src/main.ts +++ b/packages/canyon-backend/src/main.ts @@ -1,8 +1,8 @@ import { NestFactory } from "@nestjs/core"; import { json } from "express"; import { ValidationPipe } from "@nestjs/common"; -import * as dotenv from "dotenv"; -import * as path from "node:path"; +import dotenv from "dotenv"; +import path from "node:path"; import { GlobalExceptionFilter } from "./filter/global-exception.filter"; dotenv.config({ diff --git a/packages/canyon-backend/src/utils/compress.ts b/packages/canyon-backend/src/utils/compress.ts index f00e6d0f..9f7efcfa 100644 --- a/packages/canyon-backend/src/utils/compress.ts +++ b/packages/canyon-backend/src/utils/compress.ts @@ -1,6 +1,6 @@ import { compress, decompress } from "@mongodb-js/zstd"; import {CoverageMapData} from "istanbul-lib-coverage"; -import * as protobuf from "protobufjs"; +import protobuf from "protobufjs"; function formatCoverageDataToProto(coverageData) { // @ts-ignore diff --git a/packages/canyon-backend/src/utils/coverage.ts b/packages/canyon-backend/src/utils/coverage.ts index acc5d6d2..54746870 100755 --- a/packages/canyon-backend/src/utils/coverage.ts +++ b/packages/canyon-backend/src/utils/coverage.ts @@ -1,5 +1,5 @@ -import * as libCoverage from "istanbul-lib-coverage"; -import * as libSourceMaps from "istanbul-lib-source-maps"; +import libCoverage from "istanbul-lib-coverage"; +import libSourceMaps from "istanbul-lib-source-maps"; import { mergeCoverageMap as mergeCoverageMapOfCanyonData } from "canyon-data"; // import { merge_coverage_json_str } from 'canyon-data'; function parseInstrumentCwd(instrumentCwd) { diff --git a/packages/canyon-backend/src/utils/diffline.ts b/packages/canyon-backend/src/utils/diffline.ts index b15de9a9..2a318eb1 100755 --- a/packages/canyon-backend/src/utils/diffline.ts +++ b/packages/canyon-backend/src/utils/diffline.ts @@ -1,4 +1,4 @@ -import * as Diff from "diff"; +import Diff from "diff"; import { Change } from "diff"; interface DiffLine { repoID: string;