Skip to content

Commit

Permalink
fix(test): try to fix windows url
Browse files Browse the repository at this point in the history
  • Loading branch information
SoonIter committed Feb 7, 2024
1 parent 8f5c736 commit 4a1d7f2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ async function watchEditsToRestartLanguageClient(context: ExtensionContext) {
try {
// get the absolute URI to this relative path
let configUri = Uri.file(
workspace.workspaceFolders![0].uri.fsPath + '/' + configPath
path.join(workspace.workspaceFolders![0].uri.fsPath, configPath)
)
// read the config file
let configText = await workspace.fs.readFile(configUri)
Expand Down
17 changes: 12 additions & 5 deletions tests/fileModifications.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as vscode from 'vscode'
import * as yaml from 'js-yaml'
import path from 'path'

import {
getDocUri,
Expand All @@ -16,8 +17,11 @@ const diagnosticss = getExpectedDiagnosticss()

async function writeNewRule() {
let vscodeuri = vscode.Uri.file(
vscode.workspace.workspaceFolders![0].uri.fsPath +
'/rules/no-math-random.yml'
path.join(
vscode.workspace.workspaceFolders![0].uri.fsPath,
'rules',
'no-math-random.yml'
)
)
await vscode.workspace.fs.writeFile(
vscodeuri,
Expand All @@ -34,14 +38,17 @@ note: no Math.random()`)
}
async function deleteNewRule() {
let vscodeuri = vscode.Uri.file(
vscode.workspace.workspaceFolders![0].uri.fsPath +
'/rules/no-math-random.yml'
path.join(
vscode.workspace.workspaceFolders![0].uri.fsPath,
'rules',
'no-math-random.yml'
)
)
await vscode.workspace.fs.delete(vscodeuri)
}
async function setRuleDirs(newRuleDirs: string[]) {
let vscodeuri = vscode.Uri.file(
vscode.workspace.workspaceFolders![0].uri.fsPath + '/sgconfig.yml'
path.join(vscode.workspace.workspaceFolders![0].uri.fsPath, 'sgconfig.yml')
)
let content = await vscode.workspace.fs.readFile(vscodeuri)
let configText = new TextDecoder().decode(content)
Expand Down

0 comments on commit 4a1d7f2

Please sign in to comment.