diff --git a/core/autocomplete/context/root-path-context/test/RootPathContextService.test.ts b/core/autocomplete/context/root-path-context/test/RootPathContextService.test.ts index a954dda84..0e8848bd5 100644 --- a/core/autocomplete/context/root-path-context/test/RootPathContextService.test.ts +++ b/core/autocomplete/context/root-path-context/test/RootPathContextService.test.ts @@ -1,3 +1,4 @@ +import { describe, test } from "vitest"; import { PYTHON_TEST_CASES, TYPESCRIPT_TEST_CASES } from "./testCases"; import { testRootPathContext } from "./testUtils"; diff --git a/core/autocomplete/context/root-path-context/test/testUtils.ts b/core/autocomplete/context/root-path-context/test/testUtils.ts index 207b1d6d4..83afc47ef 100644 --- a/core/autocomplete/context/root-path-context/test/testUtils.ts +++ b/core/autocomplete/context/root-path-context/test/testUtils.ts @@ -1,6 +1,6 @@ -import { jest } from "@jest/globals"; import fs from "fs"; import path from "path"; +import { expect, vi } from "vitest"; import Parser from "web-tree-sitter"; import { Position } from "../../../.."; @@ -36,7 +36,7 @@ export async function testRootPathContext( const importDefinitionsService = new ImportDefinitionsService(ide); const service = new RootPathContextService(importDefinitionsService, ide); - const getSnippetsMock = jest + const getSnippetsMock = vi // @ts-ignore .spyOn(service, "getSnippets") // @ts-ignore @@ -46,7 +46,7 @@ export async function testRootPathContext( // Copy the folder to the test directory const folderPath = path.join( - __dirname, + process.cwd(), "autocomplete", "context", "root-path-context", diff --git a/core/util/treeSitter.ts b/core/util/treeSitter.ts index df1296e0c..61842ba3e 100644 --- a/core/util/treeSitter.ts +++ b/core/util/treeSitter.ts @@ -181,7 +181,7 @@ export async function getQueryForFile( } const sourcePath = path.join( - __dirname, + process.env.NODE_ENV === "test" ? process.cwd() : __dirname, "..", ...(process.env.NODE_ENV === "test" ? ["extensions", "vscode", "tree-sitter"] @@ -201,7 +201,7 @@ async function loadLanguageForFileExt( fileExtension: string, ): Promise { const wasmPath = path.join( - __dirname, + process.env.NODE_ENV === "test" ? process.cwd() : __dirname, ...(process.env.NODE_ENV === "test" ? ["node_modules", "tree-sitter-wasms", "out"] : ["tree-sitter-wasms"]),