mirror of
https://github.com/hanzoai/babel.git
synced 2026-10-30 14:46:06 +00:00
36 lines
834 B
JavaScript
36 lines
834 B
JavaScript
import env from "../lib/index.js";
|
|
import * as babel from "@babel/core";
|
|
import { itNoESM } from "$repo-utils";
|
|
|
|
const itBabel7NoESM = process.env.BABEL_8_BREAKING ? it.skip : itNoESM;
|
|
|
|
describe("preset-env", () => {
|
|
function extractParserOptions(api, { ref }) {
|
|
return {
|
|
manipulateOptions(opts, parserOpts) {
|
|
ref.parserOpts = parserOpts;
|
|
},
|
|
visitor: {},
|
|
};
|
|
}
|
|
|
|
it("empty test", () => {});
|
|
|
|
itBabel7NoESM(
|
|
"should enable the 'importMeta' parser plugin for old parser versions",
|
|
() => {
|
|
const ref = {};
|
|
babel.transformSync("", {
|
|
configFile: false,
|
|
presets: [env],
|
|
plugins: [[extractParserOptions, { ref }]],
|
|
caller: {
|
|
name: "test",
|
|
},
|
|
});
|
|
|
|
expect(ref.parserOpts.plugins).toContain("importMeta");
|
|
},
|
|
);
|
|
});
|