为什么 TestCafe 在使用简单命令行启动测试 Electron 应用程序时崩溃?

Why is TestCafe crashing on launch testing Electron app with simple command-line?

我正在尝试 运行 使用 TestCafe 在我们的 Electron 应用程序上进行测试。我收到一条提到“-m”命令的错误,但是我的脚本或命令行中没有使用它。

我已按照此处所述设置了所有内容: https://github.com/DevExpress/testcafe-browser-provider-electron#testing-an-executable-electron-application

C:\packages>testcafe -d "electron:C:\Program Files\OurApp\" "C:\Temp\test.js" -hostname localhost

Using locally installed version of TestCafe. ERROR Tested app failed with an error:

Error: Command failed: -m '-m' is not recognized as an internal or external command, operable program or batch file.

at ChildProcess.exithandler (child_process.js:275:12)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Socket.stream.socket.on (internal/child_process.js:346:11)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at Pipe._handle.close [as _onclose] (net.js:557:12)

Type "testcafe -h" for help.

test.js 的脚本如下:

import { Selector } from 'testcafe';

fixture `Electron test`
.page('./index.html');

test('smoke 1', async t => {
await t
.debug() 
.click(Selector().withText('Create a new configuration'));
});

可能是什么原因?

原因是 -hostname 参数不正确。应该是--hostname。我不确定为什么会出现一些 -m 错误,但在我修复了不正确的参数语法后测试仍然有效。