diff --git a/tests/helpers/parsers.js b/tests/helpers/parsers.js index dcb6dfa832..59205a509a 100644 --- a/tests/helpers/parsers.js +++ b/tests/helpers/parsers.js @@ -39,6 +39,7 @@ const parsers = { TYPESCRIPT_ESLINT: path.join(__dirname, NODE_MODULES, 'typescript-eslint-parser'), '@TYPESCRIPT_ESLINT': path.join(__dirname, NODE_MODULES, '@typescript-eslint/parser'), disableNewTS, + skipDueToMultiErrorSorting: semver.satisfies(process.versions.node, '^8 || ^9'), babelParserOptions: function parserOptions(test, features) { return Object.assign({}, test.parserOptions, { requireConfigFile: false, diff --git a/tests/lib/rules/jsx-equals-spacing.js b/tests/lib/rules/jsx-equals-spacing.js index ec3fec93d0..a4e3db95ea 100644 --- a/tests/lib/rules/jsx-equals-spacing.js +++ b/tests/lib/rules/jsx-equals-spacing.js @@ -86,8 +86,8 @@ ruleTester.run('jsx-equals-spacing', rule, { }, ]), - invalid: parsers.all([ - { + invalid: parsers.all([].concat( + parsers.skipDueToMultiErrorSorting ? [] : { code: '', output: '', errors: [ @@ -95,7 +95,7 @@ ruleTester.run('jsx-equals-spacing', rule, { { messageId: 'noSpaceAfter', type: 'JSXAttribute' }, ], }, - { + parsers.skipDueToMultiErrorSorting ? [] : { code: '', output: '', options: ['never'], @@ -116,7 +116,7 @@ ruleTester.run('jsx-equals-spacing', rule, { options: ['never'], errors: [{ messageId: 'noSpaceAfter', type: 'JSXAttribute' }], }, - { + parsers.skipDueToMultiErrorSorting ? [] : { code: '', output: '', options: ['never'], @@ -126,7 +126,7 @@ ruleTester.run('jsx-equals-spacing', rule, { { messageId: 'noSpaceAfter', type: 'JSXAttribute' }, ], }, - { + parsers.skipDueToMultiErrorSorting ? [] : { code: '', output: '', options: ['always'], @@ -147,7 +147,7 @@ ruleTester.run('jsx-equals-spacing', rule, { options: ['always'], errors: [{ messageId: 'needSpaceBefore', type: 'JSXAttribute' }], }, - { + parsers.skipDueToMultiErrorSorting ? [] : { code: '', output: '', options: ['always'], @@ -156,6 +156,6 @@ ruleTester.run('jsx-equals-spacing', rule, { { messageId: 'needSpaceAfter', type: 'JSXAttribute' }, { messageId: 'needSpaceAfter', type: 'JSXAttribute' }, ], - }, - ]), + } + )), }); diff --git a/tests/lib/rules/jsx-indent.js b/tests/lib/rules/jsx-indent.js index 2bede8e8f0..9483279f68 100644 --- a/tests/lib/rules/jsx-indent.js +++ b/tests/lib/rules/jsx-indent.js @@ -2779,7 +2779,7 @@ const Component = () => ( }, ], }, - { + parsers.skipDueToMultiErrorSorting ? [] : { code: `
text @@ -2813,7 +2813,7 @@ const Component = () => ( }, ], }, - { + parsers.skipDueToMultiErrorSorting ? [] : { code: `
\t text diff --git a/tests/lib/rules/jsx-no-useless-fragment.js b/tests/lib/rules/jsx-no-useless-fragment.js index d794d2d157..22594aa6bf 100644 --- a/tests/lib/rules/jsx-no-useless-fragment.js +++ b/tests/lib/rules/jsx-no-useless-fragment.js @@ -86,7 +86,7 @@ ruleTester.run('jsx-no-useless-fragment', rule, { options: [{ allowExpressions: true }], }, ]), - invalid: parsers.all([ + invalid: parsers.all([].concat( { code: '<>', output: null, @@ -99,7 +99,7 @@ ruleTester.run('jsx-no-useless-fragment', rule, { errors: [{ messageId: 'NeedsMoreChildren', type: 'JSXFragment' }], features: ['fragment'], }, - { + parsers.skipDueToMultiErrorSorting ? [] : { code: '

moo<>foo

', output: '

moofoo

', errors: [ @@ -114,7 +114,7 @@ ruleTester.run('jsx-no-useless-fragment', rule, { errors: [{ messageId: 'NeedsMoreChildren' }], features: ['fragment'], }, - { + parsers.skipDueToMultiErrorSorting ? [] : { code: '

<>{meow}

', output: '

{meow}

', errors: [ @@ -177,7 +177,7 @@ ruleTester.run('jsx-no-useless-fragment', rule, { errors: [{ messageId: 'NeedsMoreChildren', type: 'JSXFragment' }], features: ['fragment', 'no-ts-old'], // TODO: FIXME: remove no-ts-old }, - { + parsers.skipDueToMultiErrorSorting ? [] : { code: '
<>foo
', output: '
foo
', errors: [ @@ -247,7 +247,7 @@ ruleTester.run('jsx-no-useless-fragment', rule, { errors: [{ messageId: 'ChildOfHtmlElement', type: 'JSXFragment' }], features: ['fragment', 'no-ts-old'], // TODO: FIXME: remove no-ts-old }, - { + parsers.skipDueToMultiErrorSorting ? [] : { code: ` const Comp = () => ( @@ -274,6 +274,6 @@ ruleTester.run('jsx-no-useless-fragment', rule, { errors: [{ messageId: 'NeedsMoreChildren', type: 'JSXFragment' }], output: '{moo}', features: ['fragment', 'no-ts-old'], // TODO: FIXME: remove no-ts-old - }, - ]), + } + )), }); diff --git a/tests/lib/rules/no-invalid-html-attribute.js b/tests/lib/rules/no-invalid-html-attribute.js index 3c3aace4a9..aae4c39253 100644 --- a/tests/lib/rules/no-invalid-html-attribute.js +++ b/tests/lib/rules/no-invalid-html-attribute.js @@ -234,7 +234,7 @@ ruleTester.run('no-invalid-html-attribute', rule, { code: '', }, ]), - invalid: parsers.all([ + invalid: parsers.all([].concat( { code: '', errors: [ @@ -713,7 +713,7 @@ ruleTester.run('no-invalid-html-attribute', rule, { }, ], }, - { + parsers.skipDueToMultiErrorSorting ? [] : { code: '', errors: [ { @@ -782,7 +782,7 @@ ruleTester.run('no-invalid-html-attribute', rule, { }, ], }, - { + parsers.skipDueToMultiErrorSorting ? [] : { code: '', errors: [ { @@ -913,7 +913,7 @@ ruleTester.run('no-invalid-html-attribute', rule, { }, ], }, - { + parsers.skipDueToMultiErrorSorting ? [] : { code: '', errors: [ { @@ -957,7 +957,7 @@ ruleTester.run('no-invalid-html-attribute', rule, { }, ], }, - { + parsers.skipDueToMultiErrorSorting ? [] : { code: '', errors: [ { @@ -1832,6 +1832,6 @@ ruleTester.run('no-invalid-html-attribute', rule, { type: 'Literal', }, ], - }, - ]), + } + )), }); diff --git a/tests/lib/rules/no-typos.js b/tests/lib/rules/no-typos.js index 6342563128..ee68f3407e 100644 --- a/tests/lib/rules/no-typos.js +++ b/tests/lib/rules/no-typos.js @@ -1873,7 +1873,7 @@ ruleTester.run('no-typos', rule, { }, ], }, - { + parsers.skipDueToMultiErrorSorting ? [] : { code: ` class Hello extends React.Component { GetDerivedStateFromProps() { }