Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot be run with other test files #57

Open
BebeSparkelSparkel opened this issue Dec 3, 2017 · 2 comments
Open

Cannot be run with other test files #57

BebeSparkelSparkel opened this issue Dec 3, 2017 · 2 comments

Comments

@BebeSparkelSparkel
Copy link

I cannot have my mocha eslint test pass if mocha runs multiple test files.

eslint Fails With Other Test

When mocha runs the eslint test and another test eslint always fails.
I also noticed that eslint tries to run the file undefined (see eslint error # 6).

$ npx mocha

  Test how the validation methods are applied.
    ✓ apply_validation should not add an error before input event.
    ✓ No input error
    ✓ Error for both inputs.
    ✓ No error when schema does not provide validation for one input

  eslint
    1) should have no errors in ./apply_validation.js
    2) should have no errors in ./create_form_routes.js
    3) should have no errors in ./form_builder.js
    4) should have no errors in ./test/test_apply_validation.js
    5) should have no errors in ./test/test_eslint_with_mocha.js
    6) should have no errors in undefined

  4 passing (464ms)
  6 failing

  1) eslint
       should have no errors in ./apply_validation.js:
     Error: /Users/williamrusnack/Documents/form_database/.eslintrc.js:
	Configuration for rule "indent" is invalid:
	Value {"var":2,"let":2,"const":3} should be integer.
	Value {"var":2,"let":2,"const":3} should NOT have additional properties.
	Value {"var":2,"let":2,"const":3} should match exactly one schema in oneOf.

      at validateRuleOptions (node_modules/eslint/lib/config/config-validator.js:115:15)
      at Object.keys.forEach.id (node_modules/eslint/lib/config/config-validator.js:155:9)
      at Array.forEach (<anonymous>)
      at validateRules (node_modules/eslint/lib/config/config-validator.js:154:30)
      at Object.validate (node_modules/eslint/lib/config/config-validator.js:232:5)
      at loadFromDisk (node_modules/eslint/lib/config/config-file.js:507:19)
      at Object.load (node_modules/eslint/lib/config/config-file.js:550:20)
      at Config.getLocalConfigHierarchy (node_modules/eslint/lib/config.js:228:44)
      at Config.getConfigHierarchy (node_modules/eslint/lib/config.js:180:43)
      at Config.getConfigVector (node_modules/eslint/lib/config.js:287:21)
      at Config.getConfig (node_modules/eslint/lib/config.js:330:29)
      at processText (node_modules/eslint/lib/cli-engine.js:162:33)
      at processFile (node_modules/eslint/lib/cli-engine.js:223:18)
      at fileList.map.fileInfo (node_modules/eslint/lib/cli-engine.js:545:20)
      at Array.map (<anonymous>)
      at CLIEngine.executeOnFiles (node_modules/eslint/lib/cli-engine.js:514:34)
      at Context.<anonymous> (node_modules/mocha-eslint/index.js:31:22)

Tests Pass Individually

eslint test passes by itself

Notice there are more files selected and no undefined file.

$ npx mocha test/test_eslint_with_mocha.js 

  eslint
    ✓ should have no errors in ./apply_validation.js (554ms)
    ✓ should have no errors in ./create_form_routes.js
    ✓ should have no errors in ./form_builder.js
    ✓ should have no errors in ./test/test_apply_validation.js
    ✓ should have no errors in ./test/test_create_form_routes.js
    ✓ should have no errors in ./test/test_eslint_with_mocha.js
    ✓ should have no errors in ./test/test_form_builder.js

  7 passing (919ms)

other test passes by itself

$ npx mocha test/test_apply_validation.js 

  Test how the validation methods are applied.
    ✓ apply_validation should not add an error before input event.
    ✓ No input error
    ✓ Error for both inputs.
    ✓ No error when schema does not provide validation for one input

  4 passing (61ms)
@IanVS
Copy link
Contributor

IanVS commented Dec 4, 2017

Hmmm, strange. Can you say what version of ESLint you are using, and what your config file looks like? The error Configuration for rule "indent" is invalid seems to be a clue. If you're able to share a repo that reproduces the problem, I'll be happy to try digging in and figuring out what's going on. Otherwise, my only guess is that maybe a different version of ESLint is being used depending on how you're running the tests.

@BebeSparkelSparkel
Copy link
Author

Sure the repo is https://github.com/BebeSparkelSparkel/form_database
This should have everything you asked for

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants