forked from withspectrum/spectrum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dangerfile.js
57 lines (50 loc) · 1.39 KB
/
dangerfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// @flow
import path from 'path';
import { warn, fail, message, markdown, schedule, danger } from 'danger';
import yarn from 'danger-plugin-yarn';
import jest from 'danger-plugin-jest';
import flow from 'danger-plugin-flow';
import noTestShortcuts from 'danger-plugin-no-test-shortcuts';
import noConsole from 'danger-plugin-no-console';
const APP_FOLDERS = [
'admin',
'athena',
'chronos',
'hermes',
'hyperion',
'api',
'mercury',
'shared',
'src',
'vulcan',
];
// Make sure people describe what their PR is about
if (danger.github.pr.body.length < 10) {
fail('Please add a description to your PR.');
}
// Make sure the yarn.lock file is updated when dependencies get added and log any added dependencies
APP_FOLDERS.forEach(folder => {
schedule(yarn(path.join(__dirname, folder, 'package.json')));
});
// Log test failures if there are any
jest();
// Make sure nobody does a it.only and blocks our entire test-suite from running
noTestShortcuts({
testFilePredicate: filePath =>
filePath.endsWith('.test.js') || filePath.endsWith('_spec.js'),
});
schedule(noConsole({ whitelist: ['error', 'warn'] }));
schedule(
flow({
// Fail on newly created untyped files
created: 'fail',
// Warn on modified untyped files
modified: 'warn',
blacklist: [
'flow-typed/**/*.js',
'public/**/*.js',
'api/migrations/**/*.js',
'cypress/**/*.js',
],
})
);