/ test / handler / test_stylelint_handler.vader
test_stylelint_handler.vader
 1  After:
 2    unlet! g:error_lines
 3  
 4  Execute (stylelint errors should be handled correctly):
 5    " Stylelint includes trailing spaces for output. This needs to be taken into
 6    " account for parsing errors.
 7    AssertEqual
 8    \ [
 9    \   {
10    \     'lnum': 108,
11    \     'col': 10,
12    \     'type': 'E',
13    \     'text': 'Unexpected leading zero',
14    \     'code': 'number-leading-zero',
15    \   },
16    \   {
17    \     'lnum': 116,
18    \     'col': 20,
19    \     'type': 'E',
20    \     'text': 'Expected a trailing semicolon',
21    \     'code': 'declaration-block-trailing-semicolon',
22    \   },
23    \ ],
24    \ ale#handlers#css#HandleStyleLintFormat(42, [
25    \   'src/main.css',
26    \   ' 108:10  ✖  Unexpected leading zero         number-leading-zero                 ',
27    \   ' 116:20  ✖  Expected a trailing semicolon   declaration-block-trailing-semicolon',
28    \ ])
29  
30  Execute (stylelint should complain when no configuration file is used):
31    let g:error_lines = [
32    \ 'Error: No configuration provided for /home/w0rp/.vim/bundle/ale/test.stylus',
33    \ '    at module.exports (/home/w0rp/.vim/bundle/ale/node_modules/stylelint/lib/utils/configurationError.js:8:27)',
34    \ '    at stylelint._fullExplorer.load.then.then.config (/home/w0rp/.vim/bundle/ale/node_modules/stylelint/lib/getConfigForFile.js:39:13)',
35    \]
36  
37    AssertEqual
38    \ [{
39    \   'lnum': 1,
40    \   'text': 'stylelint exception thrown (type :ALEDetail for more information)',
41    \   'detail': join(g:error_lines, "\n"),
42    \ }],
43    \ ale#handlers#css#HandleStyleLintFormat(347, g:error_lines[:])