File tree Expand file tree Collapse file tree 2 files changed +51
-0
lines changed
packages/angular_devkit/build_angular/src/builders/web-test-runner Expand file tree Collapse file tree 2 files changed +51
-0
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * @license
3+ * Copyright Google LLC All Rights Reserved.
4+ *
5+ * Use of this source code is governed by an MIT-style license that can be
6+ * found in the LICENSE file at https://angular.io/license
7+ */
8+
9+ import { BuilderContext } from '@angular-devkit/architect' ;
10+ import { Schema as WtrBuilderOptions } from './schema' ;
11+
12+ const UNSUPPORTED_OPTIONS : Array < keyof WtrBuilderOptions > = [
13+ 'main' ,
14+ 'assets' ,
15+ 'scripts' ,
16+ 'styles' ,
17+ 'inlineStyleLanguage' ,
18+ 'stylePreprocessorOptions' ,
19+ 'sourceMap' ,
20+ 'progress' ,
21+ 'poll' ,
22+ 'preserveSymlinks' ,
23+ 'browsers' ,
24+ 'codeCoverage' ,
25+ 'codeCoverageExclude' ,
26+ 'fileReplacements' ,
27+ 'webWorkerTsConfig' ,
28+ 'watch' ,
29+ ] ;
30+
31+ /** Logs a warning for any unsupported options specified. */
32+ export function logBuilderStatusWarnings ( options : WtrBuilderOptions , ctx : BuilderContext ) {
33+ // Validate supported options
34+ for ( const unsupportedOption of UNSUPPORTED_OPTIONS ) {
35+ const value = ( options as unknown as WtrBuilderOptions ) [ unsupportedOption ] ;
36+
37+ if ( value === undefined || value === false ) {
38+ continue ;
39+ }
40+ if ( Array . isArray ( value ) && value . length === 0 ) {
41+ continue ;
42+ }
43+ if ( typeof value === 'object' && Object . keys ( value ) . length === 0 ) {
44+ continue ;
45+ }
46+
47+ ctx . logger . warn ( `The '${ unsupportedOption } ' option is not yet supported by this builder.` ) ;
48+ }
49+ }
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import path from 'node:path';
1414import { findTestFiles } from '../../utils/test-files' ;
1515import { buildApplicationInternal } from '../application' ;
1616import { OutputHashing } from '../browser-esbuild/schema' ;
17+ import { logBuilderStatusWarnings } from './builder-status-warnings' ;
1718import { WtrBuilderOptions , normalizeOptions } from './options' ;
1819import { Schema } from './schema' ;
1920
@@ -22,6 +23,7 @@ export default createBuilder(
2223 ctx . logger . warn (
2324 'NOTE: The Web Test Runner builder is currently EXPERIMENTAL and not ready for production use.' ,
2425 ) ;
26+ logBuilderStatusWarnings ( schema , ctx ) ;
2527
2628 // Dynamic import `@web/test-runner` from the user's workspace. As an optional peer dep, it may not be installed
2729 // and may not be resolvable from `@angular-devkit/build-angular`.
You can’t perform that action at this time.
0 commit comments