Skip to content

Commit

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

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

Expand Down Expand Up @@ -243,7 +243,7 @@ const FLOW_ONLY = {

context('TypeScript', () => {
// inline type specifiers weren't supported prior to TS v4.5
if (!parsers.TS_NEW || !tsVersionSatisfies('>= 4.5')) {
if (!parsers.TS_NEW || !tsVersionSatisfies('>= 4.5') || !typescriptEslintParserSatisfies('>= 5.7.0')) {
return;
}

Expand Down
5 changes: 5 additions & 0 deletions tests/src/utils.js
Expand Up @@ -2,6 +2,7 @@ import path from 'path';
import eslintPkg from 'eslint/package.json';
import semver from 'semver';
import typescriptPkg from 'typescript/package.json';
import typescriptEslintParserPkg from '@typescript-eslint/parser';

// warms up the module cache. this import takes a while (>500ms)
import 'babel-eslint';
Expand All @@ -17,6 +18,10 @@ export function tsVersionSatisfies(specifier) {
return semver.satisfies(typescriptPkg.version, specifier);
}

export function typescriptEslintParserSatisfies(specifier) {
return semver.satisfies(typescriptEslintParserPkg.version, specifier);
}

export function testFilePath(relativePath) {
return path.join(process.cwd(), './tests/files', relativePath);
}
Expand Down

0 comments on commit 636b694

Please sign in to comment.