Skip to content

Commit 4a1d7f2

Browse files
committed
fix(test): try to fix windows url
1 parent 8f5c736 commit 4a1d7f2

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/extension.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ async function watchEditsToRestartLanguageClient(context: ExtensionContext) {
264264
try {
265265
// get the absolute URI to this relative path
266266
let configUri = Uri.file(
267-
workspace.workspaceFolders![0].uri.fsPath + '/' + configPath
267+
path.join(workspace.workspaceFolders![0].uri.fsPath, configPath)
268268
)
269269
// read the config file
270270
let configText = await workspace.fs.readFile(configUri)

tests/fileModifications.test.ts

+12-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as vscode from 'vscode'
22
import * as yaml from 'js-yaml'
3+
import path from 'path'
34

45
import {
56
getDocUri,
@@ -16,8 +17,11 @@ const diagnosticss = getExpectedDiagnosticss()
1617

1718
async function writeNewRule() {
1819
let vscodeuri = vscode.Uri.file(
19-
vscode.workspace.workspaceFolders![0].uri.fsPath +
20-
'/rules/no-math-random.yml'
20+
path.join(
21+
vscode.workspace.workspaceFolders![0].uri.fsPath,
22+
'rules',
23+
'no-math-random.yml'
24+
)
2125
)
2226
await vscode.workspace.fs.writeFile(
2327
vscodeuri,
@@ -34,14 +38,17 @@ note: no Math.random()`)
3438
}
3539
async function deleteNewRule() {
3640
let vscodeuri = vscode.Uri.file(
37-
vscode.workspace.workspaceFolders![0].uri.fsPath +
38-
'/rules/no-math-random.yml'
41+
path.join(
42+
vscode.workspace.workspaceFolders![0].uri.fsPath,
43+
'rules',
44+
'no-math-random.yml'
45+
)
3946
)
4047
await vscode.workspace.fs.delete(vscodeuri)
4148
}
4249
async function setRuleDirs(newRuleDirs: string[]) {
4350
let vscodeuri = vscode.Uri.file(
44-
vscode.workspace.workspaceFolders![0].uri.fsPath + '/sgconfig.yml'
51+
path.join(vscode.workspace.workspaceFolders![0].uri.fsPath, 'sgconfig.yml')
4552
)
4653
let content = await vscode.workspace.fs.readFile(vscodeuri)
4754
let configText = new TextDecoder().decode(content)

0 commit comments

Comments
 (0)