Skip to content

Commit ac3ef58

Browse files
committed
test(e2e): log progress
1 parent 4c40f0a commit ac3ef58

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

feature-runner/run-features.ts

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { CloudFormationClient } from '@aws-sdk/client-cloudformation'
22
import { SSMClient } from '@aws-sdk/client-ssm'
33
import { runFolder } from '@nordicsemiconductor/bdd-markdown'
44
import { stackOutput } from '@nordicsemiconductor/cloudformation-helpers'
5+
import chalk from 'chalk'
56
import path from 'node:path'
67
import type { StackOutputs } from '../cdk/RegistryStack.js'
78
import { STACK_NAME } from '../cdk/stackConfig.js'
@@ -16,14 +17,33 @@ export type World = {
1617
stackName: string
1718
} & Record<string, any>
1819

20+
const print = (arg: unknown) =>
21+
typeof arg === 'object' ? JSON.stringify(arg) : arg
22+
1923
const runner = await runFolder<World>({
2024
folder: path.join(process.cwd(), 'features'),
2125
name: 'Public Parameter Registry',
2226
logObserver: {
23-
onDebug: console.debug,
24-
onError: console.error,
25-
onInfo: console.log,
26-
onProgress: console.debug,
27+
onDebug: (info, ...args) =>
28+
console.error(
29+
chalk.magenta(info.context.keyword),
30+
...args.map((arg) => chalk.cyan(print(arg))),
31+
),
32+
onError: (info, ...args) =>
33+
console.error(
34+
chalk.magenta(info.context.keyword),
35+
...args.map((arg) => chalk.red(print(arg))),
36+
),
37+
onInfo: (info, ...args) =>
38+
console.error(
39+
chalk.magenta(info.context.keyword),
40+
...args.map((arg) => chalk.green(print(arg))),
41+
),
42+
onProgress: (info, ...args) =>
43+
console.error(
44+
chalk.magenta(info.context.keyword),
45+
...args.map((arg) => chalk.yellow(print(arg))),
46+
),
2747
},
2848
})
2949

0 commit comments

Comments
 (0)