summaryrefslogtreecommitdiff
path: root/test/fixers/test_xots_fixer_callback.vader
blob: 5c7fa1d12feb2d9ef75e59ed98f4d4948cf5a532 (plain)
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
Before:
  call ale#assert#SetUpFixerTest('typescript', 'xo')
  runtime autoload/ale/handlers/xo.vim
  set filetype=typescript

After:
  call ale#assert#TearDownFixerTest()

Execute(The xo callback should return the correct default values):
  call ale#test#SetFilename('../xo-test-files/monorepo/packages/a/index.ts')

  AssertFixer
  \ {
  \   'read_temporary_file': 1,
  \   'command': (has('win32') ? 'node.exe ' : '')
  \     . ale#Escape(ale#path#Simplify(g:dir . '/../xo-test-files/monorepo/node_modules/xo/cli.js'))
  \     . ' --fix %t',
  \ }

Execute(The xo callback should include custom xo options):
  let g:ale_typescript_xo_options = '--space'
  call ale#test#SetFilename('../xo-test-files/monorepo/packages/a/index.ts')

  AssertFixer
  \ {
  \   'read_temporary_file': 1,
  \   'command': (has('win32') ? 'node.exe ' : '')
  \     . ale#Escape(ale#path#Simplify(g:dir . '/../xo-test-files/monorepo/node_modules/xo/cli.js'))
  \     . ' --fix %t'
  \     . ' --space',
  \ }

Execute(--stdin should be used when xo is new enough):
  let g:ale_typescript_xo_options = '--space'
  call ale#test#SetFilename('../xo-test-files/monorepo/packages/a/index.ts')

  GivenCommandOutput ['0.30.0']
  AssertFixer
  \ {
  \   'command': (has('win32') ? 'node.exe ' : '')
  \     . ale#Escape(ale#path#Simplify(g:dir . '/../xo-test-files/monorepo/node_modules/xo/cli.js'))
  \     . ' --stdin --stdin-filename %s'
  \     . ' --fix'
  \     . ' --space',
  \ }