source: trip-planner-front/node_modules/@angular-devkit/build-angular/src/dev-server/tests/setup.js@ 6c1585f

Last change on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.1 KB
Line 
1"use strict";
2/**
3 * @license
4 * Copyright Google LLC All Rights Reserved.
5 *
6 * Use of this source code is governed by an MIT-style license that can be
7 * found in the LICENSE file at https://angular.io/license
8 */
9Object.defineProperty(exports, "__esModule", { value: true });
10exports.setupBrowserTarget = exports.BUILD_TIMEOUT = exports.BASE_OPTIONS = exports.DEV_SERVER_BUILDER_INFO = exports.describeBuilder = void 0;
11const fs_1 = require("fs");
12const browser_1 = require("../../browser");
13const setup_1 = require("../../browser/tests/setup");
14var testing_1 = require("../../testing");
15Object.defineProperty(exports, "describeBuilder", { enumerable: true, get: function () { return testing_1.describeBuilder; } });
16exports.DEV_SERVER_BUILDER_INFO = Object.freeze({
17 name: '@angular-devkit/build-angular:dev-server',
18 schemaPath: __dirname + '/../schema.json',
19});
20/**
21 * Contains all required dev-server builder fields.
22 * The port is also set to zero to ensure a free port is used for each test which
23 * supports parallel test execution.
24 */
25exports.BASE_OPTIONS = Object.freeze({
26 browserTarget: 'test:build',
27 port: 0,
28});
29/**
30 * Maximum time for single build/rebuild
31 * This accounts for CI variability.
32 */
33exports.BUILD_TIMEOUT = 15000;
34/**
35 * Cached browser builder option schema
36 */
37let browserSchema = undefined;
38/**
39 * Adds a `build` target to a builder test harness for the browser builder with the base options
40 * used by the browser builder tests.
41 *
42 * @param harness The builder harness to use when setting up the browser builder target
43 * @param extraOptions The additional options that should be used when executing the target.
44 */
45function setupBrowserTarget(harness, extraOptions) {
46 if (!browserSchema) {
47 browserSchema = JSON.parse(fs_1.readFileSync(setup_1.BROWSER_BUILDER_INFO.schemaPath, 'utf8'));
48 }
49 harness.withBuilderTarget('build', browser_1.buildWebpackBrowser, {
50 ...setup_1.BASE_OPTIONS,
51 ...extraOptions,
52 }, {
53 builderName: setup_1.BROWSER_BUILDER_INFO.name,
54 optionSchema: browserSchema,
55 });
56}
57exports.setupBrowserTarget = setupBrowserTarget;
Note: See TracBrowser for help on using the repository browser.