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

Only loading a subset of files #180

Open
nello opened this issue Oct 18, 2016 · 2 comments
Open

Only loading a subset of files #180

nello opened this issue Oct 18, 2016 · 2 comments

Comments

@nello
Copy link

nello commented Oct 18, 2016

We've been using karma-jspm in our build for some time and have recently come to the confused realisation that some of our tests are no longer being run.

The config:

jspm: {
  ...
  loadFiles: ['client/testSupport/*.js', 'client/app/**/*.spec.js'],
  ...
}

loads 1681 tests.

The config:

jspm: {
  ...
  loadFiles: ['client/testSupport/*.js', 'client/app/services/**/*.spec.js'],
  ...
}

loads 428 tests, none of which were loaded in the previous config.

Bizarrely:

jspm: {
  ...
  loadFiles: ['client/testSupport/*.js', 'client/app/services/**/*.spec.js', 'client/app/**/*.spec.js'],
  ...
}

loads all 2109 tests.

And even more confusingly:

jspm: {
  ...
  loadFiles: ['client/testSupport/*.js', 'client/app/services/**/*.spec.js', 'client/app/**/*.spec.js'],
  ...
}

only loads 1681.

No clues here. Is there some kind of strange file limit being reached?

@SerkanSipahi
Copy link
Collaborator

@nello please share your karma.conf.js ... i had a similar problem ...

@nello
Copy link
Author

nello commented Mar 29, 2017

Ours came down to a silently-failing error in one of our tests that halted further execution. We figured it out by progressively bisecting the tests being executed.

The first fix we applied was to ensure that the file pattern provided could not miss all our tests. This effectively quarantined the issue.

-      loadFiles: ['client/testSupport/*.js', envValue('KARMA_SPEC_FILE_PATTERN',
-        'client/app/**/*.spec.js')],

+      loadFiles: ['client/testSupport/*.js',  
+        envValue('KARMA_SPEC_FILE_PATTERN', 'client/app/services/**/*.spec.js'),
+        envValue('KARMA_SPEC_FILE_PATTERN', 'client/app/**/*.spec.js')],

The "missing" tests were in client/app/services/**, so then we ran each folder of tests individually, finding a number of failing tests that had not been executing due to this bug. Fixing one of those tests suddenly allowed us to see the rest of the tests in that file and that folder.

I've just gone back and reviewed the fixes done at the time and even knowing what was happening doesn't help. Nothing stands out as being the obvious culprit.

This is just a still-existent bug, waiting to catch the next person unfortunate enough to stumble over it. We now monitor the number of tests we are executing, and if it drops precipitously we get out the microscope. Sigh.

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

2 participants