我使用了一个名为Puppetry的出色工具来创建e2e测试。使用npm命令-npm test
运行测试。很容易。
我使用Dockerfile在部署管道中运行这些测试。一切正常。我想知道的是这两种方法中哪种更好(为什么):
# Dockerfile
# other docker instructions
RUN npm run test <== 1. running tests when the image builds
CMD npm test <== 2. running tests after the image builds
目前,我使用第二种方法。
docker build
)。