|
| 1 | +/** |
| 2 | + * Directive registry - exports all directive handlers |
| 3 | + */ |
| 4 | + |
| 5 | +export * from "./types.js" |
| 6 | +export { skip } from "./skip.js" |
| 7 | +export { description } from "./description.js" |
| 8 | +export { expectError } from "./expectError.js" |
| 9 | +export { expectNoError } from "./expectNoError.js" |
| 10 | +export { expectOutput } from "./expectOutput.js" |
| 11 | +export { expectOutputRegex } from "./expectOutputRegex.js" |
| 12 | +export { expectReturn } from "./expectReturn.js" |
| 13 | +export { expectReturnJson } from "./expectReturnJson.js" |
| 14 | +export { awaitDirective } from "./await.js" |
| 15 | +export { timeoutDirective } from "./timeout.js" |
| 16 | +export { returnStatementDirective } from "./returnStatement.js" |
| 17 | + |
| 18 | +import type { AnyDirective } from "./types.js" |
| 19 | +import { skip } from "./skip.js" |
| 20 | +import { description } from "./description.js" |
| 21 | +import { expectError } from "./expectError.js" |
| 22 | +import { expectNoError } from "./expectNoError.js" |
| 23 | +import { expectOutput } from "./expectOutput.js" |
| 24 | +import { expectOutputRegex } from "./expectOutputRegex.js" |
| 25 | +import { expectReturn } from "./expectReturn.js" |
| 26 | +import { expectReturnJson } from "./expectReturnJson.js" |
| 27 | +import { awaitDirective } from "./await.js" |
| 28 | +import { timeoutDirective } from "./timeout.js" |
| 29 | +import { returnStatementDirective } from "./returnStatement.js" |
| 30 | + |
| 31 | +/** |
| 32 | + * All built-in directives |
| 33 | + */ |
| 34 | +export const allDirectives: AnyDirective[] = [ |
| 35 | + skip, |
| 36 | + description, |
| 37 | + expectError, |
| 38 | + expectNoError, |
| 39 | + expectOutput, |
| 40 | + expectOutputRegex, |
| 41 | + expectReturn, |
| 42 | + expectReturnJson, |
| 43 | + awaitDirective, |
| 44 | + timeoutDirective, |
| 45 | + returnStatementDirective, |
| 46 | +] |
| 47 | + |
| 48 | +/** |
| 49 | + * Directives grouped by type |
| 50 | + */ |
| 51 | +export const directives = { |
| 52 | + control: [skip, description], |
| 53 | + assertion: [expectError, expectNoError, expectOutput, expectOutputRegex, expectReturn, expectReturnJson], |
| 54 | + transform: [awaitDirective, returnStatementDirective], |
| 55 | + config: [timeoutDirective], |
| 56 | +} |
| 57 | + |
| 58 | +/** |
| 59 | + * Get directive by name |
| 60 | + */ |
| 61 | +export function getDirectiveByName(name: string): AnyDirective | undefined { |
| 62 | + return allDirectives.find(d => d.name === name) |
| 63 | +} |
0 commit comments