-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
Fix CSS tests #839
Fix CSS tests #839
Conversation
Deploy preview for docusaurus-preview ready! Built with commit 5c030f3 |
I've suspected that its failing, I think this fixes unhandled css test promise #810 |
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,
One concern that i have is that we have an extra file for an option. There is also something similar, exporting LIVE_RELOAD_PORT in core/constants.js
Maybe we can refactor later on as config file or maybe even refactoring into utils so the option is only defined in one file
Example:
// server/utils.js
async function minifyCss(cssContent) {
const {css} = await cssnano.process(cssContent, {preset: 'default', zindex: false});
return css;
}
module.exports = {
minifyCss
};
Then we can do
const {minifyCss} = requires(./utils.js);
// ....
const css = await minifyCss(cssContent);
The good thing of this approach is that we can also add small utility test on the minifyCss function itself & its easy for us to replace cssnano with something else
Wdyt?
@@ -29,6 +30,7 @@ function getLanguage(file, refDir) { | |||
const match = regexSubFolder.exec(file); | |||
|
|||
// Avoid misinterpreting subdirectory as language | |||
const env = require('./env.js'); |
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.
Good idea here 😂But I think we'll need to change this back to top level when we move to ES6 as ES6 imports have to be top level.
Thanks so much for helping me fix the tests @endiliey! 😊 |
Motivation
Our CSS integration tests have been broken long ago but because a fulfilled promise would not fail the test, we never caught that the test was failing. This PR:
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
yarn test
Related PRs
NA