You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+38Lines changed: 38 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,44 @@ This is an [ESLint](http://eslint.org) plugin. Documentation for the APIs that i
22
22
23
23
This plugin is used to lint itself. The style is checked when `yarn lint` is run, and the build will fail if there are any linting errors. You can use `yarn lint-fix` to fix some linting errors.
24
24
25
+
## Other Development Tools
26
+
27
+
-`yarn test` runs tests.
28
+
-`yarn cover` runs tests and measures coverage.
29
+
-`yarn new [new-rule-name]` generate the files needed to implement the new rule.
30
+
-`yarn update` runs in order to update readme and recommended configuration.
31
+
-`yarn docs:watch` launch the document site in development mode.
32
+
33
+
## Test the Rule
34
+
35
+
Rule testing almost always uses fixtures.
36
+
For example, for an `indent` rule, the `.ts` file that runs the test is `tests/src/rules/indent.ts` and the fixture is in `tests/fixtures/rules/indent`.
37
+
The fixture directory has an `invalid` directory and a `valid` directory.
38
+
39
+
- The `invalid` directory contains test cases where the rule reports problems.
40
+
- The `valid` directory contains test cases where the rule does not report a problem.
41
+
42
+
The fixture input file should be named `*-input.svelte`. It is automatically collected and tested.
43
+
If your test requires configuration, you need to add a json file with the configuration.
44
+
45
+
- If you want to apply a configuration to `my-test-input.svelte`, add `my-test-config.json`.
46
+
- If you want to apply the same configuration to all the fixtures in that directory, add `_config.json`.
47
+
48
+
To verify the output of invalid test cases requires `*-errors.json`, and `*-output.svelte` (for auto-fix). However, you don't have to add them yourself. If they do not exist, they will be automatically generated when you run the test. In other words, delete them manually when you want to recreate them.
49
+
50
+
**Tips**:
51
+
52
+
If you want to test only one rule, run the following command (for `indent` rule):
53
+
54
+
```sh
55
+
yarn test -g indent
56
+
```
57
+
58
+
Take <https://stackoverflow.com/questions/10832031/how-to-run-a-single-test-with-mocha> as reference for details.
59
+
60
+
If you want to test only `my-test-input.svelte`, add `my-test-config.json` and save `{"only": true}`.
61
+
(Note that `{"only": true}` must be removed before making a pull request.)
62
+
25
63
## Commit messages
26
64
27
65
Please view [commitlint](https://commitlint.js.org) and [@commitlint/config-conventional](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional) for more details.
Copy file name to clipboardExpand all lines: README.md
+1-37Lines changed: 1 addition & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -347,43 +347,7 @@ Welcome contributing!
347
347
348
348
Please use GitHub's Issues/PRs.
349
349
350
-
### Development Tools
351
-
352
-
-`yarn test` runs tests.
353
-
-`yarn cover` runs tests and measures coverage.
354
-
-`yarn new [new-rule-name]` generate the files needed to implement the new rule.
355
-
-`yarn update` runs in order to update readme and recommended configuration.
356
-
-`yarn docs:watch` launch the document site in development mode.
357
-
358
-
### Test the Rule
359
-
360
-
Rule testing almost always uses fixtures.
361
-
For example, for an `indent` rule, the `.ts` file that runs the test is `tests/src/rules/indent.ts` and the fixture is in `tests/fixtures/rules/indent`.
362
-
The fixture directory has an `invalid` directory and a `valid` directory.
363
-
364
-
- The `invalid` directory contains test cases where the rule reports problems.
365
-
- The `valid` directory contains test cases where the rule does not report a problem.
366
-
367
-
The fixture input file should be named `*-input.svelte`. It is automatically collected and tested.
368
-
If your test requires configuration, you need to add a json file with the configuration.
369
-
370
-
- If you want to apply a configuration to `my-test-input.svelte`, add `my-test-config.json`.
371
-
- If you want to apply the same configuration to all the fixtures in that directory, add `_config.json`.
372
-
373
-
To verify the output of invalid test cases requires `*-errors.json`, and `*-output.svelte` (for auto-fix). However, you don't have to add them yourself. If they do not exist, they will be automatically generated when you run the test. In other words, delete them manually when you want to recreate them.
374
-
375
-
**Tips**:
376
-
377
-
If you want to test only one rule, run the following command (for `indent` rule):
378
-
379
-
```sh
380
-
yarn test -g indent
381
-
```
382
-
383
-
Take <https://stackoverflow.com/questions/10832031/how-to-run-a-single-test-with-mocha> as reference for details.
384
-
385
-
If you want to test only `my-test-input.svelte`, add `my-test-config.json` and save `{"only": true}`.
386
-
(Note that `{"only": true}` must be removed before making a pull request.)
0 commit comments