Testcafe с Jenkins на Ma c: node_modules / .bin / testcafe: нет такого файла или каталога - PullRequest
1 голос
/ 17 июня 2020

Я пытаюсь запустить сценарий testcafe через Jenkins на Ma c. Я выполнил шаги из 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

У меня также есть Установка Testcafe локально (за пределами Jenkins) в этом Ma c. Может ли это быть проблемой?

1 Ответ

3 голосов
/ 18 июня 2020

Следующие строки в вашем журнале показывают, что у вас есть каталог 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 выиграла ' t устанавливайте пакеты в каталог рабочей области Jenkins (/Users/xxxxx/.jenkins/workspace/tcafe-sample), и вы не сможете использовать локально установленный TestCafe, пока node_modules существует в некоторых из его родительских каталогов.

Вы можете удалить каталог /Users/xxxxx/node_modules, чтобы избежать этой проблемы.

...