Skip to content

Commit

Permalink
wait for stream to finish at end of publish plugin (#2322)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjgoss authored Sep 3, 2023
1 parent 0a9fad0 commit 2c6161e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ Please see [CONTRIBUTING.md](./CONTRIBUTING.md) on how to contribute to Cucumber
### Added
- Support array notation of formats with path in configuration files ([#2318](https://github.com/cucumber/cucumber-js/pull/2318))

### Fixed
- Wait for stream to finish at end of publish plugin ([#2322](https://github.com/cucumber/cucumber-js/pull/2322))

## [9.4.0] - 2023-08-12
### Fixed
- Fix type import from cucumber-expressions ([#2310](https://github.com/cucumber/cucumber-js/pull/2310))
Expand Down
7 changes: 6 additions & 1 deletion src/publish/publish_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,13 @@ export const publishPlugin: Plugin = async ({
stream.pipe(readerStream)
stream.on('error', (error: Error) => logger.error(error.message))
on('message', (value) => stream.write(JSON.stringify(value) + '\n'))
return () => stream.end()
return () =>
new Promise<void>((resolve) => {
stream.on('finish', () => resolve())
stream.end()
})
}

/*
This is because the Cucumber Reports service returns a pre-formatted console message
including ANSI escapes, so if our stderr stream doesn't support those we need to
Expand Down

0 comments on commit 2c6161e

Please sign in to comment.