Bug 1331505 - Stop GCLI addon list from showing hidden addons r=jdescottes

A really simple one. We just remove all of the hidden add-ons from the add-on list in GCLI before processing them.

There was no way for GCLI tests to check that a value did not exist so I added it because we needed to check for all of our hidden add-ons:

  - Web Compat
  - FlyWeb
  - Pocket
  - Multi-process staged rollout
  - Form Autofill
  - Application Update Service Helper
  - Presentation
  - Shield Recipe Client

MozReview-Commit-ID: 3kx5FOEJSQB

--HG--
extra : rebase_source : c02f541b0782b42d7def8ac7b56c2946b793e2a6
This commit is contained in:
Michael Ratcliffe 2017-01-17 16:05:36 +00:00
parent e767d90101
commit 509bc64559
3 changed files with 45 additions and 11 deletions

View File

@ -33,7 +33,11 @@ function* spawnTest() {
status: "VALID"
},
exec: {
output: [/The following/, /Mochitest/, /Special Powers/]
output: [/The following/, /Mochitest/, /Special Powers/],
notinoutput: [
/Web Compat/, /FlyWeb/, /Pocket/, /Multi-process staged rollout/,
/Form Autofill/, /Application Update Service Helper/, /Presentation/,
/Shield Recipe Client/]
}
},
{

View File

@ -1030,32 +1030,55 @@ var { helpers, assert } = (function () {
}
return convertPromise.then(function (textOutput) {
// Test that a regular expression has at least one match in a string.
var doTest = function (match, against) {
// Only log the real textContent if the test fails
if (against.match(match) != null) {
assert.ok(true, "html output for '" + name + "' " +
"should match /" + (match.source || match) + "/");
assert.ok(true,
`html output for '${name}' should match /${match.source || match}/`);
} else {
assert.ok(false, "html output for '" + name + "' " +
"should match /" + (match.source || match) + "/. " +
'Actual textContent: "' + against + '"');
assert.ok(false,
`html output for '${name}' should match /${match.source || match}/. ` +
`Actual textContent: "${against}"`);
}
};
// Test that a regular expression has no matches in a string.
var doTestNot = function (match, against) {
// Only log the real textContent if the test fails
if (against.match(match) != null) {
assert.ok(false,
`html output for '${name}' should not match /` +
`${match.source || match}/. Actual textContent: "${against}"`);
} else {
assert.ok(true,
`html output for '${name}' should not match /${match.source || match}/`);
}
};
if (typeof expected.output === "string") {
assert.is(textOutput,
expected.output,
"html output for " + name);
}
else if (Array.isArray(expected.output)) {
`html output for '${name}'`);
} else if (Array.isArray(expected.output)) {
expected.output.forEach(function (match) {
doTest(match, textOutput);
});
}
else {
} else {
doTest(expected.output, textOutput);
}
if (typeof expected.notinoutput === "string") {
assert.ok(textOutput.indexOf(expected.notinoutput) === -1,
`html output for "${name}" doesn't contain "${expected.notinoutput}"`);
} else if (Array.isArray(expected.notinoutput)) {
expected.notinoutput.forEach(function (match) {
doTestNot(match, textOutput);
});
} else if (typeof expected.notinoutput !== "undefined") {
doTestNot(expected.notinoutput, textOutput);
}
if (expected.error) {
cli.logErrors = origLogErrors;
}

View File

@ -114,6 +114,12 @@ var items = [
exec: function (args, context) {
let types = (args.type === "all") ? null : [ args.type ];
return getAddonsByTypes(types).then(addons => {
// Remove all hidden add-ons.
addons = addons.filter(addon => {
return !addon.hidden;
});
// Change the add-ons array to something we can work with.
addons = addons.map(function (addon) {
return {
name: addon.name,
@ -122,6 +128,7 @@ var items = [
pendingOperations: pendingOperations(addon)
};
});
return { addons: addons, type: args.type };
});
}