[Tests] consider erroring tests on warnings #10376
Labels
1 - assigned
Issues that are assigned to a sprint and a team member.
estimate - 3
A day or two of work, likely requires updates to tests.
needs milestone
Planning workflow - pending milestone assignment, has priority and/or estimate.
p - low
Issue is non core or affecting less that 10% of people using the library
testing
Issues related to automated or manual testing.
Priority impact
p - low
Test type
E2E
Which Component(s)
Unstable Tests
At the moment, if console.error occurs during a component test, the test will fail:
calcite-design-system/packages/calcite-components/src/tests/setupTests.ts
Line 15 in 02e7124
In Lumina, the default behavior is to fail not just on console.error, but also on console.warn.
That behavior is chosen because generally components should not be emitting warnings - if they are, that might mean they are used incorrectly. If the test want to explicitly test incorrect/deprecated usage, then it can do so by explicitly mocking out console.warn and asserting that a given warning was triggered.
Options:
Change Calcite's setupFile to fail on console.warn too. If test is expecting console.warn to be called, it can mock it as follows:
Keep the current behavior and overwrite default Lumina behavior. Changing the current behavior is not a requirement for migrating - it's just an opportunity to rethink the options.
Test error, if applicable
No response
PR skipped, if applicable
Additional Info
No response
The text was updated successfully, but these errors were encountered: