Repository navigation
test: make negative tests fail when nothing throws - #2953
Conversation
|
There was a problem hiding this comment.
All reported issues were addressed across 8 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #2953 +/- ##
========================================
Coverage 98.63% 98.63%
========================================
Files 70 70
Lines 2052 2052
Branches 625 625
========================================
Hits 2024 2024
Misses 28 28 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
14 "should throw" tests passed even when nothing threw. They used
try { return await minify() } catch { expect(err)… }, so a resolved promise skipped the assertion. They now assert the rejection:"cssnano minification failed"SyntaxError(the library's message text varies between versions).toThrow()with no argument (third-party messages)Tests only. No changeset.
Evidence
inputleft it green.After: the same edit fails it with
promise resolved … instead of rejecting.tests/fixtures/css-errorsrenamed, the cssnano and lightningcss tests now fail (they gotNo content provided). Before, any error passed them.bun run test: 71 files, 1080 tests pass. Lint, typecheck,ci-guard-type-suppressions.shpass.Merge Danger
Door: two-way
Blast Radius: tests
No runtime code changes.
Summary by cubic
Updates 14 "should throw" tests so they fail when
minify()resolves instead of rejecting. The oldtry/catchpattern returned successfully on a resolved promise and skipped the assertion; tests now useexpect(...).rejects.toThrow(...).Assertions
SyntaxErrorsince the library message varies between versions.Tests only, no changeset.
Written for commit a5e3413. Summary will update on new commits.