bug caused by shelljs modifying the String.prototype
See original GitHub issue- ESLint Version: 3.6.1
- Node Version: 6.7
- npm Version:: 2.15.8
tldr: I’ve confirmed that this bug is fixed by updating to the latest version of shelljs.
What parser (default, Babel-ESLint, etc.) are you using?
I’m using gulp-eslint, but the bug is caused by shelljs 0.6.0, a dependency of eslint.
What’s happening
I don’t know why this is happening, but I can explain what is happening and what is causing it.
When I run gulp mocha
, even though gulp eslint
is never called, since shelljs v6.0.0 modifies the String.prototype
AND it’s exported at the top level (e.g. regardless of whether or not shelljs is used, the String.prototype
is modified), something is happening that is causing test results to be mutated.
As you can see in the attached gist, only tests with a ..
in the expected result are being modified. It appears that ..
is being replaced with function from shelljs, so .toString()
is probably being called somewhere.
I don’t know where the replacement is happening specifically, but I tracked the root cause to this code in shelljs.
Also, for completeness, the mocha
task in gulpfile.js
consists of this code:
gulp.task('test', function() {
return gulp.src('test/*.js')
.pipe(mocha({reporter: 'spec'}))
});
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (6 by maintainers)
I am working on this. There was an accidental breaking change introduced in shellljs. Which I have fixed now. Will open a PR once shelljs makes a new release. Ref: https://github.com/shelljs/shelljs/pull/530
thanks!