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

Cannot exclude select files in the loadFiles: [] #117

Open
michaelprescott opened this issue Dec 11, 2015 · 6 comments
Open

Cannot exclude select files in the loadFiles: [] #117

michaelprescott opened this issue Dec 11, 2015 · 6 comments

Comments

@michaelprescott
Copy link

In my /src/*/, there are some files I don't want to load. I believe I'm using the right pattern:

loadFiles: ['src/**/(*.js|!thisfile.js)]
but that causes "failed to proxy" errors

I've also tried:
`loadFiles: ['src/*/.js', '!src/thisfile.js']
but it has no effect, thisfile.js is still loaded

@roddolf
Copy link

roddolf commented Feb 1, 2016

+1
Same for serveFiles :[]

@taak77
Copy link

taak77 commented Feb 10, 2016

@roddolf
For serveFiles, doesn't exclude field in karma config just work?

@roddolf
Copy link

roddolf commented Feb 10, 2016

@taak77
The files I want to exclude are the spec files, that are in the same folder that the source files.
I'm just thinking in the performance.

@taak77
Copy link

taak77 commented Feb 11, 2016

@michaelprescott
In your case, it will probably work if you do

loadFiles: ['src/**/!(thisfile).js']

@roddolf
Copy link

roddolf commented Feb 11, 2016

^ Oh, so that's how it works!
Thanks, that also works for me.

Would be good to have a example of this in README.

@taak77
Copy link

taak77 commented Feb 11, 2016

@roddolf
Glad to hear it solves your problem.
It's more related to how node-glob works, not karma-jspm itself.

In my case, i'm trying to exclude any *Test.js files under certain folder, where it's e2e folder this time so that unit test won't run e2e test.

I've tried loadFiles: ['src/**/!(e2e)/**/*Test.js'] but no luck.

While we may be able to implement logic to generate the expected expanded file list using an array of glob pattern which include negation, i'm wondering if it's better to introduce excludeFiles config to exclude certain files from loadFiles list since it's much easier to implement and aligns with what Karma has with files and exclude.

Once I have excludeFiles field, I can achieve what i need by

jspm: {
  loadFiles: ['src/**/*Test.js'],
  excludeFiles: ['src/**/e2e/**/*Test.js']
}

Any thoughts?

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

No branches or pull requests

3 participants