Innovenergy_trunk/frontend/node_modules/testcafe/lib/load-assets.js

31 lines
5.2 KiB
JavaScript
Raw Normal View History

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const read_file_relative_1 = require("read-file-relative");
const testcafe_hammerhead_1 = require("testcafe-hammerhead");
const ASSETS_CACHE = {};
function loadAsset(filename, asBuffer) {
if (!ASSETS_CACHE[filename])
ASSETS_CACHE[filename] = (0, read_file_relative_1.readSync)(filename, asBuffer);
return ASSETS_CACHE[filename];
}
function default_1(developmentMode) {
return {
favIcon: loadAsset('./client/ui/favicon.ico', true),
coreScript: loadAsset((0, testcafe_hammerhead_1.getAssetPath)('./client/core/index.js', developmentMode)),
driverScript: loadAsset((0, testcafe_hammerhead_1.getAssetPath)('./client/driver/index.js', developmentMode)),
uiScript: loadAsset((0, testcafe_hammerhead_1.getAssetPath)('./client/ui/index.js', developmentMode)),
uiStyle: loadAsset('./client/ui/styles.css'),
uiSprite: loadAsset('./client/ui/sprite.png', true),
uiSpriteSvg: loadAsset('./client/ui/sprite.svg', true),
idlePageScript: loadAsset('./client/browser/idle-page/index.js'),
idlePageStyle: loadAsset('./client/browser/idle-page/styles.css'),
idlePageLogo: loadAsset('./client/browser/idle-page/logo.svg', true),
serviceWorkerScript: loadAsset('./client/browser/service-worker.js'),
automationScript: loadAsset((0, testcafe_hammerhead_1.getAssetPath)('./client/automation/index.js', developmentMode)),
// NOTE: Load the legacy client script lazily to reduce startup time
legacyRunnerScript: require('testcafe-legacy-api').CLIENT_RUNNER_SCRIPT,
};
}
exports.default = default_1;
module.exports = exports.default;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZC1hc3NldHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvbG9hZC1hc3NldHMuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyREFBc0Q7QUFDdEQsNkRBQW1EO0FBR25ELE1BQU0sWUFBWSx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