-
Notifications
You must be signed in to change notification settings - Fork 14
/
Herebyfile.mjs
68 lines (59 loc) · 1.45 KB
/
Herebyfile.mjs
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
58
59
60
61
62
63
64
65
66
67
68
import { execa } from 'execa';
import { task } from 'hereby';
import Jasmine from 'jasmine';
import ConsoleReporter from 'jasmine-console-reporter';
import path from 'path';
const BIN_DIR = 'node_modules/.bin';
const EXECA_OUT = {
stdout: 'inherit',
stderr: 'inherit',
};
const sourceGlob = {
lint: ['*.js', 'lib/**/*.js', 'test/**/*.js'],
tests: ['test/helpers/add-matchers.js', 'test/*.js'],
};
function bin(name) {
return path.join(BIN_DIR, name);
}
export const format = task({
name: 'format',
run: async () => {
await execa(bin('prettier'), ['--write', './']);
},
});
export const lint = task({
name: 'lint',
run: async () => {
await execa(bin('eslint'), [...sourceGlob.lint], EXECA_OUT);
},
});
export const test = task({
name: 'test',
run: async () => {
const jasmine = new Jasmine();
const reporter = new ConsoleReporter({
beep: false,
verbosity: {
disabled: false,
pending: false,
specs: false,
summary: true,
},
});
jasmine.clearReporters();
jasmine.addReporter(reporter);
jasmine.exitOnCompletion = false;
jasmine.loadConfig({
forbidDuplicateNames: true,
random: true,
spec_files: sourceGlob.tests, // eslint-disable-line camelcase
stopSpecOnExpectationFailure: false,
});
await jasmine.execute();
},
});
const lintAndTest = task({
name: 'lint-and-test',
dependencies: [lint, test],
});
export default lintAndTest;