Skip to content

Instantly share code, notes, and snippets.

@piuccio
Created May 27, 2015 14:14
Show Gist options
  • Save piuccio/8cc357b9ec7e248b5b68 to your computer and use it in GitHub Desktop.
Save piuccio/8cc357b9ec7e248b5b68 to your computer and use it in GitHub Desktop.
karma-jspm load only some tests
var filterTests = document.location.search.match(/[\?\&]test=[a-z-\.]+/gi).map(function (test) {
return (test.split('=')[1] + '.spec.js').toLowerCase();
}) || [];
var filterLoadedTests = filterTests.length ? function (spec) {
var found = false;
filterTests.forEach(function (test) {
found = found || spec.toLowerCase().indexOf(test) !== -1;
});
return found;
} : function () {
return true;
};
karma.config.jspm.resolvedModuleIDs = karma.config.jspm.resolvedModuleIDs.filter(filterLoadedTests);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment