Skip to content

Commit

Permalink
Add message on failing steps as soon as they are found.
Browse files Browse the repository at this point in the history
This ensures that the captured output is displayed to the user.
  • Loading branch information
joac committed Mar 22, 2023
1 parent 552a6ab commit 782109b
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 16 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build
on:
push:

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18.x.x'
cache: 'npm'
registry-url: 'https://registry.npmjs.org'

- name: Install deps
run: |
npm ci
- name: Build and test
run: |
npm run dist
- name: Publish
if: ${{github.ref == 'refs/heads/master' || startsWith(github.ref, 'ref/heads/hotfix-')}}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm publish
11 changes: 4 additions & 7 deletions features/output.feature
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ Scenario: Capture enabled and suppression disabled
"""
.logged-on-initial-context-stdout
.Hello world
......logged-on-initial-context-stdout
.....logged-on-initial-context-stdout
.Hello world
..F..
..F.
Failures:
Expand All @@ -91,7 +91,6 @@ Scenario: Capture enabled and suppression disabled
Hello world
✔ After
✔ After
2 scenarios (1 failed, 1 passed)
6 steps (1 failed, 5 passed)
Expand All @@ -110,7 +109,7 @@ Scenario: Capture enabled and suppression enabled
When the suite is executed
Then stdout contains
"""
...........F..
..........F.
Failures:
Expand All @@ -136,7 +135,6 @@ Scenario: Capture enabled and suppression enabled
Hello world
✔ After
✔ After
2 scenarios (1 failed, 1 passed)
6 steps (1 failed, 5 passed)
Expand All @@ -150,7 +148,7 @@ Scenario: Capture disabled and suppression enabled
When the suite is executed
Then stdout contains
"""
...........F..
..........F.
Failures:
Expand All @@ -162,7 +160,6 @@ Scenario: Capture disabled and suppression enabled
✖ Then error
Error: Error
✔ After
✔ After
2 scenarios (1 failed, 1 passed)
6 steps (1 failed, 5 passed)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pickled-cucumber",
"version": "4.0.0",
"version": "4.0.1",
"description": "Cucumber test runner with several condiments",
"main": "index.js",
"types": "index.d.ts",
Expand Down
10 changes: 2 additions & 8 deletions src/output.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
After,
AfterStep,
Before,
BeforeStep,
Status,
} from '@cucumber/cucumber';
import { AfterStep, Before, BeforeStep, Status } from '@cucumber/cucumber';
import {
AfterInitialContext,
AfterTeardown,
Expand Down Expand Up @@ -95,7 +89,7 @@ export const setupOutputCapture = (
AfterTeardown(restore);
AfterStep(restore);

After(({ result }) => {
AfterStep(({ result }) => {
if (capture && result && result.status === Status.FAILED) {
result.message += [
'',
Expand Down

0 comments on commit 782109b

Please sign in to comment.