Skip to content

Commit

Permalink
style fixes for autoconfig loading
Browse files Browse the repository at this point in the history
  • Loading branch information
baev committed May 20, 2024
1 parent 893a38d commit 6fbfd54
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/allure-js-commons/src/TestRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,28 +102,29 @@ export const getGlobalTestRuntime = (): TestRuntime => {
return testRuntime() ?? noopRuntime;
}

// @ts-ignore
// eslint-disable-next-line @typescript-eslint/dot-notation
if ((globalThis as any)?.["_playwrightInstance"]) {
if ("_playwrightInstance" in globalThis) {
try {
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("allure-playwright/autoconfig");

return getGlobalTestRuntimeFunction()?.() ?? noopRuntime;
} catch (err) {
// eslint-disable-next-line no-console
console.log(err);
console.log("can't execute allure-playwright/autoconfig", err);
return noopRuntime;
}
// eslint-disable-next-line no-underscore-dangle
} else if ((globalThis as any)?.__vitest_environment__) {
}

if ("__vitest_environment__" in globalThis) {
try {
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("allure-vitest/autoconfig");

return getGlobalTestRuntimeFunction()?.() ?? noopRuntime;
} catch (err) {
// eslint-disable-next-line no-console
console.log(err);
console.log("can't execute allure-vitest/autoconfig", err);
return noopRuntime;
}
}

Expand Down

0 comments on commit 6fbfd54

Please sign in to comment.