Bug 1466497 - Enable ESLint rule require-expected-throws-or-rejects for storage/test/unit. r?mak draft
authorMark Banner <standard8@mozilla.com>
Fri, 01 Jun 2018 14:03:20 +0100
changeset 804042 3d36e02d0f4b83993dd3f7c3162ecbb3c6ed6bb4
parent 804041 1b4273dbbf1c516076f453e06eb77f059dc4bb6b
push id112291
push userbmo:standard8@mozilla.com
push dateTue, 05 Jun 2018 13:20:29 +0000
reviewersmak
bugs1466497
milestone62.0a1
Bug 1466497 - Enable ESLint rule require-expected-throws-or-rejects for storage/test/unit. r?mak MozReview-Commit-ID: KZNpShBcfjJ
.eslintrc.js
storage/test/unit/test_js_helpers.js
storage/test/unit/test_storage_connection.js
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -47,25 +47,16 @@ module.exports = {
     ],
     "rules": {
       "mozilla/no-define-cc-etc": "off",
     }
   }, {
     // XXX Bug 1452706. These directories are still being fixed, so turn off
     //  mozilla/require-expected-throws-or-rejects for now.
     "files": [
-      "storage/test/unit/**",
-    ],
-    "rules": {
-      "mozilla/require-expected-throws-or-rejects": "off",
-    }
-  }, {
-    // XXX Bug 1452706. These directories are still being fixed, so turn off
-    //  mozilla/require-expected-throws-or-rejects for now.
-    "files": [
       "services/fxaccounts/**",
       "toolkit/components/**",
     ],
     "rules": {
       "mozilla/rejects-requires-await": "off",
     }
   }]
 };
--- a/storage/test/unit/test_js_helpers.js
+++ b/storage/test/unit/test_js_helpers.js
@@ -78,16 +78,17 @@ function test_row_enumerate() {
   // Save off the row helper, then forget the statement and trigger a GC.  We
   // want to ensure that if the row helper is retained but the statement is
   // destroyed, that no crash occurs and that the late access attempt simply
   // throws an error.
   let savedOffRow = stmt.row;
   stmt = null;
   Cu.forceGC();
   Assert.throws(() => { return savedOffRow.string; },
+                /NS_ERROR_NOT_INITIALIZED/,
                 "GC'ed statement should throw");
 }
 
 function test_params_gets_sync() {
   // Added for bug 562866.
   /*
   let stmt = createStatement(
     "SELECT * FROM test WHERE id IN (:a, :b, :c)"
--- a/storage/test/unit/test_storage_connection.js
+++ b/storage/test/unit/test_storage_connection.js
@@ -820,17 +820,17 @@ add_task(async function test_async_clone
   Assert.ok(names.includes("markh"));
 
   info("Create read-only clone");
   let readOnlyClone = await asyncClone(db, true);
   Assert.ok(readOnlyClone instanceof Ci.mozIStorageAsyncConnection);
 
   info("Read-only clone shouldn't have temp entities");
   let badStmt = readOnlyClone.createAsyncStatement(`SELECT 1 FROM test_temp`);
-  await Assert.rejects(executeAsync(badStmt));
+  await Assert.rejects(executeAsync(badStmt), Ci.mozIStorageError);
   badStmt.finalize();
 
   info("Clean up");
   for (let conn of [db, readWriteClone, readOnlyClone]) {
     await asyncClose(conn);
   }
 });