summaryrefslogtreecommitdiff
path: root/test/fixers
diff options
context:
space:
mode:
Diffstat (limited to 'test/fixers')
-rw-r--r--test/fixers/test_eslint_fixer_callback.vader98
-rw-r--r--test/fixers/test_prettier_eslint_fixer.callback.vader83
-rw-r--r--test/fixers/test_prettier_fixer_callback.vader146
3 files changed, 141 insertions, 186 deletions
diff --git a/test/fixers/test_eslint_fixer_callback.vader b/test/fixers/test_eslint_fixer_callback.vader
index 774595e3..7ea9c2cf 100644
--- a/test/fixers/test_eslint_fixer_callback.vader
+++ b/test/fixers/test_eslint_fixer_callback.vader
@@ -1,143 +1,129 @@
Before:
- call ale#test#SetDirectory('/testplugin/test/fixers')
+ call ale#assert#SetUpFixerTest('javascript', 'eslint')
+ runtime autoload/ale/handlers/eslint.vim
After:
- call ale#test#RestoreDirectory()
- call ale#semver#ResetVersionCache()
+ call ale#assert#TearDownFixerTest()
Execute(The executable path should be correct):
call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.js')
" eslint_d output with an older eslint version is used here.
- AssertEqual
+ GivenCommandOutput ['v4.4.1 (eslint_d v5.1.0)']
+ AssertFixer
\ {
\ 'read_temporary_file': 1,
\ 'command': (has('win32') ? 'node.exe ' : '')
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
\ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/.eslintrc.js'))
\ . ' --fix %t',
- \ },
- \ ale#fixers#eslint#ApplyFixForVersion(bufnr(''), ['v4.4.1 (eslint_d v5.1.0)'])
+ \ }
Execute(The lower priority configuration file in a nested directory should be preferred):
call ale#test#SetFilename('../eslint-test-files/react-app/subdir-with-config/testfile.js')
- AssertEqual
+ AssertFixer
\ {
\ 'read_temporary_file': 1,
\ 'command': (has('win32') ? 'node.exe ' : '')
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
\ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/subdir-with-config/.eslintrc'))
\ . ' --fix %t',
- \ },
- \ ale#fixers#eslint#ApplyFixForVersion(bufnr(''), [])
+ \ }
Execute(package.json should be used as a last resort):
call ale#test#SetFilename('../eslint-test-files/react-app/subdir-with-package-json/testfile.js')
- AssertEqual
+ AssertFixer
\ {
\ 'read_temporary_file': 1,
\ 'command': (has('win32') ? 'node.exe ' : '')
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
\ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/.eslintrc.js'))
\ . ' --fix %t',
- \ },
- \ ale#fixers#eslint#ApplyFixForVersion(bufnr(''), [])
+ \ }
call ale#test#SetFilename('../eslint-test-files/package.json')
- AssertEqual
+ AssertFixer
\ {
\ 'read_temporary_file': 1,
\ 'command':
\ ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/node_modules/.bin/eslint'))
\ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/package.json'))
\ . ' --fix %t',
- \ },
- \ ale#fixers#eslint#ApplyFixForVersion(bufnr(''), [])
+ \ }
Execute(The version check should be correct):
- call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.js')
+ call ale#test#SetFilename('../eslint-test-files/react-app/subdir-with-config/testfile.js')
- AssertEqual
+ " We should run the command to get the version the first time.
+ GivenCommandOutput ['4.9.0']
+ AssertFixer [
+ \ (has('win32') ? 'node.exe ' : '')
+ \ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
+ \ . ' --version',
\ {
- \ 'chain_with': 'ale#fixers#eslint#ApplyFixForVersion',
\ 'command': (has('win32') ? 'node.exe ' : '')
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
- \ . ' --version'
+ \ . ' --stdin-filename %s --stdin --fix-dry-run --format=json',
+ \ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput',
\ },
- \ ale#fixers#eslint#Fix(bufnr(''))
+ \]
+
+ AssertFixer [
+ \ {
+ \ 'command': (has('win32') ? 'node.exe ' : '')
+ \ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
+ \ . ' --stdin-filename %s --stdin --fix-dry-run --format=json',
+ \ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput',
+ \ },
+ \]
Execute(--fix-dry-run should be used for 4.9.0 and up):
call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.js')
- AssertEqual
+ GivenCommandOutput ['4.9.0']
+ AssertFixer
\ {
\ 'command': (has('win32') ? 'node.exe ' : '')
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
\ . ' --stdin-filename %s --stdin --fix-dry-run --format=json',
\ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput',
- \ },
- \ ale#fixers#eslint#ApplyFixForVersion(bufnr(''), ['4.9.0'])
+ \ }
Execute(--fix-to-stdout should be used for eslint_d):
call ale#test#SetFilename('../eslint-test-files/app-with-eslint-d/testfile.js')
- AssertEqual
+ AssertFixer
\ {
\ 'read_temporary_file': 1,
\ 'command':
\ ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/app-with-eslint-d/node_modules/.bin/eslint_d'))
\ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/package.json'))
\ . ' --fix %t',
- \ },
- \ ale#fixers#eslint#ApplyFixForVersion(bufnr(''), [''])
+ \ }
" The option should be used when eslint_d is new enough.
" We look at the ESLint version instead of the eslint_d version.
- AssertEqual
+ GivenCommandOutput ['v3.19.0 (eslint_d v4.2.0)']
+ AssertFixer
\ {
\ 'command':
\ ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/app-with-eslint-d/node_modules/.bin/eslint_d'))
\ . ' --stdin-filename %s --stdin --fix-to-stdout',
\ 'process_with': 'ale#fixers#eslint#ProcessEslintDOutput',
- \ },
- \ ale#fixers#eslint#ApplyFixForVersion(bufnr(''), ['v3.19.0 (eslint_d v4.2.0)'])
+ \ }
" The option should be used for new versions too.
- AssertEqual
+ GivenCommandOutput ['4.9.0']
+ AssertFixer
\ {
\ 'command':
\ ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/app-with-eslint-d/node_modules/.bin/eslint_d'))
\ . ' --stdin-filename %s --stdin --fix-to-stdout',
\ 'process_with': 'ale#fixers#eslint#ProcessEslintDOutput',
- \ },
- \ ale#fixers#eslint#ApplyFixForVersion(bufnr(''), ['4.9.0'])
-
-Execute(The version number should be cached):
- call ale#test#SetFilename('../eslint-test-files/react-app/subdir-with-config/testfile.js')
-
- " Call the second callback with the version output.
- call ale#fixers#eslint#ApplyFixForVersion(bufnr(''), ['4.9.0'])
-
- " The version command should be skipped.
- AssertEqual
- \ {
- \ 'chain_with': 'ale#fixers#eslint#ApplyFixForVersion',
- \ 'command': '',
- \ },
- \ ale#fixers#eslint#Fix(bufnr(''))
-
- " Call it again without the version output. We should use the newer command.
- AssertEqual
- \ {
- \ 'command': (has('win32') ? 'node.exe ' : '')
- \ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
- \ . ' --stdin-filename %s --stdin --fix-dry-run --format=json',
- \ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput',
- \ },
- \ ale#fixers#eslint#ApplyFixForVersion(bufnr(''), [])
+ \ }
Execute(The --fix-dry-run post-processor should handle JSON output correctly):
AssertEqual
diff --git a/test/fixers/test_prettier_eslint_fixer.callback.vader b/test/fixers/test_prettier_eslint_fixer.callback.vader
index 5c899d86..90e11672 100644
--- a/test/fixers/test_prettier_eslint_fixer.callback.vader
+++ b/test/fixers/test_prettier_eslint_fixer.callback.vader
@@ -1,54 +1,36 @@
Before:
- call ale#test#SetDirectory('/testplugin/test/fixers')
-
- Save g:ale_javascript_prettier_eslint_executable
- Save g:ale_javascript_prettier_eslint_use_global
- Save g:ale_javascript_prettier_eslint_options
-
- unlet! g:ale_javascript_prettier_eslint_executable
- unlet! g:ale_javascript_prettier_eslint_use_global
- unlet! g:ale_javascript_prettier_eslint_options
-
- call ale#fixers#prettier_eslint#SetOptionDefaults()
+ call ale#assert#SetUpFixerTest('javascript', 'prettier_eslint')
After:
- Restore
-
- unlet! b:ale_javascript_prettier_eslint_executable
- unlet! b:ale_javascript_prettier_eslint_use_global
- unlet! b:ale_javascript_prettier_eslint_options
-
- call ale#test#RestoreDirectory()
- call ale#semver#ResetVersionCache()
+ call ale#assert#TearDownFixerTest()
Execute(The default command should be correct):
- AssertEqual
+ AssertFixer
\ {
\ 'read_temporary_file': 1,
\ 'command':
\ ale#Escape('prettier-eslint')
\ . ' %t'
\ . ' --write'
- \ },
- \ ale#fixers#prettier_eslint#ApplyFixForVersion(bufnr(''), [])
+ \ }
Execute(Additional options should be used when set):
let b:ale_javascript_prettier_eslint_options = '--foobar'
- AssertEqual
+ AssertFixer
\ {
\ 'read_temporary_file': 1,
\ 'command':
\ ale#Escape('prettier-eslint')
\ . ' %t'
\ . ' --foobar --write'
- \ },
- \ ale#fixers#prettier_eslint#ApplyFixForVersion(bufnr(''), [])
+ \ }
Execute(--eslint-config-path should be set for 4.2.0 and up):
call ale#test#SetFilename('eslint-test-files/react-app/foo/bar.js')
- AssertEqual
+ GivenCommandOutput ['4.2.0']
+ AssertFixer
\ {
\ 'read_temporary_file': 1,
\ 'command':
@@ -56,58 +38,57 @@ Execute(--eslint-config-path should be set for 4.2.0 and up):
\ . ' %t'
\ . ' --eslint-config-path ' . ale#Escape(ale#path#Simplify(g:dir . '/eslint-test-files/react-app/.eslintrc.js'))
\ . ' --write'
- \ },
- \ ale#fixers#prettier_eslint#ApplyFixForVersion(bufnr(''), ['4.2.0'])
+ \ }
Execute(--eslint-config-path shouldn't be used for older versions):
call ale#test#SetFilename('eslint-test-files/react-app/foo/bar.js')
- AssertEqual
+ AssertFixer
\ {
\ 'read_temporary_file': 1,
\ 'command':
\ ale#Escape('prettier-eslint')
\ . ' %t'
\ . ' --write'
- \ },
- \ ale#fixers#prettier_eslint#ApplyFixForVersion(bufnr(''), [])
+ \ }
Execute(The version check should be correct):
- AssertEqual
+ AssertFixer [
+ \ ale#Escape('prettier-eslint') . ' --version',
\ {
- \ 'chain_with': 'ale#fixers#prettier_eslint#ApplyFixForVersion',
- \ 'command': ale#Escape('prettier-eslint') . ' --version',
- \ },
- \ ale#fixers#prettier_eslint#Fix(bufnr(''))
+ \ 'read_temporary_file': 1,
+ \ 'command':
+ \ ale#Escape('prettier-eslint')
+ \ . ' %t'
+ \ . ' --write'
+ \ }
+ \]
Execute(The new --stdin-filepath option should be used when the version is new enough):
call ale#test#SetFilename('eslint-test-files/react-app/foo/bar.js')
- AssertEqual
+ GivenCommandOutput ['4.4.0']
+ AssertFixer
\ {
\ 'command': ale#path#CdString(expand('%:p:h'))
\ . ale#Escape('prettier-eslint')
\ . ' --eslint-config-path ' . ale#Escape(ale#path#Simplify(g:dir . '/eslint-test-files/react-app/.eslintrc.js'))
\ . ' --stdin-filepath %s --stdin',
- \ },
- \ ale#fixers#prettier_eslint#ApplyFixForVersion(bufnr(''), ['4.4.0'])
+ \ }
Execute(The version number should be cached):
- call ale#fixers#prettier_eslint#ApplyFixForVersion(bufnr(''), ['4.4.0'])
-
- " The version command should be skipped.
- AssertEqual
+ GivenCommandOutput ['4.4.0']
+ AssertFixer
\ {
- \ 'chain_with': 'ale#fixers#prettier_eslint#ApplyFixForVersion',
- \ 'command': '',
- \ },
- \ ale#fixers#prettier_eslint#Fix(bufnr(''))
+ \ 'command': ale#path#CdString(expand('%:p:h'))
+ \ . ale#Escape('prettier-eslint')
+ \ . ' --stdin-filepath %s --stdin',
+ \ }
- " The newer command should be used.
- AssertEqual
+ GivenCommandOutput []
+ AssertFixer
\ {
\ 'command': ale#path#CdString(expand('%:p:h'))
\ . ale#Escape('prettier-eslint')
\ . ' --stdin-filepath %s --stdin',
- \ },
- \ ale#fixers#prettier_eslint#ApplyFixForVersion(bufnr(''), [])
+ \ }
diff --git a/test/fixers/test_prettier_fixer_callback.vader b/test/fixers/test_prettier_fixer_callback.vader
index 05ed421e..9be161ac 100644
--- a/test/fixers/test_prettier_fixer_callback.vader
+++ b/test/fixers/test_prettier_fixer_callback.vader
@@ -1,296 +1,284 @@
Before:
- call ale#test#SetDirectory('/testplugin/test/fixers')
- Save g:ale_javascript_prettier_executable
- Save g:ale_javascript_prettier_options
+ call ale#assert#SetUpFixerTest('javascript', 'prettier')
- " Use an invalid global executable, so we don't match it.
- let g:ale_javascript_prettier_executable = 'xxxinvalid'
- let g:ale_javascript_prettier_options = ''
-
- call ale#test#SetDirectory('/testplugin/test/fixers')
silent cd ..
silent cd command_callback
let g:dir = getcwd()
After:
- let g:ale_has_override = {}
-
- call ale#test#RestoreDirectory()
- call ale#semver#ResetVersionCache()
+ call ale#assert#TearDownFixerTest()
Execute(The prettier callback should return the correct default values):
call ale#test#SetFilename('../prettier-test-files/testfile.js')
- AssertEqual
+ AssertFixer
\ {
\ 'read_temporary_file': 1,
\ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' %t'
\ . ' --write',
- \ },
- \ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), [])
+ \ }
Execute(The --config option should not be set automatically):
let g:ale_javascript_prettier_use_local_config = 1
call ale#test#SetFilename('../prettier-test-files/with_config/testfile.js')
- AssertEqual
+ AssertFixer
\ {
\ 'read_temporary_file': 1,
\ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' %t'
\ . ' --write',
- \ },
- \ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), [])
+ \ }
Execute(The prettier callback should include custom prettier options):
let g:ale_javascript_prettier_options = '--no-semi'
call ale#test#SetFilename('../prettier-test-files/with_config/testfile.js')
- AssertEqual
+ AssertFixer
\ {
\ 'read_temporary_file': 1,
\ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' %t'
\ . ' --no-semi'
\ . ' --write',
- \ },
- \ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), [])
+ \ }
Execute(The version check should be correct):
call ale#test#SetFilename('../prettier-test-files/testfile.js')
- AssertEqual
- \ {
- \ 'chain_with': 'ale#fixers#prettier#ApplyFixForVersion',
- \ 'command': ale#Escape(g:ale_javascript_prettier_executable)
- \ . ' --version',
- \ },
- \ ale#fixers#prettier#Fix(bufnr(''))
+ AssertFixer [
+ \ ale#Escape('prettier') . ' --version',
+ \ {'read_temporary_file': 1, 'command': ale#Escape('prettier') . ' %t --write'}
+ \]
Execute(--stdin-filepath should be used when prettier is new enough):
let g:ale_javascript_prettier_options = '--no-semi'
call ale#test#SetFilename('../prettier-test-files/with_config/testfile.js')
- AssertEqual
+ GivenCommandOutput ['1.6.0']
+ AssertFixer
\ {
\ 'command': ale#path#CdString(expand('%:p:h'))
\ . ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --no-semi'
\ . ' --stdin-filepath %s --stdin',
- \ },
- \ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
+ \ }
Execute(The version number should be cached):
call ale#test#SetFilename('../prettier-test-files/with_config/testfile.js')
- " Call the second callback with the version output.
- call ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
+ GivenCommandOutput ['1.6.0']
+ AssertFixer
+ \ {
+ \ 'command': ale#path#CdString(expand('%:p:h'))
+ \ . ale#Escape(g:ale_javascript_prettier_executable)
+ \ . ' --stdin-filepath %s --stdin',
+ \ }
- " Call it again without the version output. We should use the newer command.
- AssertEqual
+ GivenCommandOutput []
+ AssertFixer
\ {
\ 'command': ale#path#CdString(expand('%:p:h'))
\ . ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --stdin-filepath %s --stdin',
- \ },
- \ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), [])
+ \ }
Execute(Should set --parser to `babylon` by default, < 1.16.0):
call ale#test#SetFilename('../prettier-test-files/testfile')
set filetype=javascript
- AssertEqual
+ GivenCommandOutput ['1.6.0']
+ AssertFixer
\ {
\ 'command': ale#path#CdString(expand('%:p:h'))
\ . ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser babylon'
\ . ' --stdin-filepath %s --stdin',
- \ },
- \ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
+ \ }
Execute(Should set --parser to `babel` by default, >= 1.16.0):
call ale#test#SetFilename('../prettier-test-files/testfile')
set filetype=javascript
- AssertEqual
+ GivenCommandOutput ['1.16.0']
+ AssertFixer
\ {
\ 'command': ale#path#CdString(expand('%:p:h'))
\ . ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser babel'
\ . ' --stdin-filepath %s --stdin',
- \ },
- \ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.16.0'])
+ \ }
Execute(Should set --parser based on filetype, TypeScript):
call ale#test#SetFilename('../prettier-test-files/testfile')
set filetype=typescript
- AssertEqual
+ GivenCommandOutput ['1.6.0']
+ AssertFixer
\ {
\ 'command': ale#path#CdString(expand('%:p:h'))
\ . ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser typescript'
\ . ' --stdin-filepath %s --stdin',
- \ },
- \ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
+ \ }
Execute(Should set --parser based on filetype, CSS):
call ale#test#SetFilename('../prettier-test-files/testfile')
set filetype=css
- AssertEqual
+ GivenCommandOutput ['1.6.0']
+ AssertFixer
\ {
\ 'command': ale#path#CdString(expand('%:p:h'))
\ . ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser css'
\ . ' --stdin-filepath %s --stdin',
- \ },
- \ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
+ \ }
Execute(Should set --parser based on filetype, LESS):
call ale#test#SetFilename('../prettier-test-files/testfile')
set filetype=less
- AssertEqual
+ GivenCommandOutput ['1.6.0']
+ AssertFixer
\ {
\ 'command': ale#path#CdString(expand('%:p:h'))
\ . ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser less'
\ . ' --stdin-filepath %s --stdin',
- \ },
- \ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
+ \ }
Execute(Should set --parser based on filetype, SCSS):
call ale#test#SetFilename('../prettier-test-files/testfile')
set filetype=scss
- AssertEqual
+ GivenCommandOutput ['1.6.0']
+ AssertFixer
\ {
\ 'command': ale#path#CdString(expand('%:p:h'))
\ . ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser scss'
\ . ' --stdin-filepath %s --stdin',
- \ },
- \ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
+ \ }
Execute(Should set --parser based on filetype, JSON):
call ale#test#SetFilename('../prettier-test-files/testfile')
set filetype=json
- AssertEqual
+ GivenCommandOutput ['1.6.0']
+ AssertFixer
\ {
\ 'command': ale#path#CdString(expand('%:p:h'))
\ . ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser json'
\ . ' --stdin-filepath %s --stdin',
- \ },
- \ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
+ \ }
Execute(Should set --parser based on filetype, JSON5):
call ale#test#SetFilename('../prettier-test-files/testfile')
set filetype=json5
- AssertEqual
+ GivenCommandOutput ['1.6.0']
+ AssertFixer
\ {
\ 'command': ale#path#CdString(expand('%:p:h'))
\ . ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser json5'
\ . ' --stdin-filepath %s --stdin',
- \ },
- \ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
+ \ }
Execute(Should set --parser based on filetype, GraphQL):
call ale#test#SetFilename('../prettier-test-files/testfile')
set filetype=graphql
- AssertEqual
+ GivenCommandOutput ['1.6.0']
+ AssertFixer
\ {
\ 'command': ale#path#CdString(expand('%:p:h'))
\ . ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser graphql'
\ . ' --stdin-filepath %s --stdin',
- \ },
- \ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
+ \ }
Execute(Should set --parser based on filetype, Markdown):
call ale#test#SetFilename('../prettier-test-files/testfile')
set filetype=markdown
- AssertEqual
+ GivenCommandOutput ['1.6.0']
+ AssertFixer
\ {
\ 'command': ale#path#CdString(expand('%:p:h'))
\ . ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser markdown'
\ . ' --stdin-filepath %s --stdin',
- \ },
- \ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
+ \ }
Execute(Should set --parser based on filetype, Vue):
call ale#test#SetFilename('../prettier-test-files/testfile')
set filetype=vue
- AssertEqual
+ GivenCommandOutput ['1.6.0']
+ AssertFixer
\ {
\ 'command': ale#path#CdString(expand('%:p:h'))
\ . ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser vue'
\ . ' --stdin-filepath %s --stdin',
- \ },
- \ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
+ \ }
Execute(Should set --parser based on filetype, YAML):
call ale#test#SetFilename('../prettier-test-files/testfile')
set filetype=yaml
- AssertEqual
+ GivenCommandOutput ['1.6.0']
+ AssertFixer
\ {
\ 'command': ale#path#CdString(expand('%:p:h'))
\ . ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser yaml'
\ . ' --stdin-filepath %s --stdin',
- \ },
- \ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
+ \ }
Execute(Should set --parser based on filetype, HTML):
call ale#test#SetFilename('../prettier-test-files/testfile')
set filetype=html
- AssertEqual
+ GivenCommandOutput ['1.6.0']
+ AssertFixer
\ {
\ 'command': ale#path#CdString(expand('%:p:h'))
\ . ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser html'
\ . ' --stdin-filepath %s --stdin',
- \ },
- \ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
+ \ }
Execute(Should set --parser based on first filetype of multiple filetypes):
call ale#test#SetFilename('../prettier-test-files/testfile')
set filetype=css.scss
- AssertEqual
+ GivenCommandOutput ['1.6.0']
+ AssertFixer
\ {
\ 'command': ale#path#CdString(expand('%:p:h'))
\ . ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser css'
\ . ' --stdin-filepath %s --stdin',
- \ },
- \ ale#fixers#prettier#ApplyFixForVersion(bufnr(''), ['1.6.0'])
+ \ }
Execute(The prettier_d post-processor should permit regular JavaScript content):
AssertEqual