feat(vscode): run mutation tests for a specific file directly from the Explorer or Editor context menu.#114
feat(vscode): run mutation tests for a specific file directly from the Explorer or Editor context menu.#114jaspervdveen wants to merge 3 commits intomainfrom
Conversation
nicojs
left a comment
There was a problem hiding this comment.
I had a quick look. Have you tried it inside the StrykerJS workspace?
|
|
||
| private notify(level: string, message: string): void { | ||
| if (level === 'ERROR') { | ||
| void vscode.window.showErrorMessage(message); |
There was a problem hiding this comment.
You're ignoring the resulting promise here. Can showXxxMessage never result in a rejection?
There was a problem hiding this comment.
The promise resolves to undefined when the error message is dismissed, and since there is no need to wait for the dismissal here, I ignore the resulting promise. There is no error path documented that causes a rejected promise, so this should be fine.
| import * as factory from '../factory.ts'; | ||
|
|
||
| describe(TestRunner.name, () => { | ||
| let sandbox: sinon.SinonSandbox; |
There was a problem hiding this comment.
Using a sandbox is almost always unnessesary, as sinon itself is also a sandbox. You can simply use sinon.stub, etc instead of sandbox.stub and simply restore with sinon.restore()
There was a problem hiding this comment.
Thanks, good to know, I will change it.
| { | ||
| "command": "strykerMutator.runMutationForFile", | ||
| "group": "strykerMutator", | ||
| "when": "resourceExtname =~ /\\.(js|jsx|ts|tsx|mjs|cjs|mts|cts)$/" |
There was a problem hiding this comment.
Can the extensions be dynamic somehow?
There was a problem hiding this comment.
I have explored this and I can use setContext to make this dynamic, but the setting key will always be window‑scoped, not resource‑scoped. So I can flip the context based on whether mutation testing is enabled (strykerMutator.enabled) and whether the file matches the watch pattern file extensions, but the result applies to the whole window rather than per workspace folder, so the added value is pretty minimal.
https://code.visualstudio.com/api/references/when-clause-contexts#check-a-setting-in-a-when-clause
Closes #112