eslint-plugin-jest-formatting 1.2.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,153 +0,0 @@
1
- /**
2
- * @fileoverview Enforces a single line of padding between test blocks with a describe
3
- * @author Dan Green-Leipciger
4
- */
5
-
6
- //------------------------------------------------------------------------------
7
- // Requirements
8
- //------------------------------------------------------------------------------
9
- const { RuleTester } = require('eslint');
10
- const rule = require('../../../lib').rules['padding-before-test-blocks'];
11
-
12
- const ruleTester = new RuleTester({
13
- parserOptions: {
14
- ecmaVersion: 6,
15
- },
16
- });
17
-
18
- //------------------------------------------------------------------------------
19
- // Tests
20
- //------------------------------------------------------------------------------
21
-
22
- const valid = `
23
- const foo = 'bar';
24
- const bar = 'baz';
25
-
26
- it('foo', () => {
27
- // stuff
28
- });
29
-
30
- it('bar', () => {
31
- // stuff
32
- });
33
-
34
- test('foo foo', () => {});
35
-
36
- test('bar bar', () => {});
37
-
38
- // Nesting
39
- describe('other bar', () => {
40
- const thing = 123;
41
-
42
- test('is another bar w/ test', () => {
43
- });
44
-
45
- // With a comment
46
- it('is another bar w/ it', () => {
47
- });
48
-
49
- test.skip('skipping', () => {}); // Another comment
50
-
51
- it.skip('skipping too', () => {});
52
- });
53
-
54
- test('weird', () => {});
55
-
56
- test
57
- .skip('skippy skip', () => {});
58
- `;
59
-
60
- const invalid = `
61
- const foo = 'bar';
62
- const bar = 'baz';
63
- it('foo', () => {
64
- // stuff
65
- });
66
- it('bar', () => {
67
- // stuff
68
- });
69
- test('foo foo', () => {});
70
- test('bar bar', () => {});
71
-
72
- // Nesting
73
- describe('other bar', () => {
74
- const thing = 123;
75
- test('is another bar w/ test', () => {
76
- });
77
- // With a comment
78
- it('is another bar w/ it', () => {
79
- });
80
- test.skip('skipping', () => {}); // Another comment
81
- it.skip('skipping too', () => {});
82
- });test('weird', () => {});
83
- test
84
- .skip('skippy skip', () => {});
85
- `;
86
-
87
- ruleTester.run('padding-before-test-blocks', rule, {
88
- valid: [valid],
89
- invalid: [
90
- {
91
- code: invalid,
92
- filename: 'src/component.test.jsx',
93
- errors: 10,
94
- output: valid,
95
- },
96
- {
97
- code: invalid,
98
- filename: 'src/component.test.js',
99
- errors: [
100
- {
101
- message: 'Expected blank line before this statement.',
102
- line: 4,
103
- column: 1
104
- },
105
- {
106
- message: 'Expected blank line before this statement.',
107
- line: 7,
108
- column: 1
109
- },
110
- {
111
- message: 'Expected blank line before this statement.',
112
- line: 10,
113
- column: 1
114
- },
115
- {
116
- message: 'Expected blank line before this statement.',
117
- line: 11,
118
- column: 1
119
- },
120
- {
121
- message: 'Expected blank line before this statement.',
122
- line: 16,
123
- column: 3
124
- },
125
- {
126
- message: 'Expected blank line before this statement.',
127
- line: 19,
128
- column: 3
129
- },
130
- {
131
- message: 'Expected blank line before this statement.',
132
- line: 21,
133
- column: 3
134
- },
135
- {
136
- message: 'Expected blank line before this statement.',
137
- line: 22,
138
- column: 3
139
- },
140
- {
141
- message: 'Expected blank line before this statement.',
142
- line: 23,
143
- column: 4
144
- },
145
- {
146
- message: 'Expected blank line before this statement.',
147
- line: 24,
148
- column: 1
149
- },
150
- ],
151
- },
152
- ],
153
- });