Skip to content

Add some way to fail tests for unexpected warns & errors #2

@courajs

Description

@courajs

Previously in the cardstack/cardstack test suite, we were throwing an error if we log.warn or log.error, when not inside an expectWarn/expectError block: https://github.com/cardstack/cardstack/blob/532f62a03e08917d77261552014f9eb4a5bef3f8/packages/test-support/prepare-node-tests.js

We were doing that by hooking into the print method of the logger, and throwing if we saw a warn or log come through.

We should either:

  • Explicitly support this with a throwOnLogLevels configuration property or similar, and document its purpose for test suites, or
  • Just add some way to hook into all logs, or all logs of a level. We can document that it might be expensive, and it's mainly intended for test suite features.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions