fix: Prevent mocha tests failures when window does not have focus. (#9332)

* chore: Add puppeteer-core as a dev dependency.

* fix: Make mocha tests run in a fake-focused window.

* fix: Make `test:mocha:interactive` use the same gulp codepath as `test`.
This commit is contained in:
Aaron Dodson
2025-08-27 12:28:06 -07:00
committed by GitHub
parent 3d28ca8448
commit b2bbe965ba
5 changed files with 111 additions and 18 deletions

View File

@@ -257,9 +257,9 @@ async function metadata() {
* Run Mocha tests inside a browser.
* @return {Promise} Asynchronous result.
*/
async function mocha() {
async function mocha(exitOnCompletion = true) {
return runTestTask('mocha', async () => {
const result = await runMochaTestsInBrowser().catch(e => {
const result = await runMochaTestsInBrowser(exitOnCompletion).catch(e => {
throw e;
});
if (result) {
@@ -269,6 +269,14 @@ async function mocha() {
});
}
/**
* Run Mocha tests inside a browser and keep the browser open upon completion.
* @return {Promise} Asynchronous result.
*/
export async function interactiveMocha() {
return mocha(false);
}
/**
* Helper method for comparison file.
* @param {string} file1 First target file.