Bug 1465385 - Enable ESLint rule require-expected-throws-or-rejects for browser/. r=MattN

MozReview-Commit-ID: GoVFNM7CFDu

--HG--
extra : rebase_source : f1e9bfdaa1396b2ce27ee499fc547f239ca132a9
This commit is contained in:
Mark Banner 2018-05-30 11:50:45 +01:00
parent ea0d874fa8
commit 7b90b63d69
5 changed files with 11 additions and 12 deletions

View File

@ -52,9 +52,6 @@ module.exports = {
// XXX Bug 1452706. These directories are still being fixed, so turn off // XXX Bug 1452706. These directories are still being fixed, so turn off
// mozilla/require-expected-throws-or-rejects for now. // mozilla/require-expected-throws-or-rejects for now.
"files": [ "files": [
"browser/extensions/formautofill/test/unit/test_storage_tombstones.js",
"browser/modules/test/browser/**",
"browser/tools/mozscreenshots/browser_boundingbox.js",
"devtools/client/inspector/extensions/test/head_devtools_inspector_sidebar.js", "devtools/client/inspector/extensions/test/head_devtools_inspector_sidebar.js",
"storage/test/unit/**", "storage/test/unit/**",
"testing/marionette/test/unit/**", "testing/marionette/test/unit/**",

View File

@ -121,18 +121,21 @@ add_storage_task(async function test_add_tombstone(storage, record) {
add_storage_task(async function test_add_tombstone_without_guid(storage, record) { add_storage_task(async function test_add_tombstone_without_guid(storage, record) {
info("Should not be able to add a new tombstone without specifying the guid"); info("Should not be able to add a new tombstone without specifying the guid");
Assert.throws(() => { storage.add({deleted: true}); }); Assert.throws(() => { storage.add({deleted: true}); },
/Record missing GUID/);
Assert.equal(storage.getAll({includeDeleted: true}).length, 0); Assert.equal(storage.getAll({includeDeleted: true}).length, 0);
}); });
add_storage_task(async function test_add_tombstone_existing_guid(storage, record) { add_storage_task(async function test_add_tombstone_existing_guid(storage, record) {
info("Should not be able to add a new tombstone when a record with that ID exists"); info("Should not be able to add a new tombstone when a record with that ID exists");
let guid = storage.add(record); let guid = storage.add(record);
Assert.throws(() => { storage.add({guid, deleted: true}); }); Assert.throws(() => { storage.add({guid, deleted: true}); },
/a record with this GUID already exists/);
// same if the existing item is already a tombstone. // same if the existing item is already a tombstone.
storage.add({guid: "test-guid-1", deleted: true}); storage.add({guid: "test-guid-1", deleted: true});
Assert.throws(() => { storage.add({guid: "test-guid-1", deleted: true}); }); Assert.throws(() => { storage.add({guid: "test-guid-1", deleted: true}); },
/a record with this GUID already exists/);
}); });
add_storage_task(async function test_update_tombstone(storage, record) { add_storage_task(async function test_update_tombstone(storage, record) {

View File

@ -15,7 +15,7 @@ add_task(async function testTempAllowThrows() {
await BrowserTestUtils.withNewTab(uri.spec, function(browser) { await BrowserTestUtils.withNewTab(uri.spec, function(browser) {
Assert.throws(function() { Assert.throws(function() {
SitePermissions.set(uri, id, SitePermissions.ALLOW, SitePermissions.SCOPE_TEMPORARY, browser); SitePermissions.set(uri, id, SitePermissions.ALLOW, SitePermissions.SCOPE_TEMPORARY, browser);
}, "'Block' is the only permission we can save temporarily on a tab"); }, /'Block' is the only permission we can save temporarily on a browser/);
}); });
}); });
@ -91,4 +91,3 @@ add_task(async function testGetAllPermissionDetailsForBrowser() {
BrowserTestUtils.removeTab(gBrowser.selectedTab); BrowserTestUtils.removeTab(gBrowser.selectedTab);
}); });

View File

@ -562,8 +562,8 @@ add_task(async function test_shutdown_while_not_showing() {
UnsubmittedCrashHandler.uninit(); UnsubmittedCrashHandler.uninit();
Assert.throws(() => { Assert.throws(() => {
UnsubmittedCrashHandler.prefs.getBoolPref("shutdownWhileShowing"); UnsubmittedCrashHandler.prefs.getBoolPref("shutdownWhileShowing");
}, "We should have noticed that the notification had closed before " + }, /NS_ERROR_UNEXPECTED/,
"uninitting."); "We should have noticed that the notification had closed before uninitting.");
UnsubmittedCrashHandler.init(); UnsubmittedCrashHandler.init();
clearPendingCrashReports(); clearPendingCrashReports();

View File

@ -93,10 +93,10 @@ add_task(async function() {
// Check that nonexistent selectors throws an exception // Check that nonexistent selectors throws an exception
Assert.throws(() => { Assert.throws(() => {
TestRunner._findBoundingBox(["#does_not_exist"]); TestRunner._findBoundingBox(["#does_not_exist"]);
}, "No element for '#does_not_exist' found.", "Checking that nonexistent selectors throws an exception"); }, /No element for '#does_not_exist' found/, "Checking that nonexistent selectors throws an exception");
// Check that no selectors throws an exception // Check that no selectors throws an exception
Assert.throws(() => { Assert.throws(() => {
TestRunner._findBoundingBox([]); TestRunner._findBoundingBox([]);
}, "No selectors specified.", "Checking that no selectors throws an exception"); }, /No selectors specified/, "Checking that no selectors throws an exception");
}); });