mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-26 00:18:12 +08:00
* Disabled @blueprintjs/classes-constants. #2288. * thuang-eslint-bp-off (#2344) * Disabled @blueprintjs/classes-constants on webpack dev and shared. #2288. * Added TS recommended, suppress lint errors codemod. * Added per-error/warning ignore for tests. * Added per-error/warning ignore for configuration. * Added per-error/warning ignore for src. Removed suppress package. * Minor linting. Co-authored-by: Timmy Huang <tihuan@users.noreply.github.com>
41 lines
1.7 KiB
JavaScript
41 lines
1.7 KiB
JavaScript
// eslint-disable-next-line @typescript-eslint/no-var-requires --- FIXME: disabled temporarily on migrate to TS.
|
|
const PuppeteerEnvironment = require("jest-environment-puppeteer");
|
|
require("jest-circus");
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires --- FIXME: disabled temporarily on migrate to TS.
|
|
const ENV_DEFAULT = require("../../../environment.default.json");
|
|
|
|
// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'takeScreen... Remove this comment to see the full error message
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires --- FIXME: disabled temporarily on migrate to TS.
|
|
const takeScreenshot = require("./takeScreenshot");
|
|
|
|
class ScreenshotEnvironment extends PuppeteerEnvironment {
|
|
async handleTestEvent(event, state) {
|
|
if (["test_start", "test_done"].includes(event.name)) {
|
|
console.log("------------------event name:\n", event.name);
|
|
console.log("~~~~ Current test errors\n", new Date(), event.test.errors);
|
|
console.log("~~~~ Current test\n", new Date(), event.test);
|
|
}
|
|
|
|
if (event.name === "error") {
|
|
console.log("error event:", JSON.stringify(event));
|
|
}
|
|
|
|
if (event.name === "test_fn_failure" || event.name === "hook_failure") {
|
|
console.log("------------------event name:\n", event.name);
|
|
console.log(">>>> Current state\n", new Date(), state);
|
|
console.log("===> Failure event\n", new Date(), event);
|
|
|
|
// (thuang): We only want to take screenshot on the last try
|
|
if (
|
|
state.currentlyRunningTest.invocations <= ENV_DEFAULT.RETRY_ATTEMPTS
|
|
) {
|
|
return;
|
|
}
|
|
|
|
await takeScreenshot(state.currentlyRunningTest.name, this.global.page);
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = ScreenshotEnvironment;
|