Skip to content

Commit 2c6161e

Browse files
authored
wait for stream to finish at end of publish plugin (#2322)
1 parent 0a9fad0 commit 2c6161e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ Please see [CONTRIBUTING.md](./CONTRIBUTING.md) on how to contribute to Cucumber
1111
### Added
1212
- Support array notation of formats with path in configuration files ([#2318](https://github.com/cucumber/cucumber-js/pull/2318))
1313

14+
### Fixed
15+
- Wait for stream to finish at end of publish plugin ([#2322](https://github.com/cucumber/cucumber-js/pull/2322))
16+
1417
## [9.4.0] - 2023-08-12
1518
### Fixed
1619
- Fix type import from cucumber-expressions ([#2310](https://github.com/cucumber/cucumber-js/pull/2310))

src/publish/publish_plugin.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,13 @@ export const publishPlugin: Plugin = async ({
3535
stream.pipe(readerStream)
3636
stream.on('error', (error: Error) => logger.error(error.message))
3737
on('message', (value) => stream.write(JSON.stringify(value) + '\n'))
38-
return () => stream.end()
38+
return () =>
39+
new Promise<void>((resolve) => {
40+
stream.on('finish', () => resolve())
41+
stream.end()
42+
})
3943
}
44+
4045
/*
4146
This is because the Cucumber Reports service returns a pre-formatted console message
4247
including ANSI escapes, so if our stderr stream doesn't support those we need to

0 commit comments

Comments
 (0)