mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-24 18:49:27 +08:00
#3633 - Put all dummy test files in test/test-files
This commit is contained in:
@@ -10,17 +10,17 @@ After:
|
||||
call ale#assert#TearDownFixerTest()
|
||||
|
||||
Execute(The executable path should be correct):
|
||||
call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.js')
|
||||
call ale#test#SetFilename('../test-files/eslint/react-app/subdir/testfile.js')
|
||||
|
||||
" eslint_d output with an older eslint version is used here.
|
||||
GivenCommandOutput ['v4.4.1 (eslint_d v5.1.0)']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../eslint-test-files/react-app'),
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../test-files/eslint/react-app'),
|
||||
\ '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'))
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js'))
|
||||
\ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/.eslintrc.js'))
|
||||
\ . ' --fix %t',
|
||||
\ }
|
||||
|
||||
@@ -162,29 +162,29 @@ Execute(The ESLint fixer should use a config file option if set for new versions
|
||||
\ }
|
||||
|
||||
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')
|
||||
call ale#test#SetFilename('../test-files/eslint/react-app/subdir-with-config/testfile.js')
|
||||
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../eslint-test-files/react-app'),
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../test-files/eslint/react-app'),
|
||||
\ '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'))
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js'))
|
||||
\ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/subdir-with-config/.eslintrc'))
|
||||
\ . ' --fix %t',
|
||||
\ }
|
||||
|
||||
Execute(--config in options should override configuration file detection for old versions):
|
||||
call ale#test#SetFilename('../eslint-test-files/react-app/subdir-with-config/testfile.js')
|
||||
call ale#test#SetFilename('../test-files/eslint/react-app/subdir-with-config/testfile.js')
|
||||
|
||||
let b:ale_javascript_eslint_options = '--config /foo.cfg'
|
||||
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../eslint-test-files/react-app'),
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../test-files/eslint/react-app'),
|
||||
\ 'command': (has('win32') ? 'node.exe ' : '')
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js'))
|
||||
\ . ' --config /foo.cfg'
|
||||
\ . ' --fix %t',
|
||||
\ }
|
||||
@@ -194,50 +194,50 @@ Execute(--config in options should override configuration file detection for old
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../eslint-test-files/react-app'),
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../test-files/eslint/react-app'),
|
||||
\ 'command': (has('win32') ? 'node.exe ' : '')
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js'))
|
||||
\ . ' -c /foo.cfg'
|
||||
\ . ' --fix %t',
|
||||
\ }
|
||||
|
||||
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')
|
||||
call ale#test#SetFilename('../test-files/eslint/react-app/subdir-with-package-json/testfile.js')
|
||||
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../eslint-test-files/react-app'),
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../test-files/eslint/react-app'),
|
||||
\ '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'))
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js'))
|
||||
\ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/.eslintrc.js'))
|
||||
\ . ' --fix %t',
|
||||
\ }
|
||||
|
||||
call ale#test#SetFilename('../eslint-test-files/package.json')
|
||||
call ale#test#SetFilename('../test-files/eslint/package.json')
|
||||
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../eslint-test-files'),
|
||||
\ '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'))
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../test-files/eslint'),
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/node_modules/.bin/eslint'))
|
||||
\ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/package.json'))
|
||||
\ . ' --fix %t',
|
||||
\ }
|
||||
|
||||
Execute(The version check should be correct):
|
||||
call ale#test#SetFilename('../eslint-test-files/react-app/subdir-with-config/testfile.js')
|
||||
call ale#test#SetFilename('../test-files/eslint/react-app/subdir-with-config/testfile.js')
|
||||
|
||||
" 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'))
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js'))
|
||||
\ . ' --version',
|
||||
\ {
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../eslint-test-files/react-app'),
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../test-files/eslint/react-app'),
|
||||
\ 'command': (has('win32') ? 'node.exe ' : '')
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js'))
|
||||
\ . ' --stdin-filename %s --stdin --fix-dry-run --format=json',
|
||||
\ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput',
|
||||
\ },
|
||||
@@ -245,36 +245,36 @@ Execute(The version check should be correct):
|
||||
|
||||
AssertFixer [
|
||||
\ {
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../eslint-test-files/react-app'),
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../test-files/eslint/react-app'),
|
||||
\ 'command': (has('win32') ? 'node.exe ' : '')
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/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')
|
||||
call ale#test#SetFilename('../test-files/eslint/react-app/subdir/testfile.js')
|
||||
|
||||
GivenCommandOutput ['4.9.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../eslint-test-files/react-app'),
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../test-files/eslint/react-app'),
|
||||
\ 'command': (has('win32') ? 'node.exe ' : '')
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/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-to-stdout should be used for eslint_d):
|
||||
call ale#test#SetFilename('../eslint-test-files/app-with-eslint-d/testfile.js')
|
||||
call ale#test#SetFilename('../test-files/eslint/app-with-eslint-d/testfile.js')
|
||||
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../eslint-test-files/app-with-eslint-d'),
|
||||
\ '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'))
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../test-files/eslint/app-with-eslint-d'),
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/app-with-eslint-d/node_modules/.bin/eslint_d'))
|
||||
\ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/package.json'))
|
||||
\ . ' --fix %t',
|
||||
\ }
|
||||
|
||||
@@ -283,8 +283,8 @@ Execute(--fix-to-stdout should be used for eslint_d):
|
||||
GivenCommandOutput ['v3.19.0 (eslint_d v4.2.0)']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../eslint-test-files/app-with-eslint-d'),
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/app-with-eslint-d/node_modules/.bin/eslint_d'))
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../test-files/eslint/app-with-eslint-d'),
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/app-with-eslint-d/node_modules/.bin/eslint_d'))
|
||||
\ . ' --stdin-filename %s --stdin --fix-to-stdout',
|
||||
\ 'process_with': 'ale#fixers#eslint#ProcessEslintDOutput',
|
||||
\ }
|
||||
@@ -293,8 +293,8 @@ Execute(--fix-to-stdout should be used for eslint_d):
|
||||
GivenCommandOutput ['4.9.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../eslint-test-files/app-with-eslint-d'),
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/app-with-eslint-d/node_modules/.bin/eslint_d'))
|
||||
\ 'cwd': ale#path#Simplify(g:dir . '/../test-files/eslint/app-with-eslint-d'),
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/app-with-eslint-d/node_modules/.bin/eslint_d'))
|
||||
\ . ' --stdin-filename %s --stdin --fix-to-stdout',
|
||||
\ 'process_with': 'ale#fixers#eslint#ProcessEslintDOutput',
|
||||
\ }
|
||||
|
||||
Reference in New Issue
Block a user