ale/test/command_callback/test_scss_sasslint_command_callback.vader
Oskar Grunning 2760cf7018 refactor sasslint linter (#2077)
Previous implementation required one to have sass-lint globally. This
allows you to have it locally, override the executable and add options.
2018-12-06 11:23:31 -07:00

44 lines
1.3 KiB
Plaintext

Before:
call ale#assert#SetUpLinterTest('scss', 'sasslint')
call ale#test#SetFilename('test.scss')
unlet! b:executable
After:
call ale#assert#TearDownLinterTest()
Execute(should default to source, bin/sass-lint.js):
call ale#test#SetFilename('sasslint-test-files/with-source/test.scss')
let b:executable = ale#path#Simplify(
\ g:dir
\ . '/sasslint-test-files/with-source/node_modules/sass-lint/bin/sass-lint.js'
\)
AssertLinter b:executable,
\ (has('win32') ? 'node.exe ' : '')
\ . ale#Escape(b:executable)
\ . ' -v -q -f compact %t'
Execute(should fallback to bin, .bin/sass-lint):
call ale#test#SetFilename('sasslint-test-files/with-bin/test.scss')
let b:executable = ale#path#Simplify(
\ g:dir
\ . '/sasslint-test-files/with-bin/node_modules/.bin/sass-lint'
\)
AssertLinter b:executable, ale#Escape(b:executable) . ' -v -q -f compact %t'
Execute(should fallback to global bin):
AssertLinter 'sass-lint', ale#Escape('sass-lint') . ' -v -q -f compact %t'
Execute(The global executable should be configurable):
let b:ale_scss_sasslint_executable = 'foo'
AssertLinter 'foo', ale#Escape('foo') . ' -v -q -f compact %t'
Execute(The options should be configurable):
let b:ale_scss_sasslint_options = '--bar'
AssertLinter 'sass-lint', ale#Escape('sass-lint') . ' --bar -v -q -f compact %t'