Skip to content

Commit 1f41384

Browse files
author
John Doe
committed
refactor: fix empty options
1 parent e72b2f3 commit 1f41384

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@ export function createExecutorTarget(options?: {
88
}): TargetConfiguration<ProjectPrefixOptions> {
99
const { bin, projectPrefix } = options ?? {};
1010

11-
return {
11+
const targetConfig: TargetConfiguration<ProjectPrefixOptions> = {
1212
executor: `${PACKAGE_NAME}:cli`,
13-
options: {
13+
};
14+
15+
if (bin || projectPrefix) {
16+
targetConfig.options = {
1417
...(bin ? { bin } : {}),
1518
...(projectPrefix ? { projectPrefix } : {}),
16-
},
17-
};
19+
};
20+
}
21+
22+
return targetConfig;
1823
}

packages/nx-plugin/src/plugin/target/executor.target.unit.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ describe('createExecutorTarget', () => {
55
it('should return executor target without project name', () => {
66
expect(createExecutorTarget()).toStrictEqual({
77
executor: '@code-pushup/nx-plugin:cli',
8-
options: {},
98
});
109
});
1110

packages/nx-plugin/src/plugin/target/targets.unit.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ describe('createTargets', () => {
109109
expect.objectContaining({
110110
[targetName]: {
111111
executor: `${PACKAGE_NAME}:cli`,
112-
options: {},
113112
},
114113
}),
115114
);
@@ -134,7 +133,6 @@ describe('createTargets', () => {
134133
).resolves.toStrictEqual({
135134
[DEFAULT_TARGET_NAME]: {
136135
executor: '@code-pushup/nx-plugin:cli',
137-
options: {},
138136
},
139137
});
140138
});
@@ -160,7 +158,6 @@ describe('createTargets', () => {
160158
).resolves.toStrictEqual({
161159
cp: {
162160
executor: '@code-pushup/nx-plugin:cli',
163-
options: {},
164161
},
165162
});
166163
});

0 commit comments

Comments
 (0)