Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,7 @@ export function test(title: string, callback?: TestExecutor<TestContext, undefin
test.group = function (title: string, callback: (group: Group) => void): Group {
validator.ensureIsInPlanningPhase(executionPlanState.phase)

const group = createTestGroup(
title,
emitter,
runnerConfig!.refiner,
executionPlanState
)
const group = createTestGroup(title, emitter, runnerConfig!.refiner, executionPlanState)
executionPlanState.group = group

/**
Expand Down Expand Up @@ -133,6 +128,14 @@ export function getActiveTest() {
return activeTest
}

/**
* Get the test of currently running test or throw an error
*/
export function getActiveTestOrFail() {
if (!activeTest) throw new Error('Cannot access active test outside of a test callback')
return activeTest
}

/**
* Make Japa process command line arguments. Later the parsed output
* will be used by Japa to compute the configuration
Expand Down