Skip to content

Commit cd75d92

Browse files
author
Angular Builds
committed
f9da2d8eb style: format tslint.json.template
1 parent e16424c commit cd75d92

File tree

4 files changed

+29
-26
lines changed

4 files changed

+29
-26
lines changed

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
{
22
"name": "@angular-devkit/build-angular",
3-
"version": "0.1000.0-rc.0+17.22b9cc0",
3+
"version": "0.1000.0-rc.0+20.f9da2d8",
44
"description": "Angular Webpack Build Facade",
55
"experimental": true,
66
"main": "src/index.js",
77
"typings": "src/index.d.ts",
88
"builders": "builders.json",
99
"dependencies": {
10-
"@angular-devkit/architect": "github:angular/angular-devkit-architect-builds#22b9cc028",
11-
"@angular-devkit/build-optimizer": "github:angular/angular-devkit-build-optimizer-builds#22b9cc028",
12-
"@angular-devkit/build-webpack": "github:angular/angular-devkit-build-webpack-builds#22b9cc028",
13-
"@angular-devkit/core": "github:angular/angular-devkit-core-builds#22b9cc028",
10+
"@angular-devkit/architect": "github:angular/angular-devkit-architect-builds#f9da2d8eb",
11+
"@angular-devkit/build-optimizer": "github:angular/angular-devkit-build-optimizer-builds#f9da2d8eb",
12+
"@angular-devkit/build-webpack": "github:angular/angular-devkit-build-webpack-builds#f9da2d8eb",
13+
"@angular-devkit/core": "github:angular/angular-devkit-core-builds#f9da2d8eb",
1414
"@babel/core": "7.10.2",
1515
"@babel/generator": "7.10.2",
1616
"@babel/plugin-transform-runtime": "7.10.1",
1717
"@babel/preset-env": "7.10.2",
1818
"@babel/runtime": "7.10.2",
1919
"@babel/template": "7.10.1",
2020
"@jsdevtools/coverage-istanbul-loader": "3.0.3",
21-
"@ngtools/webpack": "github:angular/ngtools-webpack-builds#22b9cc028",
21+
"@ngtools/webpack": "github:angular/ngtools-webpack-builds#f9da2d8eb",
2222
"ajv": "6.12.2",
2323
"autoprefixer": "9.8.0",
2424
"babel-loader": "8.1.0",

src/angular-cli-files/plugins/single-test-transform.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import { logging } from '@angular-devkit/core';
99
import { loader } from 'webpack';
1010
export interface SingleTestTransformLoaderOptions {
11-
files: string[];
12-
logger: logging.Logger;
11+
files?: string[];
12+
logger?: logging.Logger;
1313
}
1414
export declare const SingleTestTransformLoader: string;
1515
/**
Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
33
exports.SingleTestTransformLoader = void 0;
4+
/**
5+
* @license
6+
* Copyright Google Inc. All Rights Reserved.
7+
*
8+
* Use of this source code is governed by an MIT-style license that can be
9+
* found in the LICENSE file at https://angular.io/license
10+
*/
11+
const core_1 = require("@angular-devkit/core");
412
const loader_utils_1 = require("loader-utils");
513
const path_1 = require("path");
614
exports.SingleTestTransformLoader = require.resolve(path_1.join(__dirname, 'single-test-transform'));
@@ -18,24 +26,19 @@ exports.SingleTestTransformLoader = require.resolve(path_1.join(__dirname, 'sing
1826
* array to import them directly, and thus run the tests there.
1927
*/
2028
function loader(source) {
21-
const options = loader_utils_1.getOptions(this);
22-
const lineSeparator = process.platform === 'win32' ? '\r\n' : '\n';
23-
const targettedImports = options.files
24-
.map(path => `require('./${path.replace('.' + path_1.extname(path), '')}');`)
25-
.join(lineSeparator);
26-
// TODO: maybe a documented 'marker/comment' inside test.ts would be nicer?
27-
const regex = /require\.context\(.*/;
28-
// signal the user that expected content is not present
29-
if (!regex.test(source)) {
30-
const message = [
31-
`The 'include' option requires that the 'main' file for tests include the line below:`,
32-
`const context = require.context('./', true, /\.spec\.ts$/);`,
33-
`Arguments passed to require.context are not strict and can be changed`,
34-
];
35-
options.logger.error(message.join(lineSeparator));
29+
const { files = [], logger = console } = loader_utils_1.getOptions(this);
30+
// signal the user that expected content is not present.
31+
if (!source.includes('require.context(')) {
32+
logger.error(core_1.tags.stripIndent `The 'include' option requires that the 'main' file for tests includes the below line:
33+
const context = require.context('./', true, /\.spec\.ts$/);
34+
Arguments passed to require.context are not strict and can be changed.`);
35+
return source;
3636
}
37-
const mockedRequireContext = 'Object.assign(() => { }, { keys: () => [], resolve: () => undefined });' + lineSeparator;
38-
source = source.replace(regex, mockedRequireContext + targettedImports);
37+
const targettedImports = files
38+
.map(path => `require('./${path.replace('.' + path_1.extname(path), '')}');`)
39+
.join('\n');
40+
const mockedRequireContext = 'Object.assign(() => { }, { keys: () => [], resolve: () => undefined });\n';
41+
source = source.replace(/require\.context\(.*/, mockedRequireContext + targettedImports);
3942
return source;
4043
}
4144
exports.default = loader;

uniqueId

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Mon Jun 01 2020 13:56:07 GMT+0000 (Coordinated Universal Time)
1+
Mon Jun 01 2020 19:28:35 GMT+0000 (Coordinated Universal Time)

0 commit comments

Comments
 (0)