-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate shadowDom.scenario.ts to Playwright
- Loading branch information
1 parent
f0c939f
commit dc360fb
Showing
4 changed files
with
41 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
let currentSpec: jasmine.SpecResult | null = null | ||
|
||
export function getCurrentJasmineSpec() { | ||
if (typeof globalThis['jasmine'] !== 'object') { | ||
throw new Error('Not inside a Jasmine test') | ||
} | ||
return currentSpec | ||
} | ||
|
||
jasmine.getEnv().addReporter({ | ||
specStarted(specResult) { | ||
currentSpec = specResult | ||
}, | ||
specDone() { | ||
currentSpec = null | ||
}, | ||
}) | ||
if (typeof globalThis['jasmine'] === 'object') { | ||
globalThis['jasmine'].getEnv().addReporter({ | ||
specStarted(specResult) { | ||
currentSpec = specResult | ||
}, | ||
specDone() { | ||
currentSpec = null | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
const cleanupTasks: Array<() => void> = [] | ||
|
||
export function registerCleanupTask(task: () => void) { | ||
if (typeof globalThis['afterEach'] !== 'function') { | ||
throw new Error('Not inside a Jasmine test') | ||
} | ||
cleanupTasks.unshift(task) | ||
} | ||
|
||
afterEach(() => { | ||
cleanupTasks.splice(0).forEach((task) => task()) | ||
}) | ||
if (typeof globalThis['afterEach'] === 'function') { | ||
afterEach(() => { | ||
cleanupTasks.splice(0).forEach((task) => task()) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters