19 lines
2.2 KiB
JavaScript
19 lines
2.2 KiB
JavaScript
"use strict";
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const testcafe_hammerhead_1 = require("testcafe-hammerhead");
|
|
const internal_properties_1 = __importDefault(require("../client/driver/internal-properties"));
|
|
function getCustomClientScriptCode(script, proxyless) {
|
|
const scriptCode = proxyless ? script.content : (0, testcafe_hammerhead_1.processScript)(script.content);
|
|
return `try {
|
|
${scriptCode}
|
|
}
|
|
catch (e) {
|
|
window['${internal_properties_1.default.testCafeDriverInstance}'].onCustomClientScriptError(e, '${script.module || ''}');
|
|
}`;
|
|
}
|
|
exports.default = getCustomClientScriptCode;
|
|
module.exports = exports.default;
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0LWNvZGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY3VzdG9tLWNsaWVudC1zY3JpcHRzL2dldC1jb2RlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsNkRBQW9EO0FBQ3BELCtGQUF1RTtBQUd2RSxTQUF3Qix5QkFBeUIsQ0FBRSxNQUFvQixFQUFFLFNBQWtCO0lBQ3ZGLE1BQU0sVUFBVSxHQUFHLFNBQVMsQ0FBQyxDQUFDLENBQUMsTUFBTSxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsSUFBQSxtQ0FBYSxFQUFDLE1BQU0sQ0FBQyxPQUFPLENBQUMsQ0FBQztJQUU5RSxPQUFPO1VBQ0QsVUFBVTs7O2lCQUdILDZCQUFtQixDQUFDLHNCQUFzQixvQ0FBb0MsTUFBTSxDQUFDLE1BQU0sSUFBSSxFQUFFO01BQzVHLENBQUM7QUFDUCxDQUFDO0FBVEQsNENBU0MiLCJzb3VyY2VzQ29ud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