-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Synchronous concurrent test fix #22928
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
Merged
+261
−63
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
5d71906
concurrent immediate fix
pfgithub 4246e1c
concurrent promise fix
pfgithub 2fc4986
Merge remote-tracking branch 'origin/main' into pfg/synchronous-concu…
pfgithub b537fee
Fix timeouts
Jarred-Sumner 4fc0d65
Clean up a little bit
Jarred-Sumner 7921a1a
Merge branch 'main' into pfg/synchronous-concurrent
pfgithub de90183
remove synchronous timeout check
pfgithub c4d565b
Revert "remove synchronous timeout check"
Jarred-Sumner f117425
Update fs.test.ts
Jarred-Sumner 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
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 |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| beforeEach(() => { | ||
| console.log("beforeEach"); | ||
| }); | ||
| afterEach(() => { | ||
| console.log("afterEach"); | ||
| }); | ||
| test.concurrent("test 1", () => { | ||
| console.log("start test 1"); | ||
| }); | ||
| test.concurrent("test 2", () => { | ||
| console.log("start test 2"); | ||
| }); | ||
| test.concurrent("test 3", () => { | ||
| console.log("start test 3"); | ||
| }); |
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,59 @@ | ||
| import { expect, test } from "bun:test"; | ||
| import { bunEnv, bunExe, normalizeBunSnapshot } from "harness"; | ||
|
|
||
| test("describe/test", async () => { | ||
| const result = await Bun.spawn({ | ||
| cmd: [bunExe(), "test", import.meta.dir + "/concurrent_immediate.fixture.ts"], | ||
| stdout: "pipe", | ||
| stderr: "pipe", | ||
| env: bunEnv, | ||
| }); | ||
| const exitCode = await result.exited; | ||
| const stdout = await result.stdout.text(); | ||
| const stderr = await result.stderr.text(); | ||
| expect(exitCode).toBe(0); | ||
| expect(normalizeBunSnapshot(stdout)).toMatchInlineSnapshot(` | ||
| "bun test <version> (<revision>) | ||
| beforeEach | ||
| start test 1 | ||
| afterEach | ||
| beforeEach | ||
| start test 2 | ||
| afterEach | ||
| beforeEach | ||
| start test 3 | ||
| afterEach" | ||
| `); | ||
| }); | ||
|
|
||
| test("describe/test", async () => { | ||
| const result = await Bun.spawn({ | ||
| cmd: [bunExe(), "test", import.meta.dir + "/concurrent_immediate_error.fixture.ts"], | ||
| stdout: "pipe", | ||
| stderr: "pipe", | ||
| env: bunEnv, | ||
| }); | ||
| const exitCode = await result.exited; | ||
| const stdout = await result.stdout.text(); | ||
| const stderr = await result.stderr.text(); | ||
| expect(exitCode).toBe(1); | ||
| expect(normalizeBunSnapshot(stderr)).toMatchInlineSnapshot(` | ||
| "test/js/bun/test/concurrent_immediate_error.fixture.ts: | ||
| (pass) test 1 | ||
| 6 | }); | ||
| 7 | test.concurrent("test 1", () => { | ||
| 8 | console.log("start test 1"); | ||
| 9 | }); | ||
| 10 | test.concurrent("test 2", () => { | ||
| 11 | throw new Error("test 2 error"); | ||
| ^ | ||
| error: test 2 error | ||
| at <anonymous> (file:NN:NN) | ||
| (fail) test 2 | ||
| (pass) test 3 | ||
|
|
||
| 2 pass | ||
| 1 fail | ||
| Ran 3 tests across 1 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,15 @@ | ||
| beforeEach(() => { | ||
| console.log("beforeEach"); | ||
| }); | ||
| afterEach(() => { | ||
| console.log("afterEach"); | ||
| }); | ||
| test.concurrent("test 1", () => { | ||
| console.log("start test 1"); | ||
| }); | ||
| test.concurrent("test 2", () => { | ||
| throw new Error("test 2 error"); | ||
| }); | ||
| test.concurrent("test 3", () => { | ||
| console.log("start test 3"); | ||
| }); |
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.
Uh oh!
There was an error while loading. Please reload this page.