mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-16 18:43:42 +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",
|
"request": "launch",
|
||||||
"preLaunchTask": "npm: start",
|
"preLaunchTask": "npm: start",
|
||||||
"url": "http://localhost:4200/"
|
"url": "http://localhost:4200/"
|
||||||
},
|
}<% if (!minimal) { %>,
|
||||||
{
|
{
|
||||||
"name": "ng test",
|
"name": "ng test",
|
||||||
"type": "chrome",
|
"type": "chrome",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"preLaunchTask": "npm: test",
|
"preLaunchTask": "npm: test",
|
||||||
"url": "http://localhost:9876/debug.html"
|
"url": "http://localhost:9876/debug.html"
|
||||||
}
|
}<% } %>
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}<% if (!minimal) { %>,
|
||||||
{
|
{
|
||||||
"type": "npm",
|
"type": "npm",
|
||||||
"script": "test",
|
"script": "test",
|
||||||
@ -37,6 +37,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}<% } %>
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,9 @@ describe('Workspace Schematic', () => {
|
|||||||
const files = tree.files;
|
const files = tree.files;
|
||||||
expect(files).toEqual(
|
expect(files).toEqual(
|
||||||
jasmine.arrayContaining([
|
jasmine.arrayContaining([
|
||||||
|
'/.vscode/extensions.json',
|
||||||
|
'/.vscode/launch.json',
|
||||||
|
'/.vscode/tasks.json',
|
||||||
'/.editorconfig',
|
'/.editorconfig',
|
||||||
'/angular.json',
|
'/angular.json',
|
||||||
'/.gitignore',
|
'/.gitignore',
|
||||||
@ -66,6 +69,9 @@ describe('Workspace Schematic', () => {
|
|||||||
const files = tree.files;
|
const files = tree.files;
|
||||||
expect(files).toEqual(
|
expect(files).toEqual(
|
||||||
jasmine.arrayContaining([
|
jasmine.arrayContaining([
|
||||||
|
'/.vscode/extensions.json',
|
||||||
|
'/.vscode/launch.json',
|
||||||
|
'/.vscode/tasks.json',
|
||||||
'/angular.json',
|
'/angular.json',
|
||||||
'/.gitignore',
|
'/.gitignore',
|
||||||
'/package.json',
|
'/package.json',
|
||||||
@ -106,4 +112,24 @@ describe('Workspace Schematic', () => {
|
|||||||
expect(compilerOptions.strict).toBe(true);
|
expect(compilerOptions.strict).toBe(true);
|
||||||
expect(angularCompilerOptions.strictTemplates).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