我的目标是使用docker图像生成HTML报告。似乎官方的testcafe docker镜像没有用于HTML报告生成器的npm软件包。因此,我开始创建自己的docker镜像。
Dockerfile:
从testcafe / testcafe:latest
USER根
运行cd / opt / testcafe /
&& npm install-保存testcafe-reporter-cucumber-json @ latest \
&& npm install --save-dev multiple-cucumber-html-reporter \
&& npm安装testcafe-reporter-html
这是命令,我正在运行以运行测试:
docker run --mount type = bind,source = // c / Users / sbhas1 / parc-apps / tests / mo-po-dashboard,target = / tests --mount type = bind,source = // c / Users / sbhas1 / parc-apps / reports,target = / reporters -w / reporters -it createefs / testcafereporterchrome /tests/season_test.js --reporter html:tests / reports / results.html
当我运行此程序时,出现错误
错误提供的“html”报告器不存在。检查您是否正确指定了报告格式。
因此,我的问题是:
1.我应该在容器中的哪里安装npm软件包? / opt / testcafe路径不正确?
2.如何进入容器查看文件夹结构?
最佳答案
我可以通过-g选项而不是本地安装npm软件包来解决此问题。现在,我可以使用docker image生成html报告。
最终的Dockerfile是:
从testcafe / testcafe:latest
USER根
运行cd / opt / testcafe \
&& npm install -g testcafe-reporter-cucumber-json @ latest \
&& npm install -g多个 cucumber -html-reporter @ latest \
&& npm install -g testcafe-reporter-html @ latest
展览1337 1338
关于docker - 错误:提供的 “html”报告者不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57975818/