"nodeTdd.glob" won't work recursive [WINDOWS]
First of all: Thanks for the great plug-in. This will ease my daily work :+1:
Unfortunately when setting the glob to something like:
"nodeTdd.glob": "{src,spec}/**/*.{js,ts,jsx,tsx}"
The '**' will only match exactly one folder level. Not more, not less. I would have assumed that it'd find spec files in sub folders as and in the spec and src folders as well.
I am running code on Windows. Is this an expected/known behavior?
Please also check following visualization:
spec
|-- spec1.js // changes here will be ignored
|-- folder
|---- spec2.js // changes here will trigger new test run
|---- anotherFolder
|----------- spec3.js // changes here will be ignored
@orgi I've seen the glob behave slightly differently on Windows. It's part of VS Code and I have no control over it. Also see https://github.com/prashaantt/node-tdd/issues/5#issuecomment-284316273.
Unfortunately, I can confirm that glob patterns are still not working on Windows. Maybe it's an idea to use https://code.visualstudio.com/docs/extensionAPI/vscode-api#RelativePattern instead of resolve? I'm not sure if it will fix things...
Update: upon further research, I'm positive that changing: https://github.com/prashaantt/node-tdd/blob/212e7fd6cf1f44fb59adcd29fb53c9060eb32c87/src/TestRunner.ts#L20 into:
const globPath = new RelativePattern(workspace.workspaceFolders[0], NodeTDD.getConfig<string>(config.GLOB))
should do the trick, because path.resolve() will never result in more than one folder on Windows. Also, since the glob pattern uses /, path.posix.resolve() would be needed, but would still give you a single folder.
Thanks for digging this up @kbrandwijk! I don't have ready access to a Windows machine to test this out. Would you mind submitting a PR from a PC that you've tested this on?
@prashaantt Please see the referenced PR. I have tested this on Windows only with a deep tree and the default glob setting, and it works like a charm.