Closed Liarus closed 10 months ago
I was about to write an issue for the exact same bug.
The issue might be here:
or here:
Windows apparently doesn't like when you have D:\
in the middle of the path. There's probably a best practices way of solving this.
Obviously the real question is my there are absolute paths in the twice in the same path. But since this only happens in GitHub CI and not my local Windows machine it's hard to investigate.
Edit: Maybe jumped the gun here. Is the output path from karma-webpack exported so other packages can access it?
Edit # 2: The issue doesn't seems to be in this repo. I've added log statement in both places above and the error is thrown before they are reached. The issue is probably in Karma or another plugin.
The issue is that Webpack is just joining to paths without checking if it's valid: https://github.com/webpack/webpack/blob/972b7f9bd1c608a0ce8794b4bed236cfffe72b2e/lib/Compiler.js#L796
This is not the fault of karma-webpack
.
Opened a new issue for Webpack: https://github.com/webpack/webpack/issues/12759
Something to think about though:
If source files are located on the 'D:\' drive, maybe the temp folder should be too. Because fixing the path issue in Webpack is only one part of the problem.
The second one is that the code in the output path C:\Users\VSSADM~1\AppData\Local\Temp\_karma_webpack_494403\
will never be able to reference the files in C:\Users\VSSADM~1\AppData\Local\Temp_karma_webpack_494403\D:\a\1\s\TestApp\dist\src
since that path will no longer have D:
only D
.
I'll leave this open until sokra responds over here => https://github.com/webpack/webpack/issues/12759
For anyone also running into this issue, a workaround is to set the Temp drive to D:\Temp
. For example, as a first step on GitHub actions:
steps:
# https://github.com/ryanclark/karma-webpack/issues/494
- name: Windows temp dir fix
run: |
echo TEMP="D:\Temp" >> $env:GITHUB_ENV
echo TMP="D:\Temp" >> $env:GITHUB_ENV
This has apparently been fixed in the latest version of webpack 5
Expected Behavior
Karma runs correctly with typescript emitting declaration files on Azure Devops pipeline.
Actual Behavior
Karma webpack tries to create a folder with drive letter: mkdir 'C:\Users\VSSADM~1\AppData\Local\Temp_karma_webpack_494403\D:\a\1\s\TestApp\dist\src'. Does it have something with common with different drive for temp and actual source?
On local environment (with only c: drive) it runs perfectly. I can omit this with not emitting declaration files (separate tsconfig for karma), but I want to have ts project references and during test for sure declarations and transpilation of referenced projects will occur regardless of settings and this will be a blocker for me
Code
How Do We Reproduce?
describe('Test', () => { describe('create', () => { it('should should create', () => { const actual = new Test()
})
task: Npm@1 displayName: 'Test - install npm packages' inputs: command: 'install' workingDir: '$(build.sourcesDirectory)\TestApp'
script: | npx karma start karma.conf.js workingDirectory: '$(build.sourcesDirectory)\TestApp' displayName: 'TestApp - unit tests'
task: Npm@1 displayName: 'TestApp - build' inputs: command: 'custom' workingDir: '$(build.sourcesDirectory)\TestApp' customCommand: 'run-script build-dev'