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.

lowercase-name.md 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. # Enforce lowercase test names (`lowercase-name`)
  2. ## Rule details
  3. Enforce `it`, `test` and `describe` to have descriptions that begin with a
  4. lowercase letter. This provides more readable test failures. This rule is not
  5. enabled by default.
  6. The following pattern is considered a warning:
  7. ```js
  8. it('Adds 1 + 2 to equal 3', () => {
  9. expect(sum(1, 2)).toBe(3);
  10. });
  11. ```
  12. The following pattern is not considered a warning:
  13. ```js
  14. it('adds 1 + 2 to equal 3', () => {
  15. expect(sum(1, 2)).toBe(3);
  16. });
  17. ```
  18. ## Options
  19. ```json
  20. {
  21. "jest/lowercase-name": [
  22. "error",
  23. {
  24. "ignore": ["describe", "test"]
  25. }
  26. ]
  27. }
  28. ```
  29. ### `ignore`
  30. This array option controls which Jest functions are checked by this rule. There
  31. are three possible values:
  32. - `"describe"`
  33. - `"test"`
  34. - `"it"`
  35. By default, none of these options are enabled (the equivalent of
  36. `{ "ignore": [] }`).
  37. Example of **correct** code for the `{ "ignore": ["describe"] }` option:
  38. ```js
  39. /* eslint jest/lowercase-name: ["error", { "ignore": ["describe"] }] */
  40. describe('Uppercase description');
  41. ```
  42. Example of **correct** code for the `{ "ignore": ["test"] }` option:
  43. ```js
  44. /* eslint jest/lowercase-name: ["error", { "ignore": ["test"] }] */
  45. test('Uppercase description');
  46. ```
  47. Example of **correct** code for the `{ "ignore": ["it"] }` option:
  48. ```js
  49. /* eslint jest/lowercase-name: ["error", { "ignore": ["it"] }] */
  50. it('Uppercase description');
  51. ```
  52. ### `allowedPrefixes`
  53. This array option allows specifying prefixes which contain capitals that titles
  54. can start with. This can be useful when writing tests for api endpoints, where
  55. you'd like to prefix with the HTTP method.
  56. By default, nothing is allowed (the equivalent of `{ "allowedPrefixes": [] }`).
  57. Example of **correct** code for the `{ "allowedPrefixes": ["GET"] }` option:
  58. ```js
  59. /* eslint jest/lowercase-name: ["error", { "allowedPrefixes": ["GET"] }] */
  60. describe('GET /live');
  61. ```
  62. ### `ignoreTopLevelDescribe`
  63. This option can be set to allow only the top-level `describe` blocks to have a
  64. title starting with an upper-case letter.
  65. Example of **correct** code for the `{ "ignoreTopLevelDescribe": true }` option:
  66. ```js
  67. /* eslint jest/lowercase-name: ["error", { "ignoreTopLevelDescribe": true }] */
  68. describe('MyClass', () => {
  69. describe('#myMethod', () => {
  70. it('does things', () => {
  71. //
  72. });
  73. });
  74. });
  75. ```