From d247c4bbcab02caf97e07ef2e016f65184998b5f Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 20 Jul 2022 23:22:21 -0400 Subject: [PATCH] src/goTest/resolve: fix nested packageDisplayMode handling on win32 To use path module, use Uri.fsPath, not Uri.path. For golang/vscode-go#832 For golang/vscode-go#1788 Change-Id: Ic07e19f2f83cc4b05b3be750de4be7bcdb6e6656 --- src/goTest/resolve.ts | 8 ++++++-- test/integration/goTest.explore.test.ts | 4 ---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/goTest/resolve.ts b/src/goTest/resolve.ts index b0966579e4..2b4d93c193 100644 --- a/src/goTest/resolve.ts +++ b/src/goTest/resolve.ts @@ -328,12 +328,16 @@ export class GoTestResolver { } if (nested) { - const bits = parent.uri ? path.relative(parent.uri.path, uri.path).split(path.sep) : []; + const bits = parent.uri ? path.relative(parent.uri.fsPath, uri.fsPath).split(path.sep) : []; while (bits.length > 1) { if (!parent.uri?.path) continue; const dir = bits.shift(); if (!dir) continue; - const dirUri = uri.with({ path: path.join(parent.uri.path, dir), query: '', fragment: '' }); + const dirUri = uri.with({ + path: Uri.file(path.join(parent.uri.fsPath, dir)).path, + query: '', + fragment: '' + }); parent = this.getOrCreateItem(parent, dir, dirUri, 'package'); } } diff --git a/test/integration/goTest.explore.test.ts b/test/integration/goTest.explore.test.ts index 9c1e56126d..0beda07255 100644 --- a/test/integration/goTest.explore.test.ts +++ b/test/integration/goTest.explore.test.ts @@ -15,7 +15,6 @@ import * as config from '../../src/config'; import { GoTestResolver } from '../../src/goTest/resolve'; import * as testUtils from '../../src/testUtils'; import { GoTest } from '../../src/goTest/utils'; -import { affectedByIssue832 } from './testutils'; type Files = Record; @@ -225,9 +224,6 @@ suite('Go Test Explorer', () => { }); suite('settings', () => { - if (affectedByIssue832()) { - return; - } const sandbox = sinon.createSandbox(); // eslint-disable-next-line @typescript-eslint/no-explicit-any