Skip to content

Commit 06e8759

Browse files
committed
[Fix] #2882 Restore modified tests (i.e. modified tests become new tests)
1 parent fbbb18a commit 06e8759

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

Diff for: tests/src/rules/newline-after-import.js

+59
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,16 @@ ruleTester.run('newline-after-import', require('rules/newline-after-import'), {
132132
parserOptions: { ecmaVersion: 2015, sourceType: 'module' },
133133
options: [{ count: 2 }],
134134
},
135+
{
136+
code: `import foo from 'foo';\n\n\nvar bar = 'bar';`,
137+
parserOptions: { ecmaVersion: 2015, sourceType: 'module' },
138+
options: [{ count: 2, exactCount: true }],
139+
},
140+
{
141+
code: `import foo from 'foo';\n\nvar bar = 'bar';`,
142+
parserOptions: { ecmaVersion: 2015, sourceType: 'module' },
143+
options: [{ count: 1, exactCount: true }],
144+
},
135145
{
136146
code: `import foo from 'foo';\n\n// Some random comment\nvar bar = 'bar';`,
137147
parserOptions: { ecmaVersion: 2015, sourceType: 'module' },
@@ -181,6 +191,11 @@ ruleTester.run('newline-after-import', require('rules/newline-after-import'), {
181191
parserOptions: { ecmaVersion: 2015, sourceType: 'module' },
182192
options: [{ count: 4 }],
183193
},
194+
{
195+
code: `var foo = require('foo-module');\n\n\n\n\nvar foo = 'bar';`,
196+
parserOptions: { ecmaVersion: 2015, sourceType: 'module' },
197+
options: [{ count: 4, exactCount: true }],
198+
},
184199
{
185200
code: `var foo = require('foo-module');\n\n// Some random comment\n\n\nvar foo = 'bar';`,
186201
parserOptions: { ecmaVersion: 2015, sourceType: 'module' },
@@ -670,6 +685,39 @@ ruleTester.run('newline-after-import', require('rules/newline-after-import'), {
670685
parserOptions: { sourceType: 'module' },
671686
parser: parsers.BABEL_OLD,
672687
})) || [],
688+
{
689+
code: `import foo from 'foo';\n\nexport default function() {};`,
690+
output: `import foo from 'foo';\n\n\nexport default function() {};`,
691+
options: [{ count: 2, exactCount: true }],
692+
errors: [{
693+
line: 1,
694+
column: 1,
695+
message: IMPORT_ERROR_MESSAGE_MULTIPLE(2),
696+
}],
697+
parserOptions: { ecmaVersion: 2015, sourceType: 'module' },
698+
},
699+
{
700+
code: `import foo from 'foo';\n\n\n\nexport default function() {};`,
701+
output: `import foo from 'foo';\n\n\n\nexport default function() {};`,
702+
options: [{ count: 2, exactCount: true }],
703+
errors: [{
704+
line: 1,
705+
column: 1,
706+
message: IMPORT_ERROR_MESSAGE_MULTIPLE(2),
707+
}],
708+
parserOptions: { ecmaVersion: 2015, sourceType: 'module' },
709+
},
710+
{
711+
code: `import foo from 'foo';\n\n\n\n\nexport default function() {};`,
712+
output: `import foo from 'foo';\n\n\n\n\nexport default function() {};`,
713+
options: [{ count: 2, exactCount: true }],
714+
errors: [{
715+
line: 1,
716+
column: 1,
717+
message: IMPORT_ERROR_MESSAGE_MULTIPLE(2),
718+
}],
719+
parserOptions: { ecmaVersion: 2015, sourceType: 'module' },
720+
},
673721
{
674722
code: `import foo from 'foo';\n// some random comment\nexport default function() {};`,
675723
output: `import foo from 'foo';\n\n// some random comment\nexport default function() {};`,
@@ -770,6 +818,17 @@ ruleTester.run('newline-after-import', require('rules/newline-after-import'), {
770818
}],
771819
parserOptions: { ecmaVersion: 2015, sourceType: 'module' },
772820
},
821+
{
822+
code: `const foo = require('foo');\n\n\n\nconst bar = function() {};`,
823+
output: `const foo = require('foo');\n\n\n\nconst bar = function() {};`,
824+
options: [{ count: 2, exactCount: true }],
825+
errors: [{
826+
line: 1,
827+
column: 1,
828+
message: 'Expected 2 empty lines after require statement not followed by another require.',
829+
}],
830+
parserOptions: { ecmaVersion: 2015 },
831+
},
773832
{
774833
code: `const foo = require('foo');\n\n\n\n// some random comment\nconst bar = function() {};`,
775834
output: `const foo = require('foo');\n\n\n\n// some random comment\nconst bar = function() {};`,

0 commit comments

Comments
 (0)