text: // import path from "path";
  // import eslintPkg from "eslint/package.json";
  // import semver from "semver";
  const path = require("path");
  const semver = require("semver");
  const eslintPkg = require("eslint/package.json");
  
  // warms up the module cache. this import takes a while (>500ms)
  require("babel-eslint");
  
  function testFilePath(relativePath) {
    return path.join(process.cwd(), "./test/files", relativePath);
  }
  
  function getTSParsers() {
    const parsers = [];
    if (semver.satisfies(eslintPkg.version, ">=4.0.0 <6.0.0")) {
      parsers.push(require.resolve("typescript-eslint-parser"));
    }
  
    if (semver.satisfies(eslintPkg.version, ">5.0.0")) {
      parsers.push(require.resolve("@typescript-eslint/parser"));
    }
    return parsers;
  }
  
  // export function getNonDefaultParsers() {
  //   return getTSParsers().concat(require.resolve("babel-eslint"));
  // }
  //
  const FILENAME = testFilePath("foo.js");
  //
  // export function testVersion(specifier, t) {
  //   return semver.satisfies(eslintPkg.version, specifier) && test(t());
  // }
  
  function test(t) {
    return Object.assign(
      {
        filename: FILENAME,
      },
      t,
      {
        parserOptions: Object.assign(
          {
            sourceType: "module",
            ecmaVersion: 9,
          },
          t.parserOptions
        ),
      }
    );
  }
  
  // export function testContext(settings) {
  //   return {
  //     getFilename: function () {
  //       return FILENAME;
  //     },
  //     settings: settings || {},
  //   };
  // }
  //
  // export function getFilename(file) {
  //   return path.join(__dirname, "..", "files", file || "foo.js");
  // }
  
  /**
   * to be added as valid cases just to ensure no nullable fields are going
   * to crash at runtime
   * @type {Array}
   */
  const SYNTAX_CASES = [
    test({ code: "for (let { foo, bar } of baz) {}" }),
    test({ code: "for (let [ foo, bar ] of baz) {}" }),
  
    test({ code: "const { x, y } = bar" }),
    test({
      code: "const { x, y, ...z } = bar",
      parser: require.resolve("babel-eslint"),
    }),
  
    // all the exports
    test({ code: "let x; export { x }" }),
    test({ code: "let x; export { x as y }" }),
  
    // not sure about these since they reference a file
    // test({ code: 'export { x } from "./y.js"'}),
    // test({ code: 'export * as y from "./y.js"', parser: require.resolve('babel-eslint')}),
  
    test({ code: "export const x = null" }),
    test({ code: "export var x = null" }),
    test({ code: "export let x = null" }),
  
    test({ code: "export default x" }),
    test({ code: "export default class x {}" }),
  
    // issue #267: parser opt-in extension list
    test({
      code: 'import json from "./data.json"',
      settings: { "import/extensions": [".js"] }, // breaking: remove for v2
    }),
  
    // JSON
    test({
      code: 'import foo from "./foobar.json";',
      settings: { "import/extensions": [".js"] }, // breaking: remove for v2
    }),
    test({
      code: 'import foo from "./foobar";',
      settings: { "import/extensions": [".js"] }, // breaking: remove for v2
    }),
  
    // issue #370: deep commonjs import
    test({
      code: 'import { foo } from "./issue-370-commonjs-namespace/bar"',
      settings: { "import/ignore": ["foo"] },
    }),
  
    // issue #348: deep commonjs re-export
    test({
      code: 'export * from "./issue-370-commonjs-namespace/bar"',
      settings: { "import/ignore": ["foo"] },
    }),
  
    test({
      code: 'import * as a from "./commonjs-namespace/a"; a.b',
    }),
  
    // ignore invalid extensions
    test({
      code: 'import { foo } from "./ignore.invalid.extension"',
    }),
  ];
  
  module.exports.test = test;
  module.exports.SYNTAX_CASES = SYNTAX_CASES;
  module.exports.getTSParsers = getTSParsers;
  