Testcafe with Jenkins on Mac: node_modules/.bin/testcafe: 没有



我正在尝试通过Mac上的Jenkins运行testcafe脚本。 我按照 https://devexpress.github.io/testcafe/documentation/guides/continuous-integration/jenkins.html 的步骤进行操作。

使用的命令行管理程序命令:node_modules/.bin/testcafe chrome tests/**/* -r xunit:res.xml

错误日志:

Cloning the remote Git repository
Cloning repository https://github.com/xxxxx/testcafe-ci-demo.git
> git init /Users/xxxxx/.jenkins/workspace/tcafe-sample # timeout=10
Fetching upstream changes from https://github.com/xxxxx/testcafe-ci-demo.git
> git --version # timeout=10
> git fetch --tags --force --progress -- https://github.com/xxxxx/testcafe-ci-demo.git +refs/heads/*:refs/remotes/origin/* # timeout=10
> git config remote.origin.url https://github.com/xxxxx/testcafe-ci-demo.git # timeout=10
> git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
> git config remote.origin.url https://github.com/xxxxx/testcafe-ci-demo.git # timeout=10
Fetching upstream changes from https://github.com/xxxxx/testcafe-ci-demo.git
> git fetch --tags --force --progress -- https://github.com/xxxxx/testcafe-ci-demo.git +refs/heads/*:refs/remotes/origin/* # timeout=10
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 7ddcab81ab41bf4f5bc6ed9f8418029534db60e4 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 7ddcab81ab41bf4f5bc6ed9f8418029534db60e4 # timeout=10
Commit message: "Add a readme and license"
First time build. Skipping changelog.
[tcafe-sample] $ /bin/sh -xe /var/folders/xc/tb86yjr146zfbtqkxr2t95q00000gn/T/jenkins5861951405271132891.sh
+ npm install testcafe testcafe-reporter-xunit
npm WARN deprecated core-js@1.2.7: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN saveError ENOENT: no such file or directory, open '/Users/xxxxx/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/Users/xxxxx/package.json'
npm WARN xxxxx No description
npm WARN xxxxx No repository field.
npm WARN xxxxx No README data
npm WARN xxxxx No license field.
+ testcafe-reporter-xunit@2.1.0
+ testcafe@1.8.6
updated 2 packages and audited 1377 packages in 17.358s
5 packages are looking for funding
run `npm fund` for details
found 73 vulnerabilities (41 low, 10 moderate, 22 high)
run `npm audit fix` to fix them, or `npm audit` for details
[tcafe-sample] $ /bin/sh -xe /var/folders/xc/tb86yjr146zfbtqkxr2t95q00000gn/T/jenkins4273197940408317220.sh
+ node_modules/.bin/testcafe chrome 'tests/**/*' -r xunit:res.xml
/var/folders/xc/tb86yjr146zfbtqkxr2t95q00000gn/T/jenkins4273197940408317220.sh: line 2: node_modules/.bin/testcafe: No such file or directory
Build step 'Execute shell' marked build as failure
Recording test results
ERROR: Step ‘Publish JUnit test result report’ failed: No test report files were found. Configuration error?
Finished: FAILURE

我在这个Mac上也有一个本地(在Jenkins之外(安装的Testcafe。 这会是个问题吗?

日志中的以下行表示您的主目录中有node_modules目录,npm install将其用作软件包安装目录:

npm WARN saveError ENOENT: no such file or directory, open '/Users/xxxxx/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/Users/xxxxx/package.json'

npm install命令不会在 Jenkins 工作区目录 (/Users/xxxxx/.jenkins/workspace/tcafe-sample( 中安装软件包,并且当node_modulesTestCafe 存在于其某些父目录中时,您将无法使用本地安装的 TestCafe。

您可以删除/Users/xxxxx/node_modules目录以避免此问题。

相关内容

最新更新