Skip to content

Commit

Permalink
Wait for server to actually close before resolving promise
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuth committed Sep 18, 2024
1 parent 25e7a45 commit 12e3ff6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- [fix] Wait for server to close before ending the test run

## 8.2.0

- [new] Add parameter for Axe `context` [#98](https://github.com/chanzuckerberg/axe-storybook-testing/pull/98)
Expand Down
9 changes: 6 additions & 3 deletions src/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,12 @@ async function getServer(options: Options): Promise<Server> {
});
}

function stop() {
server.close();
return Promise.resolve();
function stop(): Promise<void> {
return new Promise((resolve) => {
server.close(() => {
resolve();
});
});
}

return {storybookUrl, start, stop};
Expand Down

0 comments on commit 12e3ff6

Please sign in to comment.