Skip to content

Commit

Permalink
chore: warn on new tap tests with dangerjs
Browse files Browse the repository at this point in the history
  • Loading branch information
maxjeffos committed Oct 6, 2020
1 parent a2536c4 commit 9113986
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,19 @@ if (danger.github && danger.github.pr) {
);
}

const newTestFiles = danger.git.created_files.filter((f) => {
const inTestFolder = f.startsWith('test/');
const inLegacyAcceptanceTestsFolder = f.includes('test/acceptance/');
const testFilenameLooksLikeJest = f.includes('.spec.ts');
return inTestFolder && !inLegacyAcceptanceTestsFolder && !testFilenameLooksLikeJest;
});

if (newTestFiles) {
const joinedFileList = newTestFiles.map(f => '- `' + f + '`').join("\n");
const msg = `Looks like you added a new Tap test. Consider making it a Jest test instead. See files like \`test/*.spec.ts\` for examples. Files found:\n${joinedFileList}`;
warn(msg);
}

// Smoke test modification check
const modifiedSmokeTest =
danger.git.modified_files.some((f) => f.startsWith('test/smoke/')) ||
Expand Down

0 comments on commit 9113986

Please sign in to comment.