Adonis integration with husky and lint-staged

Hello. I’m trying integrate Adonis testing with husky amd lint-staged. Everything works fine, except when I try to run the tests before commiting code.

My configuration at package.json is :

"husky": {
    "hooks": {
      "pre-commit": "lint-staged"
  "lint-staged": {
    "*.js": [
      "eslint --fix",
      "adonis test",
      "git add"

If I run the command adonis test I get the failing test :
But If I run through lint-staged I get nothing :


Any clues ?


Ok, I found myself how to manage this.

I removed the code from package.json and created a file named lint-staged.config.js with the following code :

module.exports = {
‘*.js’: () => [‘eslint --fix’, ‘adonis test --bail’]

And everything worked fine.

I hope this tip be helpful to someone.



Did not work for me.

husky > pre-commit (node v10.16.3)
Could not parse lint-staged config.

        Error: ● Validation Error:

Invalid value for 'linters[*.js]'.

Should be a string or an array of strings.

Configured value is: '*.js'

Please refer to for more information...

Please make sure you have created it correctly.
husky > pre-commit hook failed (add --no-verify to bypass)

Turns out I only need to update my lint-staged version.

More info here: