summaryrefslogtreecommitdiff
path: root/test/test_flow_command.vader
blob: c673ce0a4ff95cd317f273e7389b25d71ac6c785 (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:
  runtime ale_linters/javascript/flow.vim

  call ale#test#SetDirectory('/testplugin/test')

After:
  unlet! b:ale_javascript_flow_use_respect_pragma

  call ale#test#RestoreDirectory()
  call ale#linter#Reset()
  call ale#semver#ResetVersionCache()

Execute(flow should return a command to run if a .flowconfig file exists):
  call ale#test#SetFilename('flow/a/sub/dummy')

  AssertEqual
  \ ale#Escape('flow')
  \   . ' check-contents --respect-pragma --json --from ale %s',
  \ ale_linters#javascript#flow#GetCommand(bufnr('%'), [])

Execute(flow should not use the respect pragma argument if the option is off):
  call ale#test#SetFilename('flow/a/sub/dummy')

  let b:ale_javascript_flow_use_respect_pragma = 0

  AssertEqual
  \ ale#Escape('flow')
  \   . ' check-contents --json --from ale %s',
  \ ale_linters#javascript#flow#GetCommand(bufnr('%'), [])

Execute(flow should should not use --respect-pragma for old versions):
  call ale#test#SetFilename('flow/a/sub/dummy')

  AssertEqual
  \ ale#Escape('flow')
  \   . ' check-contents --json --from ale %s',
  \ ale_linters#javascript#flow#GetCommand(bufnr('%'), [
  \   'Warning: `flow --version` is deprecated in favor of `flow version`',
  \   'Flow, a static type checker for JavaScript, version 0.27.0',
  \ ])

Execute(flow should not return a command to run if no .flowconfig file exists):
  call ale#test#SetFilename('flow/b/sub/dummy')

  AssertEqual '', ale_linters#javascript#flow#GetCommand(bufnr('%'), [])