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

JSDOM errors are ignored during test-unit runs #38362

Closed
goodov opened this issue May 16, 2024 · 0 comments · Fixed by brave/brave-core#23665
Closed

JSDOM errors are ignored during test-unit runs #38362

goodov opened this issue May 16, 2024 · 0 comments · Fixed by brave/brave-core#23665

Comments

@goodov
Copy link
Member

goodov commented May 16, 2024

While working on Teamcity jest reporting integration I've noticed that JSDOM errors are outputted into stdout, but do not trigger test failures. This does not look right as the test output does contain a clear error, but it's not bound to any test.

 $ cross-env NODE_OPTIONS=--no-experimental-fetch jest -t --verbose ./components/brave_wallet_ui/common/hooks/use-password-attempts.test.tsx
Error: Not implemented: window.alert
    at module.exports (D:\brave\3\src\brave\node_modules\jsdom\lib\jsdom\browser\not-implemented.js:9:17)
    at D:\brave\3\src\brave\node_modules\jsdom\lib\jsdom\browser\Window.js:866:7    at Object.lock (D:\brave\3\src\brave\components\brave_wallet_ui\common\async\__mocks__\bridge.ts:577:7)
    at Object.attemptPasswordEntry (D:\brave\3\src\brave\components\brave_wallet_ui\common\hooks\use-password-attempts.ts:48:26)
    at D:\brave\3\src\brave\components\brave_wallet_ui\common\hooks\use-password-attempts.test.tsx:58:7 undefined

<...>

 PASS  components/brave_wallet_ui/common/hooks/use-password-attempts.test.tsx   
  usePasswordAttempts hook
    √ should increment attempts on bad password & lock wallet after 3 failed attempts (56 ms)
    √ should return "true" for valid password (4 ms)
    √ should return "false" for invalid password (3 ms)

Test Suites: 1 passed, 1 total
Tests:       3 passed, 3 total
Snapshots:   0 total
Time:        1.751 s, estimated 4 s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants