Reputation: 28968
Not sure if this is an eslint, yarn or glob question, but I think it is about glob patterns.
In package.json I have two "scripts" entries, one to run eslint --fix
, the other to run mocha
tests.
"scripts": {
"test": "yarn run lintfixjs && mocha --recursive",
"lintfixjs": "eslint --fix *.js tools/*.js other_tools/*.js lib/*.js"
}
It has been working fine for years, on developer machines. The problem comes when I went to run yarn test
on a cut-down server install, which didn't have the "tools/" and "other_tools/" directories. I get:
Oops! Something went wrong! :(
No files matching the pattern "tools/*.js" were found.
My Question: Is there a way to say "tools/*.js if tools exists otherwise []" when giving commandline arguments?
I don't want to change "tools/*.js" to "tools/" (though that also doesn't work) and I don't want to change what yarn test
and yarn lintfixjs
does for developers.
My best idea is to make a new scripts entry:
"test_cutdown":"eslint --fix *.js lib/*.js && mocha --recursive",
That is workable, I just wondered if there was another way.
Upvotes: 0
Views: 21