8000 Fix unit tests on Windows · telerik/mobile-cli-lib@80fe24c · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Commit 80fe24c

Browse files
Fix unit tests on Windows
Currently unit tests fail on Windows as the `type` command used in the tests is not a real executable - it is integrated in the `cmd`. So spawning `type` fails and the tests fail as well. In order to fix this, pass `shell` option to child process, so the child process will spawn CMD and after that type command will succeed.
1 parent d20d42d commit 80fe24c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

test/unit-tests/mobile/android/logcat-helper.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,17 @@ class ChildProcessStub {
1111
public spawn(command: string, args?: string[], options?: any): childProcess.ChildProcess {
1212
ChildProcessStub.methodCallCount++;
1313
let pathToExecutable = "";
14+
let shell = "";
1415
if (this.isWin) {
1516
pathToExecutable = "type";
17+
shell = "cmd";
1618
} else {
1719
pathToExecutable = "cat";
1820
}
1921
pathToExecutable = path.join(pathToExecutable);
2022
const pathToSample = path.join(__dirname, "valid-sample.txt");
21-
return childProcess.spawn(pathToExecutable, [pathToSample]);
23+
24+
return childProcess.spawn(pathToExecutable, [pathToSample], { shell });
2225
}
2326
}
2427

0 commit comments

Comments
 (0)
0