@@ -3,7 +3,7 @@ import * as os from 'node:os'
33import { dirname , isAbsolute , join , resolve } from 'node:path'
44
55import { getLauncherInstance } from './cli.js'
6- import { getTempConfigCreator , isWindows } from './utils.js'
6+ import { getTempConfigCreator , isFixedWdio , isWindows } from './utils.js'
77import type { ResultSet } from '@vscode-wdio/types/reporter'
88import type { RunTestOptions , TestResultData } from '@vscode-wdio/types/server'
99import type { ILogger } from '@vscode-wdio/types/utils'
@@ -15,6 +15,13 @@ const VSCODE_REPORTER_PATH = resolve(__dirname, 'reporter.cjs')
1515export async function runTest ( this : WorkerMetaContext , options : RunTestOptions ) : Promise < TestResultData > {
1616 const outputDir = await getOutputDir . call ( this )
1717 let configFile : string | undefined = undefined
18+
19+ // To avoid this issue, We use temporary configuration files
20+ // only on Windows platforms and for versions of @wdio /utils prior to 9.15.0.
21+ // https://github.com/webdriverio/webdriverio/issues/14532
22+ // This issue was fixed by this PR.
23+ // https://github.com/webdriverio/webdriverio/pull/14565
24+ const useTempConfigFile = isWindows ( ) && ! ( await isFixedWdio . call ( this , options . configPath ) )
1825 try {
1926 // Prepare launcher options
2027 const wdioArgs : RunCommandArguments = {
@@ -42,16 +49,14 @@ export async function runTest(this: WorkerMetaContext, options: RunTestOptions):
4249 await fs . mkdir ( logDir , { recursive : true } )
4350 }
4451
45- if ( isWindows ( ) ) {
52+ if ( useTempConfigFile ) {
4653 const creator = await getTempConfigCreator ( this )
4754 configFile = await creator ( options . configPath , outputDir . json ! )
4855 options . configPath = configFile
4956 wdioArgs . configPath = configFile
50- }
51-
52- // The `stdout` must be true because the name of the logger is
53- // the name of the file and the initialization of Write Stream will fail.
54- if ( ! isWindows ( ) ) {
57+ } else {
58+ // The `stdout` must be true because the name of the logger is
59+ // the name of the file and the initialization of Write Stream will fail.
5560 wdioArgs . reporters = [ [ VSCODE_REPORTER_PATH , { stdout : true , outputDir : outputDir . json } ] ]
5661 }
5762
@@ -122,7 +127,7 @@ export async function runTest(this: WorkerMetaContext, options: RunTestOptions):
122127 if ( outputDir . json ) {
123128 await removeResultDir ( this . log , outputDir . json )
124129 }
125- if ( isWindows ( ) && configFile ) {
130+ if ( useTempConfigFile && configFile ) {
126131 try {
127132 this . log . debug ( `Remove temp config file...: ${ configFile } ` )
128133 await fs . rm ( configFile , { recursive : true , force : true } )
0 commit comments