Skip to content

Commit 58bd7b6

Browse files
Fix auto test discovery to respect setting changes without reload (#25261)
Modified the event handler to check both the setting and the pattern before triggering test discovery: This ensures that when users disable the setting, test discovery immediately stops running on file saves without requiring a VS Code reload. Fixes #24117. --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: eleanorjboyd <[email protected]>
1 parent c7fd90a commit 58bd7b6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/client/testing/testController/controller.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,10 @@ export class PythonTestController implements ITestController, IExtensionSingleAc
549549
this.disposables.push(
550550
onDidSaveTextDocument(async (doc: TextDocument) => {
551551
const settings = this.configSettings.getSettings(doc.uri);
552-
if (minimatch.default(doc.uri.fsPath, settings.testing.autoTestDiscoverOnSavePattern)) {
552+
if (
553+
settings.testing.autoTestDiscoverOnSaveEnabled &&
554+
minimatch.default(doc.uri.fsPath, settings.testing.autoTestDiscoverOnSavePattern)
555+
) {
553556
traceVerbose(`Testing: Trigger refresh after saving ${doc.uri.fsPath}`);
554557
this.sendTriggerTelemetry('watching');
555558
this.refreshData.trigger(doc.uri, false);

0 commit comments

Comments
 (0)