Skip to content

Commit

Permalink
chore(core): use optional chaining (#9445)
Browse files Browse the repository at this point in the history
* chore(core): use optional chaining

* chore(core): chore(core): chore(core): use optional chaining

* chore(core): use optional chaining

* feat(core): chore(core): chore(core): use optional chaining

* chore(core): chore(core): use optional chaining

* chore(core): chore(core): chore(core): use optional chaining

* chore(core): chore(core): use optional chaining

* chore(core): chore(core): use optional chaining
  • Loading branch information
Wscats committed Apr 1, 2022
1 parent 5ddd895 commit 10ae4c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
6 changes: 3 additions & 3 deletions packages/jest/src/executors/jest/summary.ts
Expand Up @@ -85,15 +85,15 @@ export const getSummary = (
}
): string => {
let runTime = (Date.now() - aggregatedResults.startTime) / 1000;
if (options && options.roundTime) {
if (options?.roundTime) {
runTime = Math.floor(runTime);
}

const valuesForCurrentTestCases = getValuesCurrentTestCases(
options?.currentTestCases
);

const estimatedTime = (options && options.estimatedTime) || 0;
const estimatedTime = options?.estimatedTime || 0;
const snapshotResults = aggregatedResults.snapshot;
const snapshotsAdded = snapshotResults.added;
const snapshotsFailed = snapshotResults.unmatched;
Expand All @@ -113,7 +113,7 @@ export const getSummary = (
const testsPending = aggregatedResults.numPendingTests;
const testsTodo = aggregatedResults.numTodoTests;
const testsTotal = aggregatedResults.numTotalTests;
const width = (options && options.width) || 0;
const width = options?.width || 0;

const suites =
chalk.bold('Test Suites: ') +
Expand Down
12 changes: 2 additions & 10 deletions packages/nx/src/utils/params.ts
Expand Up @@ -645,10 +645,7 @@ function getGeneratorDefaults(
) {
let defaults = {};
if (wc?.generators) {
if (
wc.generators[collectionName] &&
wc.generators[collectionName][generatorName]
) {
if (wc.generators[collectionName]?.[generatorName]) {
defaults = {
...defaults,
...wc.generators[collectionName][generatorName],
Expand All @@ -661,12 +658,7 @@ function getGeneratorDefaults(
};
}
}
if (
projectName &&
wc &&
wc.projects[projectName] &&
wc.projects[projectName].generators
) {
if (projectName && wc?.projects[projectName]?.generators) {
const g = wc.projects[projectName].generators;
if (g[collectionName] && g[collectionName][generatorName]) {
defaults = { ...defaults, ...g[collectionName][generatorName] };
Expand Down

0 comments on commit 10ae4c1

Please sign in to comment.