Unit tests fail on Windows because of path separator
See original GitHub issueThis is a Bug Report
Description
When running npm test
on Windows, the unit tests fail like:
+ expected - actual
{
"filename": "last"
"libraryTarget": "commonjs"
- "path": "testpath\\.webpack"
+ "path": "testpath/.webpack"
}
The failures happen in multiple tests, everywhere where paths are checked against their expectations.
Proposed solution
The expectations should be composed by using path.sep
as path separator to keep the tests platform independent.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Test works on local Windows machine but fails on Linux server
separator string is handy to concat into the path string in order to produce an OS independent file path. String inputFile = "."...
Read more >Fix for Unit Test on Windows [#2911377] | Drupal.org
Problem The following Unit Test does not pass in Windows environment due to hardcoded use of directory separator.
Read more >Avoiding Platform Depedent Code
Windows and Unix systems use different conventions for the file separator ("\" in Windows, ... Using System properties String pathSeparator = System.
Read more >Customizing Code Coverage Analysis - Visual Studio (Windows)
By default, code coverage analyzes all solution assemblies that are loaded during unit tests. We recommend that you use this default behavior, ...
Read more >LLVM Testing Infrastructure Guide — LLVM 15.0.0 documentation
The unit and regression tests are in the main “llvm”/ directory under the directories ... Tests containing Windows paths will fail on Linux...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sounds like a good idea. This would complement Travis (where we can run linux and osx tests) perfectly. I will take care of the Travis integration in the next days, and will do some experiments with AppVeyor too.
V3 merged