mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 12:25:53 +00:00
Bug 1383120
- [eslint-plugin-mozilla] Fix getTestType() helper so mochitests aren't treated as xpcshell tests, r=mossop
This also adds a11y as a test type. MozReview-Commit-ID: D7y3uALzVQx --HG-- extra : rebase_source : 6e3c886e28af2c406e86288d99482d59cf6d1852
This commit is contained in:
parent
e79746fcaa
commit
baddb0a4e7
@ -13,6 +13,7 @@ const INITIAL_WAIT_TIME = 100; // ms
|
||||
const MAX_WAIT_TIME = 20000; // ms
|
||||
const MAX_PROFILER_ENTRIES = 10000000;
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function run_test() {
|
||||
// Ensure the profiler is not running when the test starts (it could
|
||||
// happen if the MOZ_PROFILER_STARTUP environment variable is set).
|
||||
|
@ -517,10 +517,11 @@ module.exports = {
|
||||
* Test type: xpcshell, browser, chrome, mochitest
|
||||
*/
|
||||
getTestType(scope) {
|
||||
let testTypes = ["browser", "xpcshell", "chrome", "mochitest", "a11y"];
|
||||
let manifest = this.getTestManifest(scope);
|
||||
if (manifest) {
|
||||
let name = path.basename(manifest);
|
||||
for (let testType of ["browser", "xpcshell", "chrome", "mochitest"]) {
|
||||
for (let testType of testTypes) {
|
||||
if (name.startsWith(testType)) {
|
||||
return testType;
|
||||
}
|
||||
@ -535,9 +536,18 @@ module.exports = {
|
||||
}
|
||||
|
||||
if (filename.startsWith("test_")) {
|
||||
return "xpcshell";
|
||||
let parent = path.basename(path.dirname(filepath));
|
||||
for (let testType of testTypes) {
|
||||
if (parent.startsWith(testType)) {
|
||||
return testType;
|
||||
}
|
||||
}
|
||||
|
||||
// It likely is a test, we're just not sure what kind.
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
// Likely not a test
|
||||
return null;
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user