|
3 | 3 |
|
4 | 4 | import { inject, injectable, named } from 'inversify'; |
5 | 5 | import { uniq } from 'lodash'; |
6 | | -import { minimatch } from 'minimatch'; |
| 6 | +import * as minimatch from 'minimatch'; |
7 | 7 | import { |
8 | 8 | CancellationToken, |
9 | 9 | TestController, |
@@ -216,7 +216,7 @@ export class PythonTestController implements ITestController, IExtensionSingleAc |
216 | 216 | if (settings.testing.autoTestDiscoverOnSaveEnabled) { |
217 | 217 | traceVerbose(`Testing: Setting up watcher for ${workspace.uri.fsPath}`); |
218 | 218 | this.watchForSettingsChanges(workspace); |
219 | | - this.watchForTestContentChangeOnSave(settings.testing.autoTestDiscoverOnSavePattern); |
| 219 | + this.watchForTestContentChangeOnSave(); |
220 | 220 | } |
221 | 221 | }); |
222 | 222 | } |
@@ -550,10 +550,11 @@ export class PythonTestController implements ITestController, IExtensionSingleAc |
550 | 550 | ); |
551 | 551 | } |
552 | 552 |
|
553 | | - private watchForTestContentChangeOnSave(testFileGlob: String): void { |
| 553 | + private watchForTestContentChangeOnSave(): void { |
554 | 554 | this.disposables.push( |
555 | 555 | onDidSaveTextDocument(async (doc: TextDocument) => { |
556 | | - if (minimatch(doc.uri.fs, testFileGlob)) { |
| 556 | + const settings = this.configSettings.getSettings(doc.uri); |
| 557 | + if (minimatch.default(doc.uri.fsPath, settings.testing.autoTestDiscoverOnSavePattern)) { |
557 | 558 | traceVerbose(`Testing: Trigger refresh after saving ${doc.uri.fsPath}`); |
558 | 559 | this.sendTriggerTelemetry('watching'); |
559 | 560 | this.refreshData.trigger(doc.uri, false); |
|
0 commit comments