Skip to content

Commit 8a4a584

Browse files
committed
refactor: wip
1 parent 3dea723 commit 8a4a584

File tree

1 file changed

+6
-5
lines changed
  • testing/test-nx-utils/src/lib/utils

1 file changed

+6
-5
lines changed

testing/test-nx-utils/src/lib/utils/nx.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from '@nx/devkit';
1010
import { libraryGenerator } from '@nx/js';
1111
import type { LibraryGeneratorSchema } from '@nx/js/src/generators/library/schema';
12-
import path from 'node:path';
12+
import * as path from 'node:path';
1313
import { createTreeWithEmptyWorkspace } from 'nx/src/generators/testing-utils/create-tree-with-empty-workspace';
1414
import { executeProcess } from '@code-pushup/test-utils';
1515

@@ -98,7 +98,7 @@ export async function nxShowProjectJson<T extends ProjectConfiguration>(
9898
try {
9999
const { stderr, stdout } = await executeProcess({
100100
command: 'npx',
101-
args: ['nx', 'show', 'project', '--json', project],
101+
args: ['nx', 'show', 'project', project, '--json'],
102102
cwd,
103103
});
104104

@@ -109,13 +109,14 @@ export async function nxShowProjectJson<T extends ProjectConfiguration>(
109109
};
110110
} catch (error: unknown) {
111111
const execError = error as {
112-
code?: number;
112+
code?: number | string | null;
113113
stderr?: string;
114114
stdout?: string;
115+
message?: string;
115116
};
116117
return {
117-
code: execError.code ?? 1,
118-
stderr: execError.stderr ?? String((error as Error).message),
118+
code: typeof execError.code === 'number' ? execError.code : 1,
119+
stderr: execError.stderr ?? execError.message ?? String(error),
119120
projectJson: JSON.parse('{}'),
120121
};
121122
}

0 commit comments

Comments
 (0)