source: trip-planner-front/node_modules/@angular-devkit/build-angular/src/webpack/configs/test.js@ ceaed42

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

initial commit

  • Property mode set to 100644
File size: 3.5 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 */
9var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10 if (k2 === undefined) k2 = k;
11 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12}) : (function(o, m, k, k2) {
13 if (k2 === undefined) k2 = k;
14 o[k2] = m[k];
15}));
16var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17 Object.defineProperty(o, "default", { enumerable: true, value: v });
18}) : function(o, v) {
19 o["default"] = v;
20});
21var __importStar = (this && this.__importStar) || function (mod) {
22 if (mod && mod.__esModule) return mod;
23 var result = {};
24 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25 __setModuleDefault(result, mod);
26 return result;
27};
28Object.defineProperty(exports, "__esModule", { value: true });
29exports.getTestConfig = void 0;
30const glob = __importStar(require("glob"));
31const path = __importStar(require("path"));
32const typescript_1 = require("typescript");
33const helpers_1 = require("../utils/helpers");
34function getTestConfig(wco) {
35 const { buildOptions: { codeCoverage, codeCoverageExclude, main, sourceMap, webWorkerTsConfig }, root, sourceRoot, } = wco;
36 const extraRules = [];
37 const extraPlugins = [];
38 if (codeCoverage) {
39 const exclude = [/\.(e2e|spec)\.tsx?$/, /node_modules/];
40 if (codeCoverageExclude) {
41 for (const excludeGlob of codeCoverageExclude) {
42 glob
43 .sync(path.join(root, excludeGlob), { nodir: true })
44 .forEach((file) => exclude.push(path.normalize(file)));
45 }
46 }
47 extraRules.push({
48 test: /\.(jsx?|tsx?)$/,
49 loader: require.resolve('@jsdevtools/coverage-istanbul-loader'),
50 options: { esModules: true },
51 enforce: 'post',
52 exclude,
53 include: sourceRoot,
54 });
55 }
56 if (sourceMap.scripts || sourceMap.styles) {
57 extraPlugins.push(helpers_1.getSourceMapDevTool(sourceMap.scripts, sourceMap.styles, false, true));
58 }
59 return {
60 mode: 'development',
61 target: wco.tsConfig.options.target === typescript_1.ScriptTarget.ES5 ? ['web', 'es5'] : 'web',
62 resolve: {
63 mainFields: ['es2015', 'browser', 'module', 'main'],
64 },
65 devtool: false,
66 entry: {
67 main: path.resolve(root, main),
68 },
69 module: {
70 rules: extraRules,
71 parser: webWorkerTsConfig === undefined
72 ? {
73 javascript: {
74 worker: false,
75 url: false,
76 },
77 }
78 : undefined,
79 },
80 plugins: extraPlugins,
81 optimization: {
82 splitChunks: {
83 chunks: (chunk) => !helpers_1.isPolyfillsEntry(chunk.name),
84 cacheGroups: {
85 vendors: false,
86 defaultVendors: {
87 name: 'vendor',
88 chunks: (chunk) => chunk.name === 'main',
89 enforce: true,
90 test: /[\\/]node_modules[\\/]/,
91 },
92 },
93 },
94 },
95 };
96}
97exports.getTestConfig = getTestConfig;
Note: See TracBrowser for help on using the repository browser.