Skip to content

Commit 233cfd7

Browse files
committed
wip 1
1 parent 42f0bd4 commit 233cfd7

File tree

4 files changed

+29
-38
lines changed

4 files changed

+29
-38
lines changed

e2e/nx-plugin-e2e/tests/executor-cli.e2e.test.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,32 @@ describe('executor command', () => {
100100
).rejects.toThrow('');
101101
});
102102

103+
it('should execute print-config executor with api key', async () => {
104+
const cwd = path.join(testFileDir, 'execute-print-config-command');
105+
await addTargetToWorkspace(tree, { cwd, project });
106+
107+
const { stdout, code } = await executeProcess({
108+
command: 'npx',
109+
args: [
110+
'nx',
111+
'run',
112+
`${project}:code-pushup`,
113+
'print-config',
114+
'--upload.apiKey=a123a',
115+
],
116+
cwd,
117+
});
118+
119+
expect(code).toBe(0);
120+
const cleanStdout = removeColorCodes(stdout);
121+
expect(cleanStdout).toContain('nx run my-lib:code-pushup print-config');
122+
expect(cleanStdout).toContain('a123a');
123+
124+
await expect(() =>
125+
readJsonFile(path.join(cwd, '.code-pushup', project, 'report.json')),
126+
).rejects.toThrow('');
127+
});
128+
103129
it('should execute collect executor and merge target and command-line options', async () => {
104130
const cwd = path.join(testFileDir, 'execute-collect-with-merged-options');
105131
await addTargetToWorkspace(

packages/models/code-pushup.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { mergeConfigs } from '@code-pushup/utils';
2-
import { eslintCoreConfigNx } from '../../code-pushup.preset';
1+
import { eslintCoreConfigNx } from '../../code-pushup.preset.js';
2+
import { mergeConfigs } from '../../dist/packages/utils/src/index.js';
33

44
// see: https://github.com/code-pushup/cli/blob/main/packages/models/docs/models-reference.md#coreconfig
55
export default mergeConfigs(

packages/models/tsconfig.test.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"outDir": "../../dist/out-tsc",
55
"types": ["vitest/globals", "vitest/importMeta", "vite/client", "node"]
66
},
7+
"exclude": ["**/code-pushup.config.ts"],
78
"include": [
89
"vite.config.unit.ts",
910
"vite.config.integration.ts",

packages/nx-plugin/src/plugin/plugin.ts

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -42,39 +42,3 @@ export const createNodes: CreateNodes = [
4242
};
4343
},
4444
];
45-
46-
export const createNodesV2: CreateNodesV2<CreateNodesOptions> = [
47-
`**/${CODE_PUSHUP_CONFIG_REGEX}`,
48-
async (configFiles, options, context) => {
49-
return await createNodesFromFiles(
50-
(configFile, options, context) =>
51-
createNodesInternal(configFile, options ?? {}, context),
52-
configFiles,
53-
options,
54-
context,
55-
);
56-
},
57-
];
58-
59-
async function createNodesInternal(
60-
codePushupConfigFilePath: string,
61-
options: CreateNodesOptions,
62-
context: CreateNodesContextV2,
63-
) {
64-
//const projectConfiguration = readJsonFile(configFilePath);
65-
const root = dirname(codePushupConfigFilePath);
66-
const parsedCreateNodesOptions = options;
67-
const normalizedContext = await normalizedCreateNodesV2Context(
68-
context,
69-
codePushupConfigFilePath,
70-
parsedCreateNodesOptions,
71-
);
72-
// Project configuration to be merged into the rest of the Nx configuration
73-
return {
74-
projects: {
75-
[root]: {
76-
targets: await createTargets(normalizedContext),
77-
},
78-
},
79-
};
80-
}

0 commit comments

Comments
 (0)