Skip to content

Commit

Permalink
don't run babel tests on less than eslint v3
Browse files Browse the repository at this point in the history
  • Loading branch information
bradzacher committed Jun 10, 2022
1 parent 1a6e0e9 commit 817d91f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion tests/src/rules/consistent-type-specifier-style.js
@@ -1,5 +1,5 @@
import { RuleTester } from 'eslint';
import { test, parsers, tsVersionSatisfies } from '../utils';
import { test, parsers, tsVersionSatisfies, eslintVersionSatisfies } from '../utils';

const rule = require('rules/consistent-type-specifier-style');

Expand Down Expand Up @@ -267,6 +267,10 @@ context('TypeScript', () => {
});

context('Babel/Flow', () => {
if (!eslintVersionSatisfies('> 3')) {
return;
}

const ruleTester = new RuleTester({
parser: parsers.BABEL_OLD,
parserOptions: {
Expand Down
6 changes: 5 additions & 1 deletion tests/src/utils.js
Expand Up @@ -34,8 +34,12 @@ export function getNonDefaultParsers() {

export const FILENAME = testFilePath('foo.js');

export function eslintVersionSatisfies(specifier) {
return semver.satisfies(eslintPkg.version, specifier);
}

export function testVersion(specifier, t) {
return semver.satisfies(eslintPkg.version, specifier) ? test(t()) : [];
return eslintVersionSatisfies(specifier) ? test(t()) : [];
}

export function test(t) {
Expand Down

0 comments on commit 817d91f

Please sign in to comment.