/
standalone-maxWarnings.test.js
49 lines (41 loc) · 1.17 KB
/
standalone-maxWarnings.test.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
'use strict';
const path = require('path');
const replaceBackslashes = require('./replaceBackslashes');
const standalone = require('../standalone');
const fixturesPath = replaceBackslashes(path.join(__dirname, 'fixtures'));
it('standalone with input css and `maxWarnings`', () => {
const config = {
quiet: true,
rules: {
'block-no-empty': true,
},
};
return standalone({
code: 'a {}',
config,
maxWarnings: 0,
}).then((linted) => {
const maxWarningsExceeded = linted.maxWarningsExceeded;
expect(typeof maxWarningsExceeded).toBe('object');
expect(maxWarningsExceeded.maxWarnings).toBe(0);
expect(maxWarningsExceeded.foundWarnings).toBe(1);
});
});
it('standalone with input file(s) and `maxWarnings`', () => {
const config = {
quiet: true,
rules: {
'block-no-empty': true,
},
};
return standalone({
files: replaceBackslashes(path.join(fixturesPath, 'empty-block.css')),
config,
maxWarnings: 0,
}).then((linted) => {
const maxWarningsExceeded = linted.maxWarningsExceeded;
expect(typeof maxWarningsExceeded).toBe('object');
expect(maxWarningsExceeded.maxWarnings).toBe(0);
expect(maxWarningsExceeded.foundWarnings).toBe(1);
});
});