Skip to content

fix(@schematics/angular): remove vscode testing configurations for minimal workspaces #23371

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
merged 1 commit into from
Jun 15, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
"request": "launch",
"preLaunchTask": "npm: start",
"url": "http://localhost:4200/"
},
}<% if (!minimal) { %>,
{
"name": "ng test",
"type": "chrome",
"request": "launch",
"preLaunchTask": "npm: test",
"url": "http://localhost:9876/debug.html"
}
}<% } %>
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
}
}
}
},
}<% if (!minimal) { %>,
{
"type": "npm",
"script": "test",
Expand All @@ -37,6 +37,6 @@
}
}
}
}
}<% } %>
]
}
26 changes: 26 additions & 0 deletions packages/schematics/angular/workspace/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ describe('Workspace Schematic', () => {
const files = tree.files;
expect(files).toEqual(
jasmine.arrayContaining([
'/.vscode/extensions.json',
'/.vscode/launch.json',
'/.vscode/tasks.json',
'/.editorconfig',
'/angular.json',
'/.gitignore',
Expand Down Expand Up @@ -66,6 +69,9 @@ describe('Workspace Schematic', () => {
const files = tree.files;
expect(files).toEqual(
jasmine.arrayContaining([
'/.vscode/extensions.json',
'/.vscode/launch.json',
'/.vscode/tasks.json',
'/angular.json',
'/.gitignore',
'/package.json',
Expand Down Expand Up @@ -106,4 +112,24 @@ describe('Workspace Schematic', () => {
expect(compilerOptions.strict).toBe(true);
expect(angularCompilerOptions.strictTemplates).toBe(true);
});

it('should add vscode testing configuration', async () => {
const tree = await schematicRunner
.runSchematicAsync('workspace', { ...defaultOptions })
.toPromise();
const { configurations } = parseJson(tree.readContent('.vscode/launch.json').toString());
expect(configurations).toContain(jasmine.objectContaining({ name: 'ng test' }));
const { tasks } = parseJson(tree.readContent('.vscode/tasks.json').toString());
expect(tasks).toContain(jasmine.objectContaining({ type: 'npm', script: 'test' }));
});

it('should not add vscode testing configuration when using minimal', async () => {
const tree = await schematicRunner
.runSchematicAsync('workspace', { ...defaultOptions, minimal: true })
.toPromise();
const { configurations } = parseJson(tree.readContent('.vscode/launch.json').toString());
expect(configurations).not.toContain(jasmine.objectContaining({ name: 'ng test' }));
const { tasks } = parseJson(tree.readContent('.vscode/tasks.json').toString());
expect(tasks).not.toContain(jasmine.objectContaining({ type: 'npm', script: 'test' }));
});
});