Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

consistent-test-it.md 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. # Have control over `test` and `it` usages (`consistent-test-it`)
  2. Jest allows you to choose how you want to define your tests, using the `it` or
  3. the `test` keywords, with multiple permutations for each:
  4. - **it:** `it`, `xit`, `fit`, `it.only`, `it.skip`.
  5. - **test:** `test`, `xtest`, `test.only`, `test.skip`.
  6. This rule gives you control over the usage of these keywords in your codebase.
  7. ## Rule Details
  8. This rule can be configured as follows
  9. ```json5
  10. {
  11. type: 'object',
  12. properties: {
  13. fn: {
  14. enum: ['it', 'test'],
  15. },
  16. withinDescribe: {
  17. enum: ['it', 'test'],
  18. },
  19. },
  20. additionalProperties: false,
  21. }
  22. ```
  23. #### fn
  24. Decides whether to use `test` or `it`.
  25. #### withinDescribe
  26. Decides whether to use `test` or `it` within a `describe` scope.
  27. ```js
  28. /*eslint jest/consistent-test-it: ["error", {"fn": "test"}]*/
  29. test('foo'); // valid
  30. test.only('foo'); // valid
  31. it('foo'); // invalid
  32. it.only('foo'); // invalid
  33. ```
  34. ```js
  35. /*eslint jest/consistent-test-it: ["error", {"fn": "it"}]*/
  36. it('foo'); // valid
  37. it.only('foo'); // valid
  38. test('foo'); // invalid
  39. test.only('foo'); // invalid
  40. ```
  41. ```js
  42. /*eslint jest/consistent-test-it: ["error", {"fn": "it", "withinDescribe": "test"}]*/
  43. it('foo'); // valid
  44. describe('foo', function () {
  45. test('bar'); // valid
  46. });
  47. test('foo'); // invalid
  48. describe('foo', function () {
  49. it('bar'); // invalid
  50. });
  51. ```
  52. ### Default configuration
  53. The default configuration forces all top-level tests to use `test` and all tests
  54. nested within `describe` to use `it`.
  55. ```js
  56. /*eslint jest/consistent-test-it: ["error"]*/
  57. test('foo'); // valid
  58. describe('foo', function () {
  59. it('bar'); // valid
  60. });
  61. it('foo'); // invalid
  62. describe('foo', function () {
  63. test('bar'); // invalid
  64. });
  65. ```