-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
SCSS testing #28496
Comments
I'd love to see some examples of how this helps us and others. Never have found a good solution that didn't seem superfluous to writing CSS, but I haven't actively sought that out :). |
Here is how it works in RFS: For example for sass, there are 10 different configurations that are tested with the same main file(https://github.com/twbs/rfs/tree/master/test/sass). In the These tests are triggered by git hooks for each commit and also in travis to make sure we don't introduce breaking changes. For Bootstrap we can something alike to test if changes to the utilities api won't break anything. Other tests could be the output of functions or mixins with specific configurations. |
If I may chime in, at the end of the day CSS controls how things look. In terms, facing a similar problem, we decided to test the visual output of static pages. A screenshots is generated build time (on travis) and if it doesn't match up, we commit it and then trigger the build again. There were some caveats, like specifying the correct tolerance; dealing with browser updates (we are using firefox for the screenshots), spinning animations prove impossible (need to be disabled). I mean it's not the best solution but it works for us and gives us nice visual diffs as well. |
Hello, As part of implementing mixins and functions to help manipulate the utilities map, I wanted to look into having some tests (as there some end up being a bit more than just a chain of @mdo mentionned two efforts that had already started on the subject:
I tried a 3rd way to get start getting a sense of safety for the functions I was building using: The logic behind this approach is to let each tool do what they're good at so there's no need to maintain either a library for structuring the test code (which is more or less where 1. would lead, I think), nor scripts for collecting, running tests and reporting their results (which is what 2. does). Setup is in this commit on my fork and here is a commit with some test (though that one is just plain sass-true test, nothing out of this world). It works by making Mocha understand that the project uses It's not all rainbows and unicorns, though, and there's a few downsides:
Hopefully I'm not stepping on anyone's toes, but thought I'd describe the approach I'd take (especially as I went through it to give myself some help) 😊 Obviously happy to discuss in more details. [sass-true]: https://www.npmjs.com/package/sass-true) |
As mentioned elsewhere, love this @romaricpascal! I'd love @XhmikosR's feedback on the additional testing dependency. I'm fine with it, but if there's a way to keep dependencies down, I'm always for that more :). |
To be honest I cannot recall the exact reason I used custom js. I can just remember (if that helps) that couldn't find a solution using jasmine, and the js script , is a copy of true-sass internals. At least the written tests are using the So, if you need any help I'll try to give you a hand |
We shipped this finally! |
@mdo can you remove any unused related branches too? |
Now that our flexibility of our
scss
is going to extended with PRs like #28445, we should have a look at automated tests forscss
. With these tests I mean: check the output ifscss
configuration is changed (like adding utilities, etc..)I used MochaJS for doing these tests with RFS, that worked pretty well, but maybe we can use the same "thing" for
js
and(s)css
tests.The text was updated successfully, but these errors were encountered: