ithaka / pharos

JSTOR's design system
https://pharos.jstor.org
MIT License
119 stars 15 forks source link

Remove noisy logs during unit testing #758

Open daneah opened 4 months ago

daneah commented 4 months ago

The problem I want the logs during unit testing to be mostly silent, so that when a message is printed it is a salient signal that there might be something worth looking at. Right now, the unit tests spit out quite a lot of mostly noisy information, which has and can continue to lead to missed signals about issues.

The solution Fix or disable the source of the noisy logs emitted during testing.

Additional information

Most of the logs are one of four things:

Lit is in dev mode. Not recommended for production! See https://lit.dev/msg/dev-mode for more information.

Arguably we should run Lit in production mode during testing, as it will stand a chance of catching more issues than if we run using dev mode. If we deem dev mode appropriate, we should filter out this log.

Multiple versions of Lit loaded. Loading multiple versions is not recommended. See https://lit.dev/msg/multiple-versions for more information.

This is likely due to Yarn resolutions not using an identical (major?) version of Lit for everything, which may get fixed naturally by #634.

Element test-pharos-* scheduled an update (generally because a property was set) after an update completed, causing a new update to be scheduled. This is inefficient and should be avoided unless the next update can only be scheduled as a side effect of the previous update. See https://lit.dev/msg/change-in-update for more information.

This one is a trickier component-level issue for several components, and we would potentially get mild performance benefits by fixing this at the source in addition to removing the log noise.

🚧 404 network requests on Webkit:

  • lib/styles/icons/fake.js

This is an expected error, as many tests use a fake icon which is not expected to exist. We should take care when silencing this only to silence the fake icons, lest we start silently failing to get real icons at some point.