-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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): properly pass options to stylus compiler #2860
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.
Curious why Evan went with this approach. But this LGTM.
LGTM too, good find about this bug in Stylus. @qnp would it be possible to add that failing case to the playground tests so we can avoid regressions later? |
Well, thanks @patak-js, but I'm not familiar with writing tests ( 🙈 ) so I do not really know how to do your request – even where to start. If you could provide me with some insights... |
Vite's uses Jest and it aggregates the tests from the playground, running them first in dev mode, and then in build mode. To run them you need to build vite, plugin-vue first. In Vite's root: yarn
cd packages/vite & yarn & yarn build & cd ../..
cd packages/plugin-vue & yarn & yarn build & cd ../..
yarn test To add tests, you need to find a related playground (or create a new one). For stylus options, the css playground is a good candidate. Each playground is a Vite app, and in the index.html markup is defined that will be later modified by the imported js files. For example, in main.js there is a test like import less from './less.less'
text('.imported-less', less) Where function text(el, text) {
document.querySelector(el).textContent = text
} The spec tests for each playground are present in /packages/playground/{name}/tests/. test('less', async () => {
const imported = await page.$('.less')
const atImport = await page.$('.less-at-import')
expect(await getColor(imported)).toBe('blue')
expect(await getColor(atImport)).toBe('darkslateblue')
expect(await getBg(atImport)).toMatch(isBuild ? /base64/ : '/nested/icon.png')
editFile('less.less', (code) => code.replace('@color: blue', '@color: red'))
await untilUpdated(() => getColor(imported), 'red')
editFile('nested/nested.less', (code) =>
code.replace('color: darkslateblue', 'color: blue')
)
await untilUpdated(() => getColor(atImport), 'blue')
}) @qnp let me know if you need more information. Adding these tests is not a requirement for this PR, but I think we should have them in the test suite. Let us know if you would like to try to add them. |
@patak-js thanks you for taking time to explain the test playground to me. I'll thus try to author the according tests. I'll come back to you with new comits on this PR then. Best regards, |
Your above answer is quite precious and could be used in contibution guide. If you intend to do so,
|
Thanks for the corrections @qnp, I'll send a PR to add this to the contributing.md 👍🏼 |
…n are watched as deps
@patak-js Hi, I don't know how, but prettier completely messed up my specs on commit, maybe something was not properly formatted. I fixed the file now |
cfe0b9d
to
f4df671
Compare
@patak-js I authored the tests. While doing this job, I came across two other issues in stylus compilation: |
A CI test failed: in
I don't quite understand why |
🤔 I also checked it and it looks weird |
The presence of dev dependency |
Hi there, I'm still stuck at solving this issue. Did you have any clue based on my last comment ? |
I can disable linting for this line, yes, using |
@qnp Could you update to the latest main branch? There is a new Lint CI Job 🙂 Then, if needed please use explicit disabling comments instead of ignore every lint rule for that line. Would be nice if you could do that in two commits and let the CI fail for the first commit (merge of main) intentionally 🙂 |
https://github.com/vitejs/vite/runs/2341059358#step:5:21 Oh seems that a lint step (script) is running within the prepare 🤔 Thx @qnp, should not hold you off, feel free to proceed 👍 |
Done. Thanks for the help 😃 |
Co-authored-by: Shinigami <chrissi92@hotmail.de>
Thanks a lot for the PR @qnp ❤️ |
Description
Fixes #2857
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).