Skip to content

Commit

Permalink
Go against the grain in the cypress plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Jun 15, 2024
1 parent 6a17ad2 commit ef2464d
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/knip/fixtures/plugins/cypress/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const cypressJsonConfig = {};

export default defineConfig({
e2e: {
...nxE2EPreset(__dirname),
...nxE2EPreset(__dirname, {}),
...cypressJsonConfig,
},
});

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.
Empty file.
7 changes: 6 additions & 1 deletion packages/knip/src/plugins/cypress/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ const SUPPORT_FILE_PATTERNS = [
const entry = [...TEST_FILE_PATTERNS, ...SUPPORT_FILE_PATTERNS];

const resolveEntryPaths: ResolveEntryPaths = async localConfig => {
return [localConfig.e2e?.specPattern ?? [], localConfig.component?.specPattern ?? []].flat().map(toEntryPattern);
const specPatterns = [localConfig.e2e?.specPattern ?? [], localConfig.component?.specPattern ?? []].flat();
const supportFiles = [localConfig.e2e?.supportFile ?? [], localConfig.component?.supportFile ?? []].flat();
return [
...(specPatterns.length > 0 ? specPatterns : TEST_FILE_PATTERNS),
...(supportFiles.length > 0 ? supportFiles : SUPPORT_FILE_PATTERNS),
].map(toEntryPattern);
};

export default {
Expand Down
4 changes: 2 additions & 2 deletions packages/knip/test/plugins/cypress2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test('Find dependencies with the Cypress plugin (2)', async () => {

assert.deepEqual(counters, {
...baseCounters,
processed: 3,
total: 3,
processed: 5,
total: 5,
});
});

0 comments on commit ef2464d

Please sign in to comment.