Skip to content

Commit

Permalink
[Tests] use require.resolve to get absolute paths to parsers
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryBrown0 authored and ljharb committed Jan 16, 2024
1 parent 6150d40 commit d5e3769
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions tests/helpers/parsers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const path = require('path');
const semver = require('semver');
const entries = require('object.entries');
const version = require('eslint/package.json').version;
Expand Down Expand Up @@ -31,13 +30,11 @@ function minEcmaVersion(features, parserOptions) {
return Number.isFinite(result) ? result : undefined;
}

const NODE_MODULES = '../../node_modules';

const parsers = {
BABEL_ESLINT: path.join(__dirname, NODE_MODULES, 'babel-eslint'),
'@BABEL_ESLINT': path.join(__dirname, NODE_MODULES, '@babel/eslint-parser'),
TYPESCRIPT_ESLINT: path.join(__dirname, NODE_MODULES, 'typescript-eslint-parser'),
'@TYPESCRIPT_ESLINT': path.join(__dirname, NODE_MODULES, '@typescript-eslint/parser'),
BABEL_ESLINT: require.resolve('babel-eslint'),
'@BABEL_ESLINT': require.resolve('@babel/eslint-parser'),
TYPESCRIPT_ESLINT: require.resolve('typescript-eslint-parser'),
'@TYPESCRIPT_ESLINT': require.resolve('@typescript-eslint/parser'),
disableNewTS,
skipDueToMultiErrorSorting: semver.satisfies(process.versions.node, '^8 || ^9'),
babelParserOptions: function parserOptions(test, features) {
Expand Down

0 comments on commit d5e3769

Please sign in to comment.