-
Notifications
You must be signed in to change notification settings - Fork 226
Expand file tree
/
Copy pathlinting.js
More file actions
84 lines (73 loc) · 2.15 KB
/
Copy pathlinting.js
File metadata and controls
84 lines (73 loc) · 2.15 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
'use strict';
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
const suitcss = require('../lib');
const util = require('./util');
const expect = chai.expect;
chai.use(chaiAsPromised);
describe('postcss-bem-linter', () => {
it('should pass if component conforms', () => expect(
suitcss('/** @define Foo */\n\n.Foo { color: red; }\n', {
'postcss-reporter': {
throwError: true
}
})
).to.be.fulfilled);
it('should fail if component does not conform', () => expect(
suitcss('/** @define Foo */\n\n.foo { color: red; }\n', {
'postcss-reporter': {
throwError: true
}
})
).to.be.rejectedWith(Error, 'postcss-reporter: warnings or errors were found'));
});
describe('stylelint', () => {
it('should lint the component', () => expect(
suitcss(util.read('fixtures/component'), {
root: 'test/fixtures',
'postcss-reporter': {
throwError: true
}
})
).to.be.fulfilled);
it('should allow the config to be overidden', () => expect(
suitcss('@import "./stylelint.css"\n\n', {
root: 'test/fixtures',
stylelint: {
extends: 'stylelint-config-suitcss',
rules: {
indentation: 4
}
},
'postcss-reporter': {
throwError: true
}
})
).to.be.fulfilled);
it('should throw an error if stylelint fails', () => expect(
suitcss('@import "./stylelint.css"\n\n', {
root: 'test/fixtures',
'postcss-reporter': {
throwError: true
}
})
).to.be.rejectedWith(Error, 'postcss-reporter: warnings or errors were found'));
it('should lint the input file', () => expect(
suitcss('@import "./stylelint.css"\n\n', {
root: 'test/fixtures',
'postcss-reporter': {
throwError: true
}
})
).to.be.rejectedWith(Error, 'postcss-reporter: warnings or errors were found'));
});
describe('disabling linting', () => {
it('should not run stylelint or postcss-bem-linter', () => expect(
suitcss('/** @define Foo */\n\n.foo {color: red;}', {
lint: false,
'postcss-reporter': {
throwError: true
}
})
).to.be.fulfilled);
});