fix(testing): nullcheck polyfills in ng component testing (#16411)

This commit is contained in:
Caleb Ukle 2023-04-19 11:55:11 -05:00 committed by GitHub
parent c963393e53
commit 1ad7e3de48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -200,10 +200,15 @@ function normalizeBuildTargetOptions(
return polyfill;
};
// paths need to be unix paths for angular devkit
buildOptions.polyfills =
Array.isArray(buildOptions.polyfills) && buildOptions.polyfills.length > 0
? (buildOptions.polyfills as string[]).map((p) => handlePolyfillPath(p))
: handlePolyfillPath(buildOptions.polyfills as string);
if (buildOptions.polyfills) {
buildOptions.polyfills =
Array.isArray(buildOptions.polyfills) &&
buildOptions.polyfills.length > 0
? (buildOptions.polyfills as string[]).map((p) =>
handlePolyfillPath(p)
)
: handlePolyfillPath(buildOptions.polyfills as string);
}
buildOptions.main = joinPathFragments(offset, buildOptions.main);
buildOptions.index =
typeof buildOptions.index === 'string'