1 | # Writing system tests
|
2 |
|
3 | System tests verify that stylelint works as expected. They are another line of defense against regressions, after the unit tests and integration tests.
|
4 |
|
5 | Each of these system tests asserts that we end up with some expected output, given a configuration and a stylesheet.
|
6 |
|
7 | These tests should not be comprehensive and systematic (_the unit tests should_). They should reproduce real use-cases and verify that those use-cases work as expected.
|
8 |
|
9 | ## Jest snapshots
|
10 |
|
11 | The tests use Jest snapshots, so we can easily:
|
12 |
|
13 | - assert against potentially large objects and strings
|
14 | - update expectations as needed.
|
15 |
|
16 | ## The pattern
|
17 |
|
18 | To add a system test, you should:
|
19 |
|
20 | - add a test-case folder to `system-tests/` incrementing the number from existing test cases
|
21 | - add a configuration file and a stylesheet
|
22 | - add a `fs.test.js` and `no-fs.test.js` following the format established by existing tests, and using the `systemTestUtils`
|
23 | - take a snapshot of `output`
|