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
Parsing in pathWithoutExt(filePath)
does not work for Windows paths
#12507
Comments
This commit aims to fix the issues described in eslint#12507 by removing the assumption that POSIX style filePaths are supplied by messages. The tests for this are also updated to run on both Windows and POSIX based systems. The results can be seen by running ESLint with the JUnit formatter on a Windows system. Full details can be seen in the issue mentioned above.
This commit aims to fix the issues described in eslint#12507 by removing the assumption that POSIX style filePaths are supplied by messages. The tests for this are also updated to run on both Windows and POSIX based systems. The results can be seen by running ESLint with the JUnit formatter on a Windows system. Full details can be seen in the issue mentioned above.
Working on this, created PR to fix this issue |
Unfortunately, it looks like there wasn't enough interest from the team Thanks for contributing to ESLint and we appreciate your understanding. |
@kaicataldo any chance this will be reopened, or should the associated PR be abandoned? |
Thanks for the ping. Let me see if I can get some eyes on this PR! |
Environment is Windows 10 Version 1809
Environment Info:
Node version: v10.15.0
npm version: v6.4.1
Local ESLint version: v6.5.1 (Currently used)
Global ESLint version: Not found
What parser (default, Babel-ESLint, etc.) are you using? default (N/A)
Please show your full configuration: (N/A)
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
We run ESLint in Jenkins CI on a Windows host, and get the following type of output from failures
Currently, this means we do not know the filepath for the files with errors, only for the ones which passed.
This issue arises as a result of PR #11683. See below:
eslint/lib/cli-engine/formatters/junit.js
Lines 28 to 36 in 287ca56
The above code assumes that POSIX filePaths are used, meaning that the function does not work as expected in Windows.
What did you expect to happen?
I expect that in the
classname
tag below I can see the full path to the file, without the file extension for visualization within Jenkins CI on a Windows host. i.e.C:\path\to\file
What actually happened? Please include the actual, raw output from ESLint.
The function above parses
filePath
incorrectly on Windows.path.posix.dirname('C:\\path\\to\\file.js')
resolves to.
on Windows, asposix
forces an assumption of POSIX style paths.This results in the following XML, without the full path to the file in the
classname
attribute:Are you willing to submit a pull request to fix this bug?
Yes.
I would propose a fix where we do not use the
posix
specific implementation of Node'spath
library, and we let Node decide which implementation to use based on the underlying OS.The main question arises in testing. In https://github.com/eslint/eslint/blob/master/tests/lib/cli-engine/formatters/junit.js is it possible to run a test with both POSIX and Windows style paths? My suggestion would be to have the test cases adapt to the current OS, but opinions would be valued here.
The text was updated successfully, but these errors were encountered: