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:
J. Ryan Stinnett 2021-05-07 14:39:21 +01:00
parent 71dc4e9bf9
commit bb9b796efe

View file

@ -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();
})
};
}
}