-
-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip warnings in test contexts. #441
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I’m unsure.
The concept of dev vs prod goes beyond Node.js, and I would rather introduce a more abstract setting and code that tweaks it based on NODE_ENV
when appropriate, rather than use NODE_ENV
all over our codebase, going to the extent of mocking it in the browser! That's pretty poor DX, though I certainly appreciate the effort to use a pre-existing concept. Instructing authors to mock process.env.NODE_ENV
to enable warnings could also have the unintended side effect of breaking other scripts that check for process
or process.env
to detect whether they’re running in Node or the browser.
How do other libraries solve this? There must be an established convention! Vue uses a separate bundle, what about others?
Btw, we should not be editing tests/
really. That's there for historical reasons, and any edits should go to the new testsuite. Otherwise we end up in the rut of maintaining two testsuites and having to keep them in sync.
FWIW we should probably even remove tests/
once all tests are ported and we are confident we haven't missed anything.
* main: Enforce trailing commas unless `]` or `}` is on the same line. (#440) Update index.html Update color-swatch.css lint [apps/gamut-mapping] Support multiple colors [apps/gamut-mapping] Show favicon and title immediately, not just when color changes [apps/gamut-mapping] Prepare HTML & CSS for supporting multiple colors
Hm, I don't think this is entirely accurate (but I'm also not tied to this approach). What I've done here is allow developers to opt out of console warnings in test environments. We're only using
We're not instructing anyone to mock
I think this is only tangentially related to dev/prod bundles, actually -- tho I agree that still might be a good idea.
👍 |
How about this?
|
I like it! And also I don't think this needs to hold up v0.5.0 😅 |
I think abstracting the the conditional into a Why don't we start with opting out of the warnings in the cli and not worry about the browser tests for now. |
I like that approach |
* missing-space-formats: Remove dashed-ident prefix for HDR colors. Enforce trailing commas unless `]` or `}` is on the same line. (#440) Update index.html Update color-swatch.css lint [apps/gamut-mapping] Support multiple colors [apps/gamut-mapping] Show favicon and title immediately, not just when color changes [apps/gamut-mapping] Prepare HTML & CSS for supporting multiple colors
@LeaVerou I refactored this to add configurable I did not set Like I said earlier, I don't think this should be a blocker for v0.5.0. |
Thanks! We should use it in other places where we currently use
Submitting it as an htest PR would be great, thank you!
Agreed. |
✅ Deploy Preview for colorjs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@LeaVerou Can you clarify what places you're referring to? I don't see any uses of
Done: htest-dev/htest#13 |
@LeaVerou Ping on this -- are there other places you want this new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM sorry for the delay!!
One approach to fix #439 (comment).