Innovenergy_trunk/frontend/node_modules/testcafe/lib/api/test-controller/proxy.js

30 lines
3.5 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 _1 = __importDefault(require("./"));
const delegated_api_1 = require("../../utils/delegated-api");
const test_run_tracker_1 = __importDefault(require("../test-run-tracker"));
const runtime_1 = require("../../errors/runtime");
const types_1 = require("../../errors/types");
const testControllerProxy = Object.create(null);
(0, delegated_api_1.delegateAPI)(testControllerProxy, _1.default.API_LIST, {
getHandler(propName, accessor) {
const testRun = test_run_tracker_1.default.resolveContextTestRun();
if (!testRun) {
let callsiteName = null;
if (accessor === 'getter')
callsiteName = 'get';
else if (accessor === 'setter')
callsiteName = 'set';
else
callsiteName = propName;
throw new runtime_1.APIError(callsiteName, types_1.RUNTIME_ERRORS.testControllerProxyCannotResolveTestRun);
}
return testRun.controller;
},
});
exports.default = testControllerProxy;
module.exports = exports.default;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJveHkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvYXBpL3Rlc3QtY29udHJvbGxlci9wcm94eS5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLDBDQUFnQztBQUNoQyw2REFBd0Q7QUFDeEQsMkVBQWlEO0FBQ2pELGtEQUFnRDtBQUNoRCw4Q0FBb0Q7QUFFcEQsTUFBTSxtQkFBbUIsR0FBRyxNQUFNLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxDQUFDO0FBRWhELElBQUEsMkJBQVcsRUFBQyxtQkFBbUIsRUFBRSxVQUFjLENBQUMsUUFBUSxFQUFFO0lBQ3RELFVBQVUsQ0FBRSxRQUFRLEVBQUUsUUFBUTtRQUMxQixNQUFNLE9BQU8sR0FBRywwQkFBYyxDQUFDLHFCQ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