36 lines
5.6 KiB
JavaScript
36 lines
5.6 KiB
JavaScript
"use strict";
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.initTestFileCompilers = exports.getTestFileCompilers = void 0;
|
|
const testcafe_hammerhead_1 = __importDefault(require("testcafe-hammerhead"));
|
|
const testcafe_legacy_api_1 = require("testcafe-legacy-api");
|
|
const compiler_1 = __importDefault(require("./test-file/formats/es-next/compiler"));
|
|
const compiler_2 = __importDefault(require("./test-file/formats/typescript/compiler"));
|
|
const compiler_3 = __importDefault(require("./test-file/formats/coffeescript/compiler"));
|
|
const compiler_4 = __importDefault(require("./test-file/formats/raw/compiler"));
|
|
const compiler_5 = __importDefault(require("./test-file/formats/dev-tools/compiler"));
|
|
const customizable_compilers_1 = __importDefault(require("../configuration/customizable-compilers"));
|
|
function createTestFileCompilers(compilerOptions = {}, { isCompilerServiceMode, baseUrl, experimentalEsm } = {}) {
|
|
return [
|
|
new testcafe_legacy_api_1.Compiler(testcafe_hammerhead_1.default.processScript),
|
|
new compiler_1.default({ isCompilerServiceMode, baseUrl, experimentalEsm }),
|
|
new compiler_2.default(compilerOptions[customizable_compilers_1.default.typescript], { isCompilerServiceMode, baseUrl, experimentalEsm }),
|
|
new compiler_3.default({ baseUrl, experimentalEsm }),
|
|
new compiler_4.default({ baseUrl }),
|
|
new compiler_5.default({ baseUrl }),
|
|
];
|
|
}
|
|
let testFileCompilers = [];
|
|
function getTestFileCompilers() {
|
|
if (!testFileCompilers.length)
|
|
initTestFileCompilers();
|
|
return testFileCompilers;
|
|
}
|
|
exports.getTestFileCompilers = getTestFileCompilers;
|
|
function initTestFileCompilers(compilerOptions, { isCompilerServiceMode, baseUrl, experimentalEsm } = {}) {
|
|
testFileCompilers = createTestFileCompilers(compilerOptions, { isCompilerServiceMode, baseUrl, experimentalEsm });
|
|
}
|
|
exports.initTestFileCompilers = init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