test: add disabled tests list (#37334)

This commit is contained in:
Calvin 2023-02-28 15:27:54 -07:00 committed by GitHub
parent 87f2a1d572
commit 1f390119fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

3
spec/disabled-tests.json Normal file
View file

@ -0,0 +1,3 @@
[
"// NOTE: this file is used to disable tests in our test suite by their full title."
]

View file

@ -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.