Use full import specifier path in tests (#13938)

This commit is contained in:
Nicolò Ribaudo 2021-11-24 11:43:18 +01:00 committed by GitHub
parent a470f7b479
commit 75996cb62b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
107 changed files with 141 additions and 136 deletions

View File

@ -67,7 +67,10 @@ module.exports = {
"jest/no-standalone-expect": "off", "jest/no-standalone-expect": "off",
"jest/no-test-callback": "off", "jest/no-test-callback": "off",
"jest/valid-describe": "off", "jest/valid-describe": "off",
"import/extensions": ["error", { json: "always", cjs: "always" }], "import/extensions": [
"error",
{ json: "always", js: "always", cjs: "always", mjs: "always" },
],
}, },
}, },
{ {

View File

@ -1,6 +1,6 @@
import path from "path"; import path from "path";
import rule from "../../src/rules/dry-error-messages"; import rule from "../../lib/rules/dry-error-messages.js";
import RuleTester from "../../../babel-eslint-shared-fixtures/utils/RuleTester"; import RuleTester from "../../../babel-eslint-shared-fixtures/utils/RuleTester.js";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
const dirname = path.dirname(fileURLToPath(import.meta.url)); const dirname = path.dirname(fileURLToPath(import.meta.url));

View File

@ -1,5 +1,5 @@
import RuleTester from "../../../babel-eslint-shared-fixtures/utils/RuleTester"; import RuleTester from "../../../babel-eslint-shared-fixtures/utils/RuleTester.js";
import rule from "../../src/rules/report-error-message-format"; import rule from "../../lib/rules/report-error-message-format.js";
const ruleTester = new RuleTester(); const ruleTester = new RuleTester();

View File

@ -1,5 +1,5 @@
import rule from "../../src/rules/no-deprecated-clone"; import rule from "../../lib/rules/no-deprecated-clone.js";
import RuleTester from "../../../babel-eslint-shared-fixtures/utils/RuleTester"; import RuleTester from "../../../babel-eslint-shared-fixtures/utils/RuleTester.js";
const cloneError = "t.clone() is deprecated. Use t.cloneNode() instead."; const cloneError = "t.clone() is deprecated. Use t.cloneNode() instead.";
const cloneDeepError = const cloneDeepError =

View File

@ -1,5 +1,5 @@
import rule from "../../src/rules/no-undefined-identifier"; import rule from "../../lib/rules/no-undefined-identifier.js";
import RuleTester from "../../../babel-eslint-shared-fixtures/utils/RuleTester"; import RuleTester from "../../../babel-eslint-shared-fixtures/utils/RuleTester.js";
const error = const error =
"Use path.scope.buildUndefinedNode() to create an undefined identifier directly."; "Use path.scope.buildUndefinedNode() to create an undefined identifier directly.";

View File

@ -1,5 +1,5 @@
import rule from "../../src/rules/plugin-name"; import rule from "../../lib/rules/plugin-name.js";
import RuleTester from "../../../babel-eslint-shared-fixtures/utils/RuleTester"; import RuleTester from "../../../babel-eslint-shared-fixtures/utils/RuleTester.js";
const missingPluginError = "This file does not export a Babel plugin."; const missingPluginError = "This file does not export a Babel plugin.";
const missingNameError = "This Babel plugin doesn't have a 'name' property."; const missingNameError = "This Babel plugin doesn't have a 'name' property.";

View File

@ -1,5 +1,5 @@
import rule from "../../src/rules/new-cap"; import rule from "../../lib/rules/new-cap.js";
import RuleTester from "../../../babel-eslint-shared-fixtures/utils/RuleTester"; import RuleTester from "../../../babel-eslint-shared-fixtures/utils/RuleTester.js";
const ruleTester = new RuleTester(); const ruleTester = new RuleTester();
ruleTester.run("@babel/new-cap", rule, { ruleTester.run("@babel/new-cap", rule, {

View File

@ -1,6 +1,6 @@
import cloneDeep from "clone-deep"; import cloneDeep from "clone-deep";
import rule from "../../src/rules/no-invalid-this"; import rule from "../../lib/rules/no-invalid-this.js";
import RuleTester from "../../../babel-eslint-shared-fixtures/utils/RuleTester"; import RuleTester from "../../../babel-eslint-shared-fixtures/utils/RuleTester.js";
/** /**
* A constant value for non strict mode environment. * A constant value for non strict mode environment.

View File

@ -1,5 +1,5 @@
import rule from "../../src/rules/no-unused-expressions"; import rule from "../../lib/rules/no-unused-expressions.js";
import RuleTester from "../../../babel-eslint-shared-fixtures/utils/RuleTester"; import RuleTester from "../../../babel-eslint-shared-fixtures/utils/RuleTester.js";
const ruleTester = new RuleTester(); const ruleTester = new RuleTester();
ruleTester.run("@babel/no-unused-expressions", rule, { ruleTester.run("@babel/no-unused-expressions", rule, {

View File

@ -1,5 +1,5 @@
import rule from "../../src/rules/object-curly-spacing"; import rule from "../../lib/rules/object-curly-spacing.js";
import RuleTester from "../../../babel-eslint-shared-fixtures/utils/RuleTester"; import RuleTester from "../../../babel-eslint-shared-fixtures/utils/RuleTester.js";
const ruleTester = new RuleTester(); const ruleTester = new RuleTester();
ruleTester.run("@babel/object-curly-spacing", rule, { ruleTester.run("@babel/object-curly-spacing", rule, {

View File

@ -1,5 +1,5 @@
import rule from "../../src/rules/semi"; import rule from "../../lib/rules/semi.js";
import RuleTester from "../../../babel-eslint-shared-fixtures/utils/RuleTester"; import RuleTester from "../../../babel-eslint-shared-fixtures/utils/RuleTester.js";
const ruleTester = new RuleTester(); const ruleTester = new RuleTester();

View File

@ -1,4 +1,4 @@
import verifyAndAssertMessages from "../../helpers/verifyAndAssertMessages"; import verifyAndAssertMessages from "../../helpers/verifyAndAssertMessages.js";
import path from "path"; import path from "path";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";

View File

@ -7,7 +7,7 @@ import fs from "fs";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import { createRequire } from "module"; import { createRequire } from "module";
import { chmod } from "../lib/babel/util"; import { chmod } from "../lib/babel/util.js";
const require = createRequire(import.meta.url); const require = createRequire(import.meta.url);

View File

@ -1,6 +1,6 @@
import chalk from "chalk"; import chalk from "chalk";
import stripAnsi from "strip-ansi"; import stripAnsi from "strip-ansi";
import codeFrame, { codeFrameColumns } from ".."; import codeFrame, { codeFrameColumns } from "../lib/index.js";
describe("@babel/code-frame", function () { describe("@babel/code-frame", function () {
test("basic usage", function () { test("basic usage", function () {

View File

@ -1,13 +1,13 @@
import * as babel from "../lib/index"; import * as babel from "../lib/index.js";
import sourceMap from "source-map"; import sourceMap from "source-map";
import path from "path"; import path from "path";
import Plugin from "../lib/config/plugin"; import Plugin from "../lib/config/plugin.js";
import generator from "@babel/generator"; import generator from "@babel/generator";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import presetEnv from "../../babel-preset-env"; import presetEnv from "../../babel-preset-env/lib/index.js";
import pluginSyntaxFlow from "../../babel-plugin-syntax-flow"; import pluginSyntaxFlow from "../../babel-plugin-syntax-flow/lib/index.js";
import pluginFlowStripTypes from "../../babel-plugin-transform-flow-strip-types"; import pluginFlowStripTypes from "../../babel-plugin-transform-flow-strip-types/lib/index.js";
const cwd = path.dirname(fileURLToPath(import.meta.url)); const cwd = path.dirname(fileURLToPath(import.meta.url));

View File

@ -1,6 +1,6 @@
import path from "path"; import path from "path";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import { loadOptions as loadOptionsOrig, transformSync } from "../lib"; import { loadOptions as loadOptionsOrig, transformSync } from "../lib/index.js";
import pluginCommonJS from "@babel/plugin-transform-modules-commonjs"; import pluginCommonJS from "@babel/plugin-transform-modules-commonjs";
const cwd = path.dirname(fileURLToPath(import.meta.url)); const cwd = path.dirname(fileURLToPath(import.meta.url));

View File

@ -1,12 +1,12 @@
import path from "path"; import path from "path";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import * as babel from ".."; import * as babel from "../lib/index.js";
import { import {
spawnTransformAsync, spawnTransformAsync,
spawnTransformSync, spawnTransformSync,
supportsESM, supportsESM,
} from "./helpers/esm"; } from "./helpers/esm.js";
const nodeGte8 = (...args) => { const nodeGte8 = (...args) => {
// "minNodeVersion": "8.0.0" <-- For Ctrl+F when dropping node 6 // "minNodeVersion": "8.0.0" <-- For Ctrl+F when dropping node 6

View File

@ -1,6 +1,6 @@
import gensync from "gensync"; import gensync from "gensync";
import { makeStrongCacheSync, makeStrongCache } from "../lib/config/caching"; import { makeStrongCacheSync, makeStrongCache } from "../lib/config/caching.js";
import { waitFor } from "../lib/gensync-utils/async"; import { waitFor } from "../lib/gensync-utils/async.js";
describe("caching API", () => { describe("caching API", () => {
it("should allow permacaching with .forever()", () => { it("should allow permacaching with .forever()", () => {

View File

@ -2,12 +2,12 @@ import fs from "fs";
import os from "os"; import os from "os";
import path from "path"; import path from "path";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import * as babel from "../lib"; import * as babel from "../lib/index.js";
import getTargets from "@babel/helper-compilation-targets"; import getTargets from "@babel/helper-compilation-targets";
const dirname = path.dirname(fileURLToPath(import.meta.url)); const dirname = path.dirname(fileURLToPath(import.meta.url));
import { isMJS, loadOptionsAsync, skipUnsupportedESM } from "./helpers/esm"; import { isMJS, loadOptionsAsync, skipUnsupportedESM } from "./helpers/esm.js";
// TODO: In Babel 8, we can directly uses fs.promises which is supported by // TODO: In Babel 8, we can directly uses fs.promises which is supported by
// node 8+ // node 8+

View File

@ -1,7 +1,7 @@
import loadConfigRunner, { import loadConfigRunner, {
loadPartialConfig, loadPartialConfig,
createConfigItem, createConfigItem,
} from "../lib/config"; } from "../lib/config/index.js";
import path from "path"; import path from "path";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import { createRequire } from "module"; import { createRequire } from "module";
@ -38,10 +38,10 @@ describe("@babel/core config loading", () => {
filename: FILEPATH, filename: FILEPATH,
presets: skipProgrammatic presets: skipProgrammatic
? null ? null
: [[require("./fixtures/config-loading/preset3"), {}]], : [[require("./fixtures/config-loading/preset3.js"), {}]],
plugins: skipProgrammatic plugins: skipProgrammatic
? null ? null
: [[require("./fixtures/config-loading/plugin6"), {}]], : [[require("./fixtures/config-loading/plugin6.js"), {}]],
}; };
} }

View File

@ -4,7 +4,7 @@ import path from "path";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import { createRequire } from "module"; import { createRequire } from "module";
import * as babel from "../../lib"; import * as babel from "../../lib/index.js";
const require = createRequire(import.meta.url); const require = createRequire(import.meta.url);
const dirname = path.dirname(fileURLToPath(import.meta.url)); const dirname = path.dirname(fileURLToPath(import.meta.url));

View File

@ -1,4 +1,4 @@
import { loadOptions as loadOptionsOrig } from "../lib"; import { loadOptions as loadOptionsOrig } from "../lib/index.js";
import path from "path"; import path from "path";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";

View File

@ -1,6 +1,6 @@
import fs from "fs"; import fs from "fs";
import path from "path"; import path from "path";
import { parse } from "../lib"; import { parse } from "../lib/index.js";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import { createRequire } from "module"; import { createRequire } from "module";

View File

@ -1,5 +1,5 @@
import { transform } from "../lib/index"; import { transform } from "../lib/index.js";
import Plugin from "../lib/config/plugin"; import Plugin from "../lib/config/plugin.js";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import path from "path"; import path from "path";

View File

@ -1,4 +1,4 @@
import * as babel from "../lib/index"; import * as babel from "../lib/index.js";
import path from "path"; import path from "path";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";

View File

@ -1,4 +1,4 @@
import { loadOptions as loadOptionsOrig } from "../lib"; import { loadOptions as loadOptionsOrig } from "../lib/index.js";
import { join, dirname } from "path"; import { join, dirname } from "path";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";

View File

@ -1,4 +1,4 @@
import generate from "../lib"; import generate from "../lib/index.js";
import { parse } from "@babel/parser"; import { parse } from "@babel/parser";
describe("parameter parentheses", () => { describe("parameter parentheses", () => {

View File

@ -1,5 +1,5 @@
import Printer from "../lib/printer"; import Printer from "../lib/printer.js";
import generate, { CodeGenerator } from "../lib"; import generate, { CodeGenerator } from "../lib/index.js";
import { parse } from "@babel/parser"; import { parse } from "@babel/parser";
import * as t from "@babel/types"; import * as t from "@babel/types";
import fs from "fs"; import fs from "fs";

View File

@ -1,4 +1,4 @@
import annotateAsPure from "../"; import annotateAsPure from "../lib/index.js";
describe("@babel/helper-annotate-as-pure", () => { describe("@babel/helper-annotate-as-pure", () => {
it("will add leading comment", () => { it("will add leading comment", () => {

View File

@ -1,6 +1,6 @@
import { dirname, resolve } from "path"; import { dirname, resolve } from "path";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import getTargets from "../../lib"; import getTargets from "../../lib/index.js";
const currentDir = dirname(fileURLToPath(import.meta.url)); const currentDir = dirname(fileURLToPath(import.meta.url));

View File

@ -1,4 +1,4 @@
import getTargets from "../.."; import getTargets from "../../lib/index.js";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import path from "path"; import path from "path";

View File

@ -1,4 +1,4 @@
import getTargets from "../.."; import getTargets from "../../lib/index.js";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import path from "path"; import path from "path";

View File

@ -1,4 +1,4 @@
import getTargets from "../.."; import getTargets from "../../lib/index.js";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import path from "path"; import path from "path";

View File

@ -1,4 +1,4 @@
import { prettifyTargets, prettifyVersion } from "../lib/pretty"; import { prettifyTargets, prettifyVersion } from "../lib/pretty.js";
describe("pretty", () => { describe("pretty", () => {
describe("prettifyVersion", () => { describe("prettifyVersion", () => {

View File

@ -1,7 +1,7 @@
import browserslist from "browserslist"; import browserslist from "browserslist";
import { join, dirname } from "path"; import { join, dirname } from "path";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import getTargets from ".."; import getTargets from "../lib/index.js";
describe("getTargets", () => { describe("getTargets", () => {
it("parses", () => { it("parses", () => {

View File

@ -1,4 +1,4 @@
import { targetsSupported } from "../lib/filter-items"; import { targetsSupported } from "../lib/filter-items.js";
describe("targetsSupported", () => { describe("targetsSupported", () => {
const MAX_VERSION = `${Number.MAX_SAFE_INTEGER}.0.0`; const MAX_VERSION = `${Number.MAX_SAFE_INTEGER}.0.0`;

View File

@ -1,4 +1,4 @@
import { semverify } from "../lib/utils"; import { semverify } from "../lib/utils.js";
describe("utils", () => { describe("utils", () => {
describe("semverify", () => { describe("semverify", () => {

View File

@ -2,7 +2,7 @@ import * as babel from "@babel/core";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import path from "path"; import path from "path";
import { ImportInjector } from "../"; import { ImportInjector } from "../lib/index.js";
const cwd = path.dirname(fileURLToPath(import.meta.url)); const cwd = path.dirname(fileURLToPath(import.meta.url));

View File

@ -1,7 +1,7 @@
import { parse } from "@babel/parser"; import { parse } from "@babel/parser";
import generator from "@babel/generator"; import generator from "@babel/generator";
import * as t from "@babel/types"; import * as t from "@babel/types";
import optimizeCallExpression from ".."; import optimizeCallExpression from "../lib/index.js";
function transformInput(input, thisIdentifier) { function transformInput(input, thisIdentifier) {
const ast = parse(input); const ast = parse(input);

View File

@ -1,4 +1,4 @@
import { runCodeInTestContext } from ".."; import { runCodeInTestContext } from "../lib/index.js";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
const filename = fileURLToPath(import.meta.url); const filename = fileURLToPath(import.meta.url);

View File

@ -1,4 +1,4 @@
import { isIdentifierName } from ".."; import { isIdentifierName } from "../lib/index.js";
describe("isIdentifierName", function () { describe("isIdentifierName", function () {
it("returns false if provided string is empty", function () { it("returns false if provided string is empty", function () {

View File

@ -1,4 +1,4 @@
import { findSuggestion } from ".."; import { findSuggestion } from "../lib/index.js";
describe("findSuggestion", function () { describe("findSuggestion", function () {
test.each([ test.each([

View File

@ -1,4 +1,4 @@
import { OptionValidator } from ".."; import { OptionValidator } from "../lib/index.js";
describe("OptionValidator", () => { describe("OptionValidator", () => {
describe("validateTopLevelOptions", () => { describe("validateTopLevelOptions", () => {

View File

@ -1,6 +1,6 @@
import path from "path"; import path from "path";
import template from "@babel/template"; import template from "@babel/template";
import helpers from "../../lib/helpers"; import helpers from "../../lib/helpers.js";
function getHelperId(dir, name) { function getHelperId(dir, name) {
const testName = path.basename(dir); const testName = path.basename(dir);

View File

@ -1,6 +1,6 @@
import chalk from "chalk"; import chalk from "chalk";
import stripAnsi from "strip-ansi"; import stripAnsi from "strip-ansi";
import highlight, { shouldHighlight, getChalk } from ".."; import highlight, { shouldHighlight, getChalk } from "../lib/index.js";
describe("@babel/highlight", function () { describe("@babel/highlight", function () {
function stubColorSupport(supported) { function stubColorSupport(supported) {

View File

@ -1,6 +1,6 @@
import path from "path"; import path from "path";
import { runFixtureTestsWithoutExactASTMatch } from "./helpers/runFixtureTests"; import { runFixtureTestsWithoutExactASTMatch } from "./helpers/runFixtureTests.js";
import { parseExpression } from "../lib"; import { parseExpression } from "../lib/index.js";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
runFixtureTestsWithoutExactASTMatch( runFixtureTestsWithoutExactASTMatch(

View File

@ -1,4 +1,4 @@
import { parse } from "../lib"; import { parse } from "../lib/index.js";
describe("error codes", function () { describe("error codes", function () {
it("raises an error with BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED and reasonCode", function () { it("raises an error with BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED and reasonCode", function () {

View File

@ -1,6 +1,6 @@
import path from "path"; import path from "path";
import { runFixtureTestsWithoutExactASTMatch } from "./helpers/runFixtureTests"; import { runFixtureTestsWithoutExactASTMatch } from "./helpers/runFixtureTests.js";
import { parse } from "../lib"; import { parse } from "../lib/index.js";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
runFixtureTestsWithoutExactASTMatch( runFixtureTestsWithoutExactASTMatch(

View File

@ -1,6 +1,6 @@
import path from "path"; import path from "path";
import { runFixtureTests } from "./helpers/runFixtureTests"; import { runFixtureTests } from "./helpers/runFixtureTests.js";
import { parseExpression } from "../lib"; import { parseExpression } from "../lib/index.js";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
const fixtures = path.join( const fixtures = path.join(

View File

@ -1,6 +1,6 @@
import path from "path"; import path from "path";
import { runFixtureTests } from "./helpers/runFixtureTests"; import { runFixtureTests } from "./helpers/runFixtureTests.js";
import { parse } from "../lib"; import { parse } from "../lib/index.js";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
const fixtures = path.join( const fixtures = path.join(

View File

@ -1,4 +1,4 @@
import { parse } from "../lib"; import { parse } from "../lib/index.js";
describe("options", () => { describe("options", () => {
describe("strictMode", () => { describe("strictMode", () => {

View File

@ -1,4 +1,4 @@
import { parse } from "../lib"; import { parse } from "../lib/index.js";
function getParser(code, plugins) { function getParser(code, plugins) {
return () => parse(code, { plugins, sourceType: "module" }); return () => parse(code, { plugins, sourceType: "module" });

View File

@ -1,4 +1,4 @@
import { tt, tokenOperatorPrecedence } from "../../../src/tokenizer/types"; import { tt, tokenOperatorPrecedence } from "../../../src/tokenizer/types.js";
describe("token types", () => { describe("token types", () => {
it("should check if the binOp for relational === in", () => { it("should check if the binOp for relational === in", () => {

View File

@ -1,7 +1,7 @@
import { import {
isKeyword, isKeyword,
keywordRelationalOperator, keywordRelationalOperator,
} from "../../../src/util/identifier"; } from "../../../src/util/identifier.js";
describe("identifier", () => { describe("identifier", () => {
describe("isKeyword", () => { describe("isKeyword", () => {

View File

@ -1,4 +1,4 @@
import { getLineInfo } from "../../../src/util/location"; import { getLineInfo } from "../../../src/util/location.js";
describe("getLineInfo", () => { describe("getLineInfo", () => {
const input = "a\nb\nc\nd\ne\nf\ng\nh\ni"; const input = "a\nb\nc\nd\ne\nf\ng\nh\ni";

View File

@ -1,5 +1,5 @@
import * as babel from "@babel/core"; import * as babel from "@babel/core";
import proposalClassStaticBlock from ".."; import proposalClassStaticBlock from "../lib/index.js";
describe("plugin ordering", () => { describe("plugin ordering", () => {
it("should work when @babel/plugin-proposal-class-static-block is after class features plugin", () => { it("should work when @babel/plugin-proposal-class-static-block is after class features plugin", () => {

View File

@ -1,5 +1,5 @@
import { parse } from "@babel/parser"; import { parse } from "@babel/parser";
import shouldStoreRHSInTemporaryVariable from "../lib/shouldStoreRHSInTemporaryVariable"; import shouldStoreRHSInTemporaryVariable from "../lib/shouldStoreRHSInTemporaryVariable.js";
function getFistObjectPattern(program) { function getFistObjectPattern(program) {
return parse(program, { sourceType: "module" }).program.body[0] return parse(program, { sourceType: "module" }).program.body[0]

View File

@ -1,4 +1,4 @@
import { willPathCastToBoolean } from "../src/util"; import { willPathCastToBoolean } from "../src/util.js";
import { parseSync, traverse } from "@babel/core"; import { parseSync, traverse } from "@babel/core";
function getPath(input, parserOpts) { function getPath(input, parserOpts) {

View File

@ -1,5 +1,5 @@
import { parse } from "@babel/core"; import { parse } from "@babel/core";
import syntaxDecorators from "../lib"; import syntaxDecorators from "../lib/index.js";
function makeParser(code, options) { function makeParser(code, options) {
return () => return () =>

View File

@ -1,5 +1,5 @@
import * as babel from "@babel/core"; import * as babel from "@babel/core";
import transformAmd from "../lib"; import transformAmd from "../lib/index.js";
import externalHelpers from "@babel/plugin-external-helpers"; import externalHelpers from "@babel/plugin-external-helpers";
it("'importInterop' accepts a function", function () { it("'importInterop' accepts a function", function () {

View File

@ -2,7 +2,7 @@ import * as babel from "@babel/core";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import path from "path"; import path from "path";
import transformCommonJS from ".."; import transformCommonJS from "../lib/index.js";
test("Doesn't use the same object for two different nodes in the AST", function () { test("Doesn't use the same object for two different nodes in the AST", function () {
const code = 'import Foo from "bar"; Foo; Foo;'; const code = 'import Foo from "bar"; Foo; Foo;';

View File

@ -3,7 +3,7 @@ import vm from "vm";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import path from "path"; import path from "path";
import transformCommonJS from ".."; import transformCommonJS from "../lib/index.js";
test("Re-export doesn't overwrite __esModule flag", function () { test("Re-export doesn't overwrite __esModule flag", function () {
let code = 'export * from "./dep";'; let code = 'export * from "./dep";';

View File

@ -1,5 +1,5 @@
import * as babel from "@babel/core"; import * as babel from "@babel/core";
import transformCommonjs from "../lib"; import transformCommonjs from "../lib/index.js";
import externalHelpers from "@babel/plugin-external-helpers"; import externalHelpers from "@babel/plugin-external-helpers";
it("'importInterop' accepts a function", function () { it("'importInterop' accepts a function", function () {

View File

@ -1,5 +1,5 @@
import * as babel from "@babel/core"; import * as babel from "@babel/core";
import transformUmd from "../lib"; import transformUmd from "../lib/index.js";
import externalHelpers from "@babel/plugin-external-helpers"; import externalHelpers from "@babel/plugin-external-helpers";
it("'importInterop' accepts a function", function () { it("'importInterop' accepts a function", function () {

View File

@ -3,6 +3,7 @@ import { createRequire } from "module";
const require = createRequire(import.meta.url); const require = createRequire(import.meta.url);
it("module.exports.default is correctly updated", () => { it("module.exports.default is correctly updated", () => {
// eslint-disable-next-line import/extensions
const typeofHelper = require("@babel/runtime/helpers/typeof"); const typeofHelper = require("@babel/runtime/helpers/typeof");
expect(typeof typeofHelper).toBe("function"); expect(typeof typeofHelper).toBe("function");

View File

@ -2,7 +2,7 @@ import * as babel from "@babel/core";
import fs from "fs"; import fs from "fs";
import { createRequire } from "module"; import { createRequire } from "module";
import transformTypeofSymbol from ".."; import transformTypeofSymbol from "../lib/index.js";
const require = createRequire(import.meta.url); const require = createRequire(import.meta.url);

View File

@ -1,4 +1,4 @@
import getOptionSpecificExcludesFor from "../lib/get-option-specific-excludes"; import getOptionSpecificExcludesFor from "../lib/get-option-specific-excludes.js";
describe("defaults", () => { describe("defaults", () => {
describe("getOptionSpecificExcludesFor", () => { describe("getOptionSpecificExcludesFor", () => {

View File

@ -1,10 +1,11 @@
// eslint-disable-next-line import/extensions
import compatData from "@babel/compat-data/plugins"; import compatData from "@babel/compat-data/plugins";
import * as babelPresetEnv from "../lib/index"; import * as babelPresetEnv from "../lib/index.js";
import removeRegeneratorEntryPlugin from "../lib/polyfills/regenerator"; import removeRegeneratorEntryPlugin from "../lib/polyfills/regenerator.js";
import pluginLegacyBabelPolyfill from "../lib/polyfills/babel-polyfill"; import pluginLegacyBabelPolyfill from "../lib/polyfills/babel-polyfill.js";
import transformations from "../lib/module-transformations"; import transformations from "../lib/module-transformations.js";
import availablePlugins from "../lib/available-plugins"; import availablePlugins from "../lib/available-plugins.js";
import _pluginCoreJS2 from "babel-plugin-polyfill-corejs2"; import _pluginCoreJS2 from "babel-plugin-polyfill-corejs2";
import _pluginCoreJS3 from "babel-plugin-polyfill-corejs3"; import _pluginCoreJS3 from "babel-plugin-polyfill-corejs3";

View File

@ -3,7 +3,7 @@ import normalizeOptions, {
validateModulesOption, validateModulesOption,
validateUseBuiltInsOption, validateUseBuiltInsOption,
normalizePluginName, normalizePluginName,
} from "../lib/normalize-options"; } from "../lib/normalize-options.js";
describe("normalize-options", () => { describe("normalize-options", () => {
describe("normalizeOptions", () => { describe("normalizeOptions", () => {

View File

@ -1,5 +1,5 @@
import * as babel7_12 from "@babel/core"; import * as babel7_12 from "@babel/core";
import env from ".."; import env from "../lib/index.js";
import path from "path"; import path from "path";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";

View File

@ -1,4 +1,4 @@
import env from ".."; import env from "../lib/index.js";
import * as babel from "@babel/core"; import * as babel from "@babel/core";
describe("supportsTopLevelAwait enables the parser plugin for old parser versions", () => { describe("supportsTopLevelAwait enables the parser plugin for old parser versions", () => {

View File

@ -1,4 +1,4 @@
import normalizeOptions from "../src/normalize-options"; import normalizeOptions from "../lib/normalize-options.js";
describe("normalize options", () => { describe("normalize options", () => {
(process.env.BABEL_8_BREAKING ? describe : describe.skip)("Babel 8", () => { (process.env.BABEL_8_BREAKING ? describe : describe.skip)("Babel 8", () => {
it("should throw on unknown options", () => { it("should throw on unknown options", () => {

View File

@ -1,4 +1,4 @@
import react from "../lib"; import react from "../lib/index.js";
describe("react preset", () => { describe("react preset", () => {
it("does throw clear error when no options passed for Babel 6", () => { it("does throw clear error when no options passed for Babel 6", () => {

View File

@ -1,4 +1,4 @@
import normalizeOptions from "../src/normalize-options"; import normalizeOptions from "../src/normalize-options.js";
describe("normalize options", () => { describe("normalize options", () => {
(process.env.BABEL_8_BREAKING ? describe : describe.skip)("Babel 8", () => { (process.env.BABEL_8_BREAKING ? describe : describe.skip)("Babel 8", () => {
it("should throw on unknown options", () => { it("should throw on unknown options", () => {

View File

@ -1,4 +1,4 @@
import normalizeOptions from "../src/normalize-options"; import normalizeOptions from "../src/normalize-options.js";
describe("normalize options", () => { describe("normalize options", () => {
(process.env.BABEL_8_BREAKING ? describe : describe.skip)("Babel 8", () => { (process.env.BABEL_8_BREAKING ? describe : describe.skip)("Babel 8", () => {
it("should throw on unknown options", () => { it("should throw on unknown options", () => {

View File

@ -40,7 +40,7 @@ describe("@babel/register - caching", () => {
beforeEach(() => { beforeEach(() => {
// Since lib/cache is a singleton we need to fully reload it // Since lib/cache is a singleton we need to fully reload it
jest.resetModules(); jest.resetModules();
const cache = require("../lib/cache"); const cache = require("../lib/cache.js");
load = cache.load; load = cache.load;
get = cache.get; get = cache.get;

View File

@ -7,7 +7,7 @@ const require = createRequire(import.meta.url);
() => { () => {
let Babel; let Babel;
beforeAll(() => { beforeAll(() => {
Babel = require("../babel"); Babel = require("../babel.js");
}); });
it("handles the es2015-no-commonjs preset", () => { it("handles the es2015-no-commonjs preset", () => {

View File

@ -6,7 +6,7 @@ const require = createRequire(import.meta.url);
() => { () => {
let Babel; let Babel;
beforeAll(() => { beforeAll(() => {
Babel = require("../babel"); Babel = require("../babel.js");
}); });
it("should parser decimal literal", () => { it("should parser decimal literal", () => {

View File

@ -1,5 +1,5 @@
import generator from "../../babel-generator"; import generator from "../../babel-generator/lib/index.js";
import template from "../lib"; import template from "../lib/index.js";
import * as t from "@babel/types"; import * as t from "@babel/types";
const comments = "// Sum two numbers\nconst add = (a, b) => a + b;"; const comments = "// Sum two numbers\nconst add = (a, b) => a + b;";

View File

@ -1,4 +1,4 @@
import traverse from "../lib"; import traverse from "../lib/index.js";
import { parse } from "@babel/parser"; import { parse } from "@babel/parser";
describe("path/ancestry", function () { describe("path/ancestry", function () {

View File

@ -1,4 +1,4 @@
import { NodePath } from "../lib"; import { NodePath } from "../lib/index.js";
import { parse } from "@babel/parser"; import { parse } from "@babel/parser";
import generate from "@babel/generator"; import generate from "@babel/generator";
import * as t from "@babel/types"; import * as t from "@babel/types";

View File

@ -1,4 +1,4 @@
import traverse from "../lib"; import traverse from "../lib/index.js";
import { parse } from "@babel/parser"; import { parse } from "@babel/parser";
import generate from "@babel/generator"; import generate from "@babel/generator";
import * as t from "@babel/types"; import * as t from "@babel/types";

View File

@ -1,4 +1,4 @@
import traverse from "../lib"; import traverse from "../lib/index.js";
import { parse } from "@babel/parser"; import { parse } from "@babel/parser";
function getPath(code) { function getPath(code) {

View File

@ -1,4 +1,4 @@
import traverse from "../lib"; import traverse from "../lib/index.js";
import { parse } from "@babel/parser"; import { parse } from "@babel/parser";
import * as t from "@babel/types"; import * as t from "@babel/types";

View File

@ -1,5 +1,5 @@
import assert from "assert"; import assert from "assert";
import { Hub } from "../lib"; import { Hub } from "../lib/index.js";
describe("hub", function () { describe("hub", function () {
it("default buildError should return TypeError", function () { it("default buildError should return TypeError", function () {

View File

@ -1,4 +1,4 @@
import traverse from "../lib"; import traverse from "../lib/index.js";
import { parse } from "@babel/parser"; import { parse } from "@babel/parser";
import * as t from "@babel/types"; import * as t from "@babel/types";

View File

@ -1,4 +1,4 @@
import traverse from "../lib"; import traverse from "../lib/index.js";
import { parse } from "@babel/parser"; import { parse } from "@babel/parser";
function getPath(code, options = { sourceType: "script" }) { function getPath(code, options = { sourceType: "script" }) {

View File

@ -1,4 +1,4 @@
import traverse from "../lib"; import traverse from "../lib/index.js";
import { parse } from "@babel/parser"; import { parse } from "@babel/parser";
import generate from "@babel/generator"; import generate from "@babel/generator";
import * as t from "@babel/types"; import * as t from "@babel/types";

View File

@ -1,4 +1,4 @@
import { NodePath } from "../../lib"; import { NodePath } from "../../lib/index.js";
describe("NodePath", () => { describe("NodePath", () => {
describe("setData/getData", () => { describe("setData/getData", () => {

View File

@ -1,4 +1,4 @@
import traverse from "../lib"; import traverse from "../lib/index.js";
import { parse } from "@babel/parser"; import { parse } from "@babel/parser";
import generate from "@babel/generator"; import generate from "@babel/generator";

View File

@ -1,4 +1,4 @@
import traverse from "../lib"; import traverse from "../lib/index.js";
import { parse } from "@babel/parser"; import { parse } from "@babel/parser";
import generate from "@babel/generator"; import generate from "@babel/generator";
import * as t from "@babel/types"; import * as t from "@babel/types";

View File

@ -1,4 +1,4 @@
import traverse, { NodePath } from "../lib"; import traverse, { NodePath } from "../lib/index.js";
import { parse } from "@babel/parser"; import { parse } from "@babel/parser";
import * as t from "@babel/types"; import * as t from "@babel/types";

View File

@ -1,4 +1,4 @@
import traverse from "../lib"; import traverse from "../lib/index.js";
import { parse } from "@babel/parser"; import { parse } from "@babel/parser";
import * as t from "@babel/types"; import * as t from "@babel/types";

View File

@ -1,4 +1,4 @@
import * as t from "../lib"; import * as t from "../lib/index.js";
describe("asserts", () => { describe("asserts", () => {
const consoleTrace = console.trace; const consoleTrace = console.trace;

View File

@ -1,4 +1,4 @@
import * as t from "../../.."; import * as t from "../../../lib/index.js";
describe("builders", function () { describe("builders", function () {
describe("es2015", function () { describe("es2015", function () {

View File

@ -1,4 +1,4 @@
import * as t from "../../.."; import * as t from "../../../lib/index.js";
describe("builders", function () { describe("builders", function () {
describe("experimental", function () { describe("experimental", function () {

View File

@ -1,4 +1,4 @@
import { createTypeAnnotationBasedOnTypeof } from "../../.."; import { createTypeAnnotationBasedOnTypeof } from "../../../lib/index.js";
describe("builders", function () { describe("builders", function () {
describe("flow", function () { describe("flow", function () {

View File

@ -1,4 +1,4 @@
import * as t from "../../.."; import * as t from "../../../lib/index.js";
describe("builders", function () { describe("builders", function () {
describe("flow", function () { describe("flow", function () {

View File

@ -1,4 +1,4 @@
import * as t from "../../.."; import * as t from "../../../lib/index.js";
describe("builders", function () { describe("builders", function () {
describe("typescript", function () { describe("typescript", function () {

View File

@ -1,4 +1,4 @@
import * as t from "../../.."; import * as t from "../../../lib/index.js";
describe("builders", function () { describe("builders", function () {
describe("typescript", function () { describe("typescript", function () {

Some files were not shown because too many files have changed in this diff Show More