test RootPathContextService

This commit is contained in:
uinstinct 2025-06-10 11:26:53 +05:30
parent 577c1a8643
commit d2c99e51bc
3 changed files with 6 additions and 5 deletions

View file

@ -1,3 +1,4 @@
import { describe, test } from "vitest";
import { PYTHON_TEST_CASES, TYPESCRIPT_TEST_CASES } from "./testCases";
import { testRootPathContext } from "./testUtils";

View file

@ -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",

View file

@ -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<Language> {
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"]),