Skip to content

Commit 32c3ef4

Browse files
devversionkara
authored andcommitted
build: faster building of tests (#4509)
1 parent 3953d6e commit 32c3ef4

File tree

6 files changed

+15
-11
lines changed

6 files changed

+15
-11
lines changed

src/cdk/tsconfig-tests.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@
1111
},
1212
"include": [
1313
"**/*.spec.ts"
14-
],
15-
"files": null
14+
]
1615
}

src/lib/tsconfig-tests.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@
1111
},
1212
"include": [
1313
"**/*.spec.ts"
14-
],
15-
"files": null
14+
]
1615
}

test/karma-test-shim.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ System.config({
4242
'node:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic-testing.umd.js',
4343

4444
// Path mappings for local packages that can be imported inside of tests.
45-
'@angular/material': 'dist/bundles/material.umd.js',
46-
'@angular/cdk': 'dist/bundles/cdk.umd.js',
45+
'@angular/material': 'dist/packages/material/index.js',
46+
'@angular/cdk': 'dist/packages/cdk/index.js',
4747
},
4848
packages: {
4949
// Thirdparty barrels.

test/karma.conf.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ module.exports = (config) => {
3838
// Includes all package tests and source files into karma. Those files will be watched.
3939
// This pattern also matches all all sourcemap files and TypeScript files for debugging.
4040
{pattern: 'dist/packages/**/*', included: false, watched: true},
41-
{pattern: 'dist/bundles/*.umd.js', included: false, watched: true},
4241
],
4342

4443
customLaunchers: customLaunchers,

tools/gulp/tasks/unit-test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ const runSequence = require('run-sequence');
99
/** Builds everything that is necessary for karma. */
1010
task(':test:build', sequenceTask(
1111
'clean',
12-
// Build the material bundles without any test files. (CDK will be also built)
13-
'material:build',
14-
// Additionally build the test files for material and the CDK.
15-
['material:build:esm:tests', 'cdk:build:esm:tests']
12+
// Build ESM output of Material that also includes all test files.
13+
'material:build-tests',
1614
));
1715

1816
/**

tools/gulp/util/package-tasks.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ export function createPackageBuildTasks(packageName: string, requiredPackages: s
4444
`${packageName}:build:bundles`,
4545
));
4646

47+
task(`${packageName}:build-tests`, sequenceTask(
48+
// Build all required tests before building.
49+
...requiredPackages.map(pkgName => `${pkgName}:build-tests`),
50+
// Build the ESM output that includes all test files. Also build assets for the package.
51+
[`${packageName}:build:esm:tests`, `${packageName}:assets`],
52+
// Inline assets into ESM output.
53+
`${packageName}:assets:inline`
54+
));
55+
4756
/**
4857
* Release tasks for the package. Tasks compose the release output for the package.
4958
*/

0 commit comments

Comments
 (0)