mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-16 18:43:42 +08:00
fix(@schematics/angular): added webWorkerTsConfig into test option
This commit is contained in:
parent
9a4b55aa91
commit
052b8fa4db
@ -105,7 +105,6 @@ function addSnippet(options: WebWorkerOptions): Rule {
|
|||||||
export default function (options: WebWorkerOptions): Rule {
|
export default function (options: WebWorkerOptions): Rule {
|
||||||
return async (host: Tree) => {
|
return async (host: Tree) => {
|
||||||
const workspace = await getWorkspace(host);
|
const workspace = await getWorkspace(host);
|
||||||
|
|
||||||
if (!options.project) {
|
if (!options.project) {
|
||||||
throw new SchematicsException('Option "project" is required.');
|
throw new SchematicsException('Option "project" is required.');
|
||||||
}
|
}
|
||||||
@ -142,6 +141,18 @@ export default function (options: WebWorkerOptions): Rule {
|
|||||||
projectTargetOptions.webWorkerTsConfig = workerConfigPath;
|
projectTargetOptions.webWorkerTsConfig = workerConfigPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const projectTestTarget = project.targets.get('test');
|
||||||
|
if (projectTestTarget) {
|
||||||
|
const projectTestTargetOptions = ((projectTestTarget.options ||
|
||||||
|
{}) as unknown) as BrowserBuilderOptions;
|
||||||
|
|
||||||
|
const needWebWorkerConfig = !projectTestTargetOptions.webWorkerTsConfig;
|
||||||
|
if (needWebWorkerConfig) {
|
||||||
|
const workerConfigPath = join(normalize(root), 'tsconfig.worker.json');
|
||||||
|
projectTestTargetOptions.webWorkerTsConfig = workerConfigPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const templateSource = apply(url('./files/worker'), [
|
const templateSource = apply(url('./files/worker'), [
|
||||||
applyTemplates({ ...options, ...strings }),
|
applyTemplates({ ...options, ...strings }),
|
||||||
move(parsedPath.path),
|
move(parsedPath.path),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user