mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-15 10:11:50 +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 {
|
||||
return async (host: Tree) => {
|
||||
const workspace = await getWorkspace(host);
|
||||
|
||||
if (!options.project) {
|
||||
throw new SchematicsException('Option "project" is required.');
|
||||
}
|
||||
@ -142,6 +141,18 @@ export default function (options: WebWorkerOptions): Rule {
|
||||
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'), [
|
||||
applyTemplates({ ...options, ...strings }),
|
||||
move(parsedPath.path),
|
||||
|
Loading…
x
Reference in New Issue
Block a user