Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Tests runner: fix "paths to tests" detection
Browse files Browse the repository at this point in the history
Previous solution (Jest respectively) executed GraphQL and GraphQL Skymocks tests even though only GraphQL changed. It's because GraphQL path matched both workspaces in Jest. This is not the case anymore since emitted paths are now ending with trailing slash so Jest understands it correctly.

kiwicom-source-id: 229d67070487174b4fcb1484f961dc6943436b09
  • Loading branch information
Martin Zlámal committed Apr 1, 2019
1 parent 9c7c74f commit df8fd70
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/__tests__/findPathsToTest.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ it('finds dirty paths to test based on the changed files', () => {
// Relevant workspace here are @kiwicom/graphql and @kiwicom/signed-source.
// However signed-source is a dependency of @kiwicom/graphql-bc-checker and
// therefore it's relevant as well (see workspace dependencies).
//
// Trailing slashes are important to distinguish similar paths, for example:
// "src/apps/graphql" shouldn't match "src/apps/graphql-skymock"
).toMatchInlineSnapshot(`
Set {
"src/apps",
"src/packages/signed-source",
"src/packages/bc-checker",
"src/apps/",
"src/packages/signed-source/",
"src/packages/bc-checker/",
}
`);

Expand Down
2 changes: 1 addition & 1 deletion src/findPathsToTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function findPathsToTest(

const pathsToTest = new Set<string>();
relatedWorkspaces.forEach(relatedWorkspace => {
pathsToTest.add(workspaceDependencies[relatedWorkspace].location);
pathsToTest.add(workspaceDependencies[relatedWorkspace].location + '/');
});

console.warn('DIRTY WORKSPACES:', dirtyWorkspaces); // eslint-disable-line no-console
Expand Down

0 comments on commit df8fd70

Please sign in to comment.