Skip to content

fix(schematics): properly detect tsconfig files #12434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions src/lib/schematics/update/update.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,12 @@ describe('material-nav-schematic', () => {
runner = new SchematicTestRunner('schematics', migrationCollection);
});

describe('migration v5 to v6', () => {

it('should remove the temp directory', () => {
const tree = runner.runSchematic('migration-01', {}, createTestApp());
const files = tree.files;

expect(files.find(file => file.includes('angular_material_temp_schematics')))
.toBeFalsy('Expected the temporary directory for the schematics to be deleted');
});
it('should remove the temp directory', () => {
const tree = runner.runSchematic('migration-01', {}, createTestApp());
const files = tree.files;

expect(files.find(file => file.includes('angular_material_temp_schematics')))
.toBeFalsy('Expected the temporary directory for the schematics to be deleted');
});

});
4 changes: 3 additions & 1 deletion src/lib/schematics/update/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export default function(): Rule {

const allTsConfigPaths = getTsConfigPaths(tree);
const allUpdateTasks = [];

for (const tsconfig of allTsConfigPaths) {
// Run the update tslint rules.
allUpdateTasks.push(context.addTask(new TslintFixTask({
Expand Down Expand Up @@ -119,12 +120,13 @@ function getTsConfigPaths(tree: Tree): string[] {

// Add any tsconfig directly referenced in a build or test task of the angular.json workspace.
const workspace = getWorkspace(tree);

for (const project of Object.values(workspace.projects)) {
if (project && project.architect) {
for (const taskName of ['build', 'test']) {
const task = project.architect[taskName];
if (task && task.options && task.options.tsConfig) {
const tsConfigOption = project.architect.tsConfig;
const tsConfigOption = task.options.tsConfig;
if (typeof tsConfigOption === 'string') {
tsconfigPaths.push(tsConfigOption);
} else if (Array.isArray(tsConfigOption)) {
Expand Down
8 changes: 6 additions & 2 deletions tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@
},
"linterOptions": {
// Exclude schematic template files that can't be linted.
// TODO(paul) re-renable specs once the devkit schematics properly work with Bazel.
"exclude": ["src/lib/schematics/**/files/**/*", "src/lib/schematics/**/*.spec.ts"]
"exclude": [
"src/lib/schematics/**/files/**/*",
// TODO(paul) re-renable specs once the devkit schematics properly work with Bazel and we
// can remove the `xit` calls.
"src/lib/schematics/**/*.spec.ts"
]
}
}