Skip to content

Commit 73080d0

Browse files
Ben Mosherljharb
Ben Mosher
authored andcommitted
dep-time-travel: use older versions of dependencies
for tests against older ESLint versions.
1 parent 05c3935 commit 73080d0

File tree

5 files changed

+26
-16
lines changed

5 files changed

+26
-16
lines changed

.travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ matrix:
3232
node_js: 6
3333
- env: PACKAGE=resolvers/webpack
3434
node_js: 4
35+
3536
- os: osx
3637
env: ESLINT_VERSION=5
3738
node_js: 10
@@ -54,7 +55,7 @@ before_install:
5455
- 'if [ -n "${PACKAGE-}" ]; then cd "${PACKAGE}"; fi'
5556
install:
5657
- npm install
57-
- npm install --no-save eslint@$ESLINT_VERSION --ignore-scripts || true
58+
- 'if [ -n "${ESLINT_VERSION}" ]; then ./tests/dep-time-travel.sh; fi'
5859

5960
script:
6061
- 'npm test'

tests/dep-time-travel.sh

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
# expected: ESLINT_VERSION numeric env var
4+
5+
npm install --no-save eslint@$ESLINT_VERSION --ignore-scripts || true
6+
7+
# use these alternate typescript dependencies for ESLint < v4
8+
if [[ "$ESLINT_VERSION" -lt "4" ]]; then
9+
echo "Downgrading babel-eslint..."
10+
npm i --no-save [email protected]
11+
12+
echo "Downgrading TypeScript dependencies..."
13+
npm i --no-save typescript-eslint-parser@15 [email protected]
14+
fi
15+
16+
# typescript-eslint-parser 1.1.1+ is not compatible with node 6
17+
if [[ "$TRAVIS_NODE_VERSION" -lt "8" ]]; then
18+
echo "Downgrading eslint-import-resolver-typescript..."
19+
npm i --no-save [email protected]
20+
fi

tests/src/core/getExports.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import ExportMap from '../../../src/ExportMap'
33

44
import * as fs from 'fs'
55

6-
import { getFilename, skipESLints } from '../utils'
6+
import { getFilename } from '../utils'
77
import * as unambiguous from 'eslint-module-utils/unambiguous'
88

99
describe('ExportMap', function () {
@@ -310,7 +310,7 @@ describe('ExportMap', function () {
310310

311311
})
312312

313-
skipESLints([2, 3])('alternate parsers', function () {
313+
context('alternate parsers', function () {
314314

315315
const configs = [
316316
// ['string form', { 'typescript-eslint-parser': '.ts' }],

tests/src/rules/named.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test, SYNTAX_CASES, skipESLints } from '../utils'
1+
import { test, SYNTAX_CASES } from '../utils'
22
import { RuleTester } from 'eslint'
33

44
import { CASE_SENSITIVE_FS } from 'eslint-module-utils/resolve'
@@ -254,7 +254,7 @@ ruleTester.run('named (export *)', rule, {
254254
})
255255

256256

257-
skipESLints([2, 3])("Typescript", function () {
257+
context("Typescript", function () {
258258
// Typescript
259259
ruleTester.run("named", rule, {
260260
valid: [

tests/src/utils.js

-11
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,6 @@ export function getFilename(file) {
2929
return path.join(__dirname, '..', 'files', file || 'foo.js')
3030
}
3131

32-
/**
33-
* skip tests iff ESLINT_VERSION is in provided `versions` array
34-
*/
35-
export function skipESLints(versions) {
36-
if (versions.indexOf(+process.env.ESLINT_VERSION) === -1) {
37-
return describe
38-
} else {
39-
return describe.skip
40-
}
41-
}
42-
4332
/**
4433
* to be added as valid cases just to ensure no nullable fields are going
4534
* to crash at runtime

0 commit comments

Comments
 (0)