Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"nodeTdd.glob" won't work recursive [WINDOWS] #19

Open
orgi opened this issue Nov 23, 2017 · 4 comments
Open

"nodeTdd.glob" won't work recursive [WINDOWS] #19

orgi opened this issue Nov 23, 2017 · 4 comments

Comments

@orgi
Copy link

orgi commented Nov 23, 2017

First of all:
Thanks for the great plug-in. This will ease my daily work 👍

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
@prashaantt
Copy link
Owner

@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 #5 (comment).

@kbrandwijk
Copy link

kbrandwijk commented Dec 30, 2017

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:

const globPath = resolve(workspace.rootPath, NodeTDD.getConfig<string>(config.GLOB));
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.

@prashaantt
Copy link
Owner

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?

@kbrandwijk
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants