Skip to content
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

Bun run test fails to run bun test #16976

Open
silverbucket opened this issue Feb 1, 2025 · 3 comments
Open

Bun run test fails to run bun test #16976

silverbucket opened this issue Feb 1, 2025 · 3 comments
Labels
bug Something isn't working bun:test Something related to the `bun test` runner

Comments

@silverbucket
Copy link

What version of Bun is running?

1.2.2+c1708ea6a

What platform is your computer?

Darwin 23.6.0 arm64 arm

What steps can reproduce the bug?

Make a script command in package.json

"scripts": {
  "test": "bun test ./src/**/*.test.ts"
}

Run: bun run test

What is the expected behavior?

The same command should produce the same results regardless if it's executed from a package.json script.

What do you see instead?

Running bun test directly:

bun test ./src/**/*.test.ts
bun test v1.2.2 (c1708ea6)

src/activity-streams.test.ts:
✓ warn test > rejects nondefined special types
✓ no special props > init
✓ no special props > returns expected object with no special types [0.19ms]
✓ basic tests > object tests > has expected structure
✓ basic tests > object tests > returns undefined when no params are passed [0.01ms]
✓ basic tests > object tests > returns object when given a valid lookup id [0.02ms]
✓ basic tests > object tests > throws an exception when called with no identifier [0.02ms]
✓ basic tests > object tests > creates a second object and returns is as expected [0.01ms]
✓ basic tests > object tests > returns a basic ActivtyObject when receiving an unknown id with expand=true
✓ basic tests > object tests > returns given id param when lookup fails and expand=false [0.03ms]
✓ basic tests > stream tests > renames mapped props
✓ basic tests > stream tests > expands existing objects [0.01ms]
✓ basic tests > stream tests > handles customProps as expected
✓ basic tests > stream tests > respects specialObj properties [0.04ms]
✓ basic tests > stream tests > rejects nondefined special types [0.02ms]
✓ basic tests > emitters > emits an event on object creation [0.10ms]
✓ basic tests > emitters > emits an event on object deletion [0.04ms]
✓ basic tests > init
-------------------------|---------|---------|-------------------
File                     | % Funcs | % Lines | Uncovered Line #s
-------------------------|---------|---------|-------------------
All files                |   93.33 |   98.09 |
 src/activity-streams.ts |   93.33 |   98.09 | 155-157
-------------------------|---------|---------|-------------------

 18 pass
 0 fail
 30 expect() calls
Ran 18 tests across 1 files. [14.00ms]

Running bun run test:

bun run test
$ bun test ./src/**/*.test.ts
bun test v1.2.2 (c1708ea6)
error: ModuleNotFound resolving "./src/**/*.test.ts" (entry point)
error: script "test" exited with code 1

Additional information

No response

@silverbucket silverbucket added bug Something isn't working needs triage labels Feb 1, 2025
@silverbucket
Copy link
Author

Removing ./ from the path prefix changes the result (still doesn't work):

bun run test
$ bun test src/**/*.test.ts
bun test v1.2.2 (c1708ea6)
The following filters did not match any test files:
  src/**/*.test.ts
11 files were searched [3.00ms]

note: Tests need ".test", "_test_", ".spec" or "_spec_" in the filename (ex: "MyApp.test.ts")
note: To treat the "src/**/*.test.ts" filter as a path, run "bun test ./src/**/*.test.ts"

Learn more about the test runner: https://bun.sh/docs/cli/test

@Jarred-Sumner
Copy link
Collaborator

For some reason, your shell is not expanding the path before it reaches Bun

@RiskyMH RiskyMH added bun:test Something related to the `bun test` runner and removed needs triage labels Feb 2, 2025
@silverbucket
Copy link
Author

silverbucket commented Feb 2, 2025

@Jarred-Sumner Using ohmyzsh, never had any issues before. I just tried with bash and got the same results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working bun:test Something related to the `bun test` runner
Projects
None yet
Development

No branches or pull requests

3 participants