|
| 1 | +'use strict'; |
| 2 | + |
| 3 | +const RuleTester = require('eslint').RuleTester; |
| 4 | +const rules = require('../..').rules; |
| 5 | + |
| 6 | +const ruleTester = new RuleTester(); |
| 7 | + |
| 8 | +ruleTester.run('no-test-prefixes', rules['no-test-prefixes'], { |
| 9 | + valid: [ |
| 10 | + 'describe("foo", function () {})', |
| 11 | + 'it("foo", function () {})', |
| 12 | + 'test("foo", function () {})', |
| 13 | + 'describe.only("foo", function () {})', |
| 14 | + 'it.only("foo", function () {})', |
| 15 | + 'test.only("foo", function () {})', |
| 16 | + 'describe.skip("foo", function () {})', |
| 17 | + 'it.skip("foo", function () {})', |
| 18 | + 'test.skip("foo", function () {})', |
| 19 | + 'foo()', |
| 20 | + ], |
| 21 | + invalid: [ |
| 22 | + { |
| 23 | + code: 'fdescribe("foo", function () {})', |
| 24 | + errors: [{ message: 'Use "describe.only" instead', column: 1, line: 1 }], |
| 25 | + output: 'describe.only("foo", function () {})', |
| 26 | + }, |
| 27 | + { |
| 28 | + code: 'fit("foo", function () {})', |
| 29 | + errors: [{ message: 'Use "it.only" instead', column: 1, line: 1 }], |
| 30 | + output: 'it.only("foo", function () {})', |
| 31 | + }, |
| 32 | + { |
| 33 | + code: 'xdescribe("foo", function () {})', |
| 34 | + errors: [{ message: 'Use "describe.skip" instead', column: 1, line: 1 }], |
| 35 | + output: 'describe.skip("foo", function () {})', |
| 36 | + }, |
| 37 | + { |
| 38 | + code: 'xit("foo", function () {})', |
| 39 | + errors: [{ message: 'Use "it.skip" instead', column: 1, line: 1 }], |
| 40 | + output: 'it.skip("foo", function () {})', |
| 41 | + }, |
| 42 | + { |
| 43 | + code: 'xtest("foo", function () {})', |
| 44 | + errors: [{ message: 'Use "test.skip" instead', column: 1, line: 1 }], |
| 45 | + output: 'test.skip("foo", function () {})', |
| 46 | + }, |
| 47 | + ], |
| 48 | +}); |
0 commit comments