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.

no-duplicate-hooks.md 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # Disallow duplicate setup and teardown hooks (`no-duplicate-hooks`)
  2. A `describe` block should not contain duplicate hooks.
  3. ## Rule Details
  4. Examples of **incorrect** code for this rule
  5. ```js
  6. /* eslint jest/no-duplicate-hooks: "error" */
  7. describe('foo', () => {
  8. beforeEach(() => {
  9. // some setup
  10. });
  11. beforeEach(() => {
  12. // some setup
  13. });
  14. test('foo_test', () => {
  15. // some test
  16. });
  17. });
  18. // Nested describe scenario
  19. describe('foo', () => {
  20. beforeEach(() => {
  21. // some setup
  22. });
  23. test('foo_test', () => {
  24. // some test
  25. });
  26. describe('bar', () => {
  27. test('bar_test', () => {
  28. afterAll(() => {
  29. // some teardown
  30. });
  31. afterAll(() => {
  32. // some teardown
  33. });
  34. });
  35. });
  36. });
  37. ```
  38. Examples of **correct** code for this rule
  39. ```js
  40. /* eslint jest/no-duplicate-hooks: "error" */
  41. describe('foo', () => {
  42. beforeEach(() => {
  43. // some setup
  44. });
  45. test('foo_test', () => {
  46. // some test
  47. });
  48. });
  49. // Nested describe scenario
  50. describe('foo', () => {
  51. beforeEach(() => {
  52. // some setup
  53. });
  54. test('foo_test', () => {
  55. // some test
  56. });
  57. describe('bar', () => {
  58. test('bar_test', () => {
  59. beforeEach(() => {
  60. // some setup
  61. });
  62. });
  63. });
  64. });
  65. ```