Skip to content

Commit

Permalink
fix: ensuring prompt works
Browse files Browse the repository at this point in the history
  • Loading branch information
ashley-hunter committed Jan 10, 2025
1 parent 0990820 commit a55c2b4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
23 changes: 10 additions & 13 deletions libs/cli/src/generators/healthcheck/generator.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { readJson, Tree } from '@nx/devkit';
import { readJson, Tree, writeJson } from '@nx/devkit';
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
import { healthcheckGenerator } from './generator';

Expand All @@ -8,18 +8,15 @@ describe('healthcheck generator', () => {
beforeEach(async () => {
tree = createTreeWithEmptyWorkspace();

tree.write(
'package.json',
JSON.stringify({
dependencies: {
'@spartan-ng/brain': '0.0.1-alpha.300',
'@spartan-ng/ui-checkbox-brain': '0.0.1-alpha.300',
},
devDependencies: {
'@spartan-ng/cli': '0.0.1-alpha.300',
},
}),
);
writeJson(tree, 'package.json', {
dependencies: {
'@spartan-ng/brain': '0.0.1-alpha.300',
'@spartan-ng/ui-checkbox-brain': '0.0.1-alpha.300',
},
devDependencies: {
'@spartan-ng/cli': '0.0.1-alpha.300',
},
});

// add a file with legacy imports
tree.write(
Expand Down
2 changes: 1 addition & 1 deletion libs/cli/src/generators/healthcheck/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export async function healthcheckGenerator(tree: Tree, options: HealthcheckGener
// if there are some failed healthchecks that can be fixed, ask the user if they want to fix them
for (const report of failedReports) {
if (report.fixable && isHealthcheckFixable(report.healthcheck)) {
const fix = options.autoFix ?? (await promptUser(report.healthcheck.prompt));
const fix = options.autoFix || (await promptUser(report.healthcheck.prompt));

if (fix) {
await report.healthcheck.fix(tree);
Expand Down

0 comments on commit a55c2b4

Please sign in to comment.