-
Notifications
You must be signed in to change notification settings - Fork 10
/
inspect.spec.js
36 lines (32 loc) · 1.06 KB
/
inspect.spec.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
import {_} from '@report-toolkit/common';
import {tmpdir} from 'os';
import {run, runWithOptions} from './cli-helper.js';
const REPORT_002_FILEPATH = require.resolve(
'@report-toolkit/common/test/fixture/reports/report-002-library-mismatch.json'
);
describe('@report-toolkit/cli:command:inspect', function() {
describe('when run without parameters', function() {
it('should exit with code 1', function() {
return expect(run('inspect'), 'to be rejected with error satisfying', {
exitCode: 1
});
});
});
describe('when it cannot find a config file', function() {
it('should enable all rules', function() {
return expect(
runWithOptions(['inspect', REPORT_002_FILEPATH, '-t', 'json'], {
cwd: tmpdir()
}).catch(_.pipe(_.get('stdout'), JSON.parse)),
'when fulfilled',
'to have items satisfying',
{
message: expect.it('to be a', 'string'),
severity: 'error',
id: 'library-mismatch',
filepath: REPORT_002_FILEPATH
}
);
});
});
});