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

Angular tests crashing #10770

Closed
johanndev opened this issue May 2, 2024 · 1 comment
Closed

Angular tests crashing #10770

johanndev opened this issue May 2, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@johanndev
Copy link

What version of Bun is running?

1.1.6+e58d67b46

What platform is your computer?

Microsoft Windows NT 10.0.22631.0 x64

What steps can reproduce the bug?

  1. Create a new angular project:
    bun --bun create @angular@latest ng-bun-test --style css --ssr false
  2. Run tests:
    bun test

What is the expected behavior?

Tests are successfully executed.

What do you see instead?

The execution crashes with: Need to call TestBed.initTestEnvironment() first

Full log ``` ➜ bun test bun test v1.1.6 (e58d67b)

src\app\app.component.spec.ts:
1995 | * @internal strip this from published d.ts files due to
1996 | * microsoft/TypeScript#36216
1997 | */
1998 | get compiler() {
1999 | if (this._compiler === null) {
2000 | throw new Error(Need to call TestBed.initTestEnvironment() first);
^
error: Need to call TestBed.initTestEnvironment() first
at compiler (D:\scratch\ng-bun-test\node_modules@angular\core\fesm2022\testing.mjs:2000:19)
at configureTestingModule (D:\scratch\ng-bun-test\node_modules@angular\core\fesm2022\testing.mjs:1903:9)
at D:\scratch\ng-bun-test\src\app\app.component.spec.ts:6:11
at D:\scratch\ng-bun-test\src\app\app.component.spec.ts:5:14
✗ AppComponent > should create the app [2.67ms]
✗ AppComponent > should create the app
1995 | * @internal strip this from published d.ts files due to
1996 | * microsoft/TypeScript#36216
1997 | */
1998 | get compiler() {
1999 | if (this._compiler === null) {
2000 | throw new Error(Need to call TestBed.initTestEnvironment() first);
^
error: Need to call TestBed.initTestEnvironment() first
at compiler (D:\scratch\ng-bun-test\node_modules@angular\core\fesm2022\testing.mjs:2000:19)
at configureTestingModule (D:\scratch\ng-bun-test\node_modules@angular\core\fesm2022\testing.mjs:1903:9)
at D:\scratch\ng-bun-test\src\app\app.component.spec.ts:6:11
at D:\scratch\ng-bun-test\src\app\app.component.spec.ts:5:14
✗ AppComponent > should have the 'ng-bun-test' title [3.71ms]
✗ AppComponent > should have the 'ng-bun-test' title
1995 | * @internal strip this from published d.ts files due to
1996 | * microsoft/TypeScript#36216
1997 | */
1998 | get compiler() {
1999 | if (this._compiler === null) {
2000 | throw new Error(Need to call TestBed.initTestEnvironment() first);
^
error: Need to call TestBed.initTestEnvironment() first
at compiler (D:\scratch\ng-bun-test\node_modules@angular\core\fesm2022\testing.mjs:2000:19)
at configureTestingModule (D:\scratch\ng-bun-test\node_modules@angular\core\fesm2022\testing.mjs:1903:9)
at D:\scratch\ng-bun-test\src\app\app.component.spec.ts:6:11
at D:\scratch\ng-bun-test\src\app\app.component.spec.ts:5:14
✗ AppComponent > should render title [4.81ms]
✗ AppComponent > should render title

0 pass
6 fail
Ran 6 tests across 1 files. [424.00ms]

</details>

### Additional information

_No response_
@johanndev johanndev added the bug Something isn't working label May 2, 2024
@johanndev
Copy link
Author

Addendum: Running the angular test runner via bun run ng test works as expected. As the current angular test setup relies on karma, I'm not sure if there is anything that the bun test runner could do.

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

No branches or pull requests

1 participant