Tweak test runner to support more directories
This expands the test filtering in the test runner so that you can supply e.g. `test/tests/feed*` from your shell in the `zotero` directory and correctly filter to all feed-related tests.
This commit is contained in:
parent
71dc4e9bf9
commit
bb9b796efe
1 changed files with 5 additions and 4 deletions
|
@ -210,12 +210,13 @@ var assert = chai.assert,
|
|||
|
||||
// Set up tests to run
|
||||
var run = ZoteroUnit.runTests;
|
||||
if(run && ZoteroUnit.tests) {
|
||||
if (run && ZoteroUnit.tests) {
|
||||
function getTestFilename(test) {
|
||||
// Allow foo, fooTest, fooTest.js, and tests/fooTest.js
|
||||
// Remove any directory prefixes e.g. tests/fooTest.js, test/tests/fooTest.js
|
||||
test = test.split(/[/\\]/).pop();
|
||||
// Allow foo, fooTest, fooTest.js
|
||||
test = test.replace(/\.js$/, "");
|
||||
test = test.replace(/Test$/, "");
|
||||
test = test.replace(/^tests[/\\]/, "");
|
||||
return test + "Test.js";
|
||||
}
|
||||
|
||||
|
@ -284,4 +285,4 @@ if(run) {
|
|||
return mocha.run();
|
||||
})
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue