mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-16 10:33:43 +08:00
fix(@schematics/angular): remove vscode testing configurations for minimal
workspaces
Remove the `ng test` VS Code task and `npm test` VS Code launch configuration from the workspace when building minimal workspaces. Fixes #23360
This commit is contained in:
parent
b06ae55140
commit
7cbbf2f2ba
@ -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"
|
||||
}
|
||||
}<% } %>
|
||||
]
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}<% if (!minimal) { %>,
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "test",
|
||||
@ -37,6 +37,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}<% } %>
|
||||
]
|
||||
}
|
||||
|
@ -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',
|
||||
@ -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',
|
||||
@ -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' }));
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user