Gitlab-ci.yml 在尝试获取邮递员/纽曼报告时失败:纽曼:找不到“”记者

时间:2021-06-10 18:07:21

标签: node.js docker npm postman postman-newman

我在输出 newman 的报告时遇到问题。 这是我正在使用的 gitlab-ci.yml 代码:

Postman_Tests_Dev: 
  stage: test_dev
  image:
    name: postman/newman:5.2.3-alpine
    entrypoint: ["/bin/sh", "-c"] 
  script:
    - newman --version
    - npm install -g install-peerdeps
    - npm i -g newman-reporter-htmlextra
    #- install-peerdeps newman-reporter-html
    - newman run ./devAPIs.json --reporters cli, html --reporter-html-export devtestresults.html
  artifacts:
    paths: 
      - devtestresults.html
  tags:
    - dockerA

我看到的错误是“纽曼:找不到“记者”。 请看下面的输出:

Skipping Git submodules setup
Executing "step_script" stage of the job script
01:24
$ newman --version
5.2.3
$ npm install -g install-peerdeps
npm WARN deprecated @babel/polyfill@7.12.1: ? This package has been deprecated in favor of separate inclusion of a polyfill and regenerator-runtime (when needed). See the @babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill) for more information.
npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
/usr/local/bin/install-peerdeps -> /usr/local/lib/node_modules/install-peerdeps/lib/cli.js
> core-js@2.6.12 postinstall /usr/local/lib/node_modules/install-peerdeps/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
+ install-peerdeps@3.0.3
added 26 packages from 10 contributors in 4.567s
$ npm install reporter
npm WARN saveError ENOENT: no such file or directory, open '/builds/jj/pipelinetests/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/builds/jj/pipelinetests/package.json'
npm WARN pipelinetests No description
npm WARN pipelinetests No repository field.
npm WARN pipelinetests No README data
npm WARN pipelinetests No license field.
+ reporter@0.1.0
added 2 packages from 2 contributors and audited 2 packages in 2.171s
found 0 vulnerabilities
$ install-peerdeps newman-reporter-html
install-peerdeps v3.0.3
Installing peerdeps for newman-reporter-html@latest.
npm install newman-reporter-html@1.0.5 newman@4 --save
SUCCESS newman-reporter-html
  and its peerDeps were installed successfully.
$ newman run ./devAPIs.json --reporters cli, html --reporter-html-export devtestresults.html
newman: could not find "" reporter
  ensure that the reporter is installed in the same directory as newman
  please install reporter using npm
newman
devAPIs.json
→ healthCheck
  GET https://XXX.azurewebsites.net/api/health/status?code=asdfadsf== [200 OK, 261B, 745ms]
→ notification
  POST https://XXX.azurewebsites.net/api/od/notifications?code=4fff== [200 OK, 254B, 126ms]
┌─────────────────────────┬─────────────────────┬────────────────────┐
│                         │            executed │             failed │
├─────────────────────────┼─────────────────────┼────────────────────┤
│              iterations │                   1 │                  0 │
├─────────────────────────┼─────────────────────┼────────────────────┤
│                requests │                   2 │                  0 │
├─────────────────────────┼─────────────────────┼────────────────────┤
│            test-scripts │                   0 │                  0 │
├─────────────────────────┼─────────────────────┼────────────────────┤
│      prerequest-scripts │                   0 │                  0 │
├─────────────────────────┼─────────────────────┼────────────────────┤
│              assertions │                   0 │                  0 │
├─────────────────────────┴─────────────────────┴────────────────────┤
│ total run duration: 914ms                                          │
├────────────────────────────────────────────────────────────────────┤
│ total data received: 35B (approx)                                  │
├────────────────────────────────────────────────────────────────────┤
│ average response time: 435ms [min: 126ms, max: 745ms, s.d.: 309ms] │
└────────────────────────────────────────────────────────────────────┘
Uploading artifacts for successful job
00:11
Uploading artifacts...
WARNING: devtestresults.html: no matching files    
ERROR: No files to upload                          
Cleaning up file based variables
00:10
Job succeeded

编辑 1

我取消注释该行

  • install-peerdeps newman-reporter-html

而且我还删除了“cli”和“html”之间的空格,但现在这是错误:

$ newman run ./devAPIs.json --reporters cli,html --reporter-html-export devtestresults.html
newman: could not find "html" reporter
  ensure that the reporter is installed in the same directory as newman
  run `npm install newman-reporter-html`

0 个答案:

没有答案