summaryrefslogtreecommitdiff
path: root/test/fixers
diff options
context:
space:
mode:
authorAlvin Chan <chaucerbao@users.noreply.github.com>2019-01-22 02:24:15 -0800
committerw0rp <w0rp@users.noreply.github.com>2019-01-22 10:24:15 +0000
commitf12d312aa4aa49c4698056933030cd5adb60b489 (patch)
tree3e65607877adf96c5734c873b3c8125b9a04bced /test/fixers
parentd0284f22ea45a5e7796da2224373c22232af1777 (diff)
downloadale-f12d312aa4aa49c4698056933030cd5adb60b489.zip
Add `babylon` as default Prettier parser (#2220)
* Mimic Prettier's default parser by setting it to `babylon` * Add tests to check default Prettier `parser` * Set Prettier default parser based on version * Update the comment to explain the reason for an explicit default
Diffstat (limited to 'test/fixers')
-rw-r--r--test/fixers/test_prettier_fixer_callback.vader28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/fixers/test_prettier_fixer_callback.vader b/test/fixers/test_prettier_fixer_callback.vader
index 7f25471b..05ed421e 100644
--- a/test/fixers/test_prettier_fixer_callback.vader
+++ b/test/fixers/test_prettier_fixer_callback.vader
@@ -96,6 +96,34 @@ Execute(The version number should be cached):
\ },
\ 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
+ \ {
+ \ '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
+ \ {
+ \ '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')