MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / setRestartStrategy

Function setRestartStrategy

lib/helper/extras/PlaywrightRestartOpts.js:9–32  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

7let restarts = null
8
9export function setRestartStrategy(options) {
10 const { restart } = options
11 const stringOpts = Object.keys(RESTART_OPTS)
12
13 if (stringOpts.includes(restart)) {
14 return (restarts = restart)
15 }
16
17 // When restart is false, don't restart anything
18 if (restart === false) {
19 restarts = null
20 return
21 }
22
23 // When restart is true, map to 'browser' restart
24 if (restart === true) {
25 restarts = 'browser'
26 return
27 }
28
29 restarts = Object.keys(RESTART_OPTS).find(key => RESTART_OPTS[key] === restart)
30
31 if (restarts === null || restarts === undefined) throw new Error('No restart strategy set, use the following values for restart: session, context, browser')
32}
33
34export function restartsSession() {
35 return restarts === 'session'

Callers 1

_setConfigMethod · 0.90

Calls 2

includesMethod · 0.80
findMethod · 0.45

Tested by

no test coverage detected