rolaveric / karma-systemjs

Karma plugin for using SystemJS as a module loader
MIT License
40 stars 19 forks source link

test file matching not working #47

Closed mikehaas763 closed 9 years ago

mikehaas763 commented 9 years ago

I do not know how test file matching is set up. I've listed my console log statements below. Based on the filePath, should that file be matched as a test and run? It doesn't match the regex.

filePaths.hasOwnProperty(filePath)
true
importRegexp.test(filePath)
false
filePath
"/base/src/testingWorksSpec.js"
importRegexp
/^(?:\/base\/src\/(?:(?!(?:\/|^)\.).)*?\/(?!\.)(?=.)[^\/]*?Spec\.js)$/
mikehaas763 commented 9 years ago

If you debug at lines 118 and 119 of framework.js I believe the problem is that Minimatch.makeRe() is not producing a valid regex.

mikehaas763 commented 9 years ago

Made another discovery. Unfortunately I don't have the time to fully debug the framework to see what's happening but I noticed that I needed to add another files glob. Having just dev/**/*Spec.js did not work. I needed to also add dev/*Spec.js and then the test file was found and ran. Is this a bug or am I configured incorrectly?

g0t4 commented 9 years ago

I'm having issues with paths like "tests//.js" in my karam.conf.js with version 0.8.0's new loading via karma's files property. It doesn't seem to load any matches for tests/.js, but it does load matches in subfolders

rolaveric commented 9 years ago

I do remember seeing the problem with src/**/*Spec.js globs expecting at least 1 subfolder in the path. But that appears to be the default behaviour for minimatch, which is the same library Karma uses for handling globs. So I'm not sure if there's anything I can do about it.

g0t4 commented 9 years ago

I just added the "base" folder to take care of it, so not a problem for me, maybe just add a note to the docs for this?