diff --git a/.travis.yml b/.travis.yml index 75f2e67ad..c359e7371 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,7 @@ matrix: node_js: 6 - env: PACKAGE=resolvers/webpack node_js: 4 + - os: osx env: ESLINT_VERSION=5 node_js: 10 @@ -54,7 +55,7 @@ before_install: - 'if [ -n "${PACKAGE-}" ]; then cd "${PACKAGE}"; fi' install: - npm install - - npm install --no-save eslint@$ESLINT_VERSION --ignore-scripts || true + - 'if [ -n "${ESLINT_VERSION}" ]; then ./tests/dep-time-travel.sh; fi' script: - 'npm test' diff --git a/tests/dep-time-travel.sh b/tests/dep-time-travel.sh new file mode 100755 index 000000000..eae24998d --- /dev/null +++ b/tests/dep-time-travel.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# expected: ESLINT_VERSION numeric env var + +npm install --no-save eslint@$ESLINT_VERSION --ignore-scripts || true + +# use these alternate typescript dependencies for ESLint < v4 +if [[ "$ESLINT_VERSION" -lt "4" ]]; then + echo "Downgrading babel-eslint..." + npm i --no-save babel-eslint@8.0.3 + + echo "Downgrading TypeScript dependencies..." + npm i --no-save typescript-eslint-parser@15 typescript@2.8.1 +fi + +# typescript-eslint-parser 1.1.1+ is not compatible with node 6 +if [[ "$TRAVIS_NODE_VERSION" -lt "8" ]]; then + echo "Downgrading eslint-import-resolver-typescript..." + npm i --no-save eslint-import-resolver-typescript@1.0.2 +fi diff --git a/tests/src/core/getExports.js b/tests/src/core/getExports.js index b33d548f0..8e01f62ac 100644 --- a/tests/src/core/getExports.js +++ b/tests/src/core/getExports.js @@ -3,7 +3,7 @@ import ExportMap from '../../../src/ExportMap' import * as fs from 'fs' -import { getFilename, skipESLints } from '../utils' +import { getFilename } from '../utils' import * as unambiguous from 'eslint-module-utils/unambiguous' describe('ExportMap', function () { @@ -310,7 +310,7 @@ describe('ExportMap', function () { }) - skipESLints([2, 3])('alternate parsers', function () { + context('alternate parsers', function () { const configs = [ // ['string form', { 'typescript-eslint-parser': '.ts' }], diff --git a/tests/src/rules/named.js b/tests/src/rules/named.js index 7ffd929e1..92b3d9163 100644 --- a/tests/src/rules/named.js +++ b/tests/src/rules/named.js @@ -1,4 +1,4 @@ -import { test, SYNTAX_CASES, skipESLints } from '../utils' +import { test, SYNTAX_CASES } from '../utils' import { RuleTester } from 'eslint' import { CASE_SENSITIVE_FS } from 'eslint-module-utils/resolve' @@ -254,7 +254,7 @@ ruleTester.run('named (export *)', rule, { }) -skipESLints([2, 3])("Typescript", function () { +context("Typescript", function () { // Typescript ruleTester.run("named", rule, { valid: [ diff --git a/tests/src/utils.js b/tests/src/utils.js index 56e8ab72a..fe04d684e 100644 --- a/tests/src/utils.js +++ b/tests/src/utils.js @@ -29,17 +29,6 @@ export function getFilename(file) { return path.join(__dirname, '..', 'files', file || 'foo.js') } -/** - * skip tests iff ESLINT_VERSION is in provided `versions` array - */ -export function skipESLints(versions) { - if (versions.indexOf(+process.env.ESLINT_VERSION) === -1) { - return describe - } else { - return describe.skip - } -} - /** * to be added as valid cases just to ensure no nullable fields are going * to crash at runtime