Skip to content

Add some sugar to simplify test assertions #11626

@gaearon

Description

@gaearon

I made tests a bit too verbose in #11616.
Might be a good time to revisit how we write them now.

There's a few separate issues:

  • Asserting on warning messages is too verbose. Need a DEV block, call spyOnDev, normalize stack, etc. Ideally I wish there was a higher level helper that lets us "push" expected warning assertions and validate them as they happen. It should handle component stacks automatically without having to copy-paste the normalization helper everywhere.

  • In some cases I added actual duplication in Run Jest in production mode #11616, in particular for cases that throw in development but don't throw in production. Maybe need a toThrowInDev()? Although on the other hand this pattern needs to be highly visible so maybe extracting common code in a closure is good enough.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions