(options)
| 7 | let restarts = null |
| 8 | |
| 9 | export 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 | |
| 34 | export function restartsSession() { |
| 35 | return restarts === 'session' |
no test coverage detected