diff --git a/spec/disabled-tests.json b/spec/disabled-tests.json new file mode 100644 index 000000000000..afafc539b21d --- /dev/null +++ b/spec/disabled-tests.json @@ -0,0 +1,3 @@ +[ + "// NOTE: this file is used to disable tests in our test suite by their full title." +] \ No newline at end of file diff --git a/spec/index.js b/spec/index.js index e374a41708ef..672464277d90 100644 --- a/spec/index.js +++ b/spec/index.js @@ -1,3 +1,4 @@ +const fs = require('fs'); const path = require('path'); const v8 = require('v8'); @@ -65,6 +66,18 @@ app.whenReady().then(async () => { } const mocha = new Mocha(mochaOptions); + // Add a root hook on mocha to skip any tests that are disabled + const disabledTests = new Set( + JSON.parse( + fs.readFileSync(path.join(__dirname, 'disabled-tests.json'), 'utf8') + ) + ); + mocha.suite.beforeEach(function () { + if (disabledTests.has(this.currentTest?.fullTitle())) { + this.skip(); + } + }); + // The cleanup method is registered this way rather than through an // `afterEach` at the top level so that it can run before other `afterEach` // methods.