Skip to content

Commit

Permalink
refactor(test): expose test mode as re-exported variables
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsorban44 committed Mar 13, 2024
1 parent 3e6720c commit 461c737
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/lib/e2e-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,22 @@ if (testMode === 'dev') {
;(global as any).isNextStart = true
}

/**
* Whether the test is running in dev mode.
* Based on `process.env.NEXT_TEST_MODE` and the test directory.
*/
export const isNextDev = testMode === 'dev'
/**
* Whether the test is running in deploy mode.
* Based on `process.env.NEXT_TEST_MODE`.
*/
export const isNextDeploy = testMode === 'deploy'
/**
* Whether the test is running in start mode.
* Default mode. `true` when both `isNextDev` and `isNextDeploy` are false.
*/
export const isNextStart = !isNextDev && !isNextDeploy

if (!testMode) {
throw new Error(
`No 'NEXT_TEST_MODE' set in environment, this is required for e2e-utils`
Expand Down

0 comments on commit 461c737

Please sign in to comment.