Skip to content

Commit

Permalink
[Tests] skip fragment tests in eslint < 6
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Apr 30, 2022
1 parent d74173a commit 112261c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions __tests__/src/rules/role-supports-aria-props-test.js
Expand Up @@ -12,6 +12,8 @@ import {
roles,
} from 'aria-query';
import { RuleTester } from 'eslint';
import { version as eslintVersion } from 'eslint/package.json';
import semver from 'semver';
import parserOptionsMapper from '../../__util__/parserOptionsMapper';
import rule from '../../../src/rules/role-supports-aria-props';

Expand Down Expand Up @@ -72,7 +74,7 @@ const createTests = (rolesNames) => rolesNames.reduce((tests, role) => {
const [validTests, invalidTests] = createTests(nonAbstractRoles);

ruleTester.run('role-supports-aria-props', rule, {
valid: [
valid: [].concat(
{ code: '<Foo bar />' },
{ code: '<div />' },
{ code: '<div id="main" />' },
Expand Down Expand Up @@ -392,7 +394,7 @@ ruleTester.run('role-supports-aria-props', rule, {
{ code: '<div role="heading" aria-level />' },
{ code: '<div role="heading" aria-level="1" />' },

{
semver.satisfies(eslintVersion, '>= 6') ? {
code: `
const HelloThere = () => (
<Hello
Expand All @@ -408,9 +410,9 @@ ruleTester.run('role-supports-aria-props', rule, {
const Hello = (props) => <div>{props.frag}</div>;
`,
},

].concat(validTests).map(parserOptionsMapper),
} : [],
validTests,
).map(parserOptionsMapper),

invalid: [
// implicit basic checks
Expand Down

0 comments on commit 112261c

Please sign in to comment.