-
Notifications
You must be signed in to change notification settings - Fork 15
attempting to fix ava issues #1320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
josephjclark
wants to merge
10
commits into
main
Choose a base branch
from
fix-ava
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e4b57c5
bump common version
josephjclark 7997c6f
bump undici
josephjclark 5efbe42
bump tsup
josephjclark 140ed99
update ava, nodemon, rimraf
josephjclark 192f010
update sentry
josephjclark 60dfbd0
bump lodash
josephjclark 23b1280
update jsonpath
josephjclark 4661b69
bump sentry testkit
josephjclark 25b9d94
bump glob
josephjclark a5a5d8b
attempting to fix ava issues
josephjclark File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import process from 'node:process'; | ||
| import { registerCompletionHandler } from 'ava'; | ||
|
|
||
| // For ava 6.0+ | ||
| // See https://github.com/avajs/ava/blob/main/docs/08-common-pitfalls.md#timeouts-because-a-file-failed-to-exit | ||
| // It might be better to do this on a per test basis | ||
| registerCompletionHandler(() => { | ||
| process.exit(); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,6 +81,7 @@ type MockSocketServer = typeof WebSocketServer & { | |
| events: Record<string, EventHandler> | ||
| ) => { unsubscribe: () => void }; | ||
| sendToClients: (message: PhoenixEvent) => void; | ||
| destroy: () => Promise<void>; | ||
| }; | ||
|
|
||
| function createServer({ | ||
|
|
@@ -140,7 +141,7 @@ function createServer({ | |
| }, | ||
| }; | ||
|
|
||
| // @ts-ignore something wierd about the wsServer typing | ||
| // @ts-ignore something weird about the wsServer typing | ||
| wsServer.on('connection', function (ws: DevSocket, req: any) { | ||
| logger?.info('new client connected'); | ||
| state.events.emit(CONNECT); // todo client details maybe | ||
|
|
@@ -286,6 +287,18 @@ function createServer({ | |
| }); | ||
| }; | ||
|
|
||
| mockServer.destroy = () => | ||
| new Promise<void>((resolve) => { | ||
| // Terminate WebSocket clients first so any pending socketDelay | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. claude has been pushing all sorts of weirdness here which at the end of the day just isn't working. |
||
| // setTimeout callbacks don't try to send on a destroyed socket. | ||
| (wsServer as any).clients.forEach((client: any) => client.terminate()); | ||
| // Also force-close any connections the HTTP server is still tracking | ||
| // (upgraded WS sockets may or may not still be in its pool depending | ||
| // on Node version). Without this, httpServer.close() can hang. | ||
| (wsServer as any)._server?.closeAllConnections?.(); | ||
| (wsServer as any).close(() => resolve()); | ||
| }); | ||
|
|
||
| return mockServer as MockSocketServer; | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ava says to do this in the docs, and I can see the export in the code. But at runtime I'm told that
registerCompletionHandlerdoes not exist!