Skip to content

Commit 4924042

Browse files
FloEdelmannaladdin-add
authored andcommitted
fix: ignore SpreadExpressions in no-only-tests and prefer-output-null
1 parent dea161d commit 4924042

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

Diff for: lib/rules/no-only-tests.js

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ module.exports = {
3636

3737
const onlyProperty = test.properties.find(
3838
(property) =>
39+
property.type === 'Property' &&
3940
property.key.type === 'Identifier' &&
4041
property.key.name === 'only' &&
4142
property.value.type === 'Literal' &&

Diff for: lib/rules/prefer-output-null.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ module.exports = {
4848
*/
4949
function getTestInfo(key) {
5050
if (test.type === 'ObjectExpression') {
51-
return test.properties.find((item) => item.key.name === key);
51+
return test.properties.find(
52+
(item) => item.type === 'Property' && item.key.name === key
53+
);
5254
}
5355
return null;
5456
}

Diff for: tests/lib/rules/no-only-tests.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ ruleTester.run('no-only-tests', rule, {
2323
'foo',
2424
{ code: 'foo', foo: true },
2525
RuleTester.somethingElse(),
26-
notRuleTester.only()
26+
notRuleTester.only(),
27+
{ ...otherOptions },
2728
],
2829
invalid: [
2930
{ code: 'bar', foo: true },

Diff for: tests/lib/rules/prefer-output-null.js

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ ruleTester.run('prefer-output-null', rule, {
2525
new RuleTester().run('foo', bar, {
2626
valid: [],
2727
invalid: [
28+
{ ...otherOptions },
2829
{code: 'foo', output: 'bar', errors: ['bar']},
2930
]
3031
});

0 commit comments

Comments
 (0)