test RootPathContextService
This commit is contained in:
parent
577c1a8643
commit
d2c99e51bc
3 changed files with 6 additions and 5 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import { describe, test } from "vitest";
|
||||
import { PYTHON_TEST_CASES, TYPESCRIPT_TEST_CASES } from "./testCases";
|
||||
import { testRootPathContext } from "./testUtils";
|
||||
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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"]),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue