Skip to content

Commit b867066

Browse files
InSantoshMahtoalan-agius4
authored andcommitted
fix(@schematics/angular): added webWorkerTsConfig into test option
(cherry picked from commit 052b8fa)
1 parent a234c66 commit b867066

File tree

1 file changed

+12
-1
lines changed
  • packages/schematics/angular/web-worker

1 file changed

+12
-1
lines changed

packages/schematics/angular/web-worker/index.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ function addSnippet(options: WebWorkerOptions): Rule {
105105
export default function (options: WebWorkerOptions): Rule {
106106
return async (host: Tree) => {
107107
const workspace = await getWorkspace(host);
108-
109108
if (!options.project) {
110109
throw new SchematicsException('Option "project" is required.');
111110
}
@@ -142,6 +141,18 @@ export default function (options: WebWorkerOptions): Rule {
142141
projectTargetOptions.webWorkerTsConfig = workerConfigPath;
143142
}
144143

144+
const projectTestTarget = project.targets.get('test');
145+
if (projectTestTarget) {
146+
const projectTestTargetOptions = ((projectTestTarget.options ||
147+
{}) as unknown) as BrowserBuilderOptions;
148+
149+
const needWebWorkerConfig = !projectTestTargetOptions.webWorkerTsConfig;
150+
if (needWebWorkerConfig) {
151+
const workerConfigPath = join(normalize(root), 'tsconfig.worker.json');
152+
projectTestTargetOptions.webWorkerTsConfig = workerConfigPath;
153+
}
154+
}
155+
145156
const templateSource = apply(url('./files/worker'), [
146157
applyTemplates({ ...options, ...strings }),
147158
move(parsedPath.path),

0 commit comments

Comments
 (0)