詹金斯与Jest整合 [英] Jenkins integration with Jest

查看:104
本文介绍了詹金斯与Jest整合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让Jenkins集成在基于Jasmine构建的Javascript Jest测试框架中?

Is there a way to have Jenkins integration in the Javascript Jest testing framework that is built on top of Jasmine?

我试图将Jest与 jasmine-reporter ,但没有设法获得JUnit XML输出。我用 npm install jasmine-reporters@~1.0.0 安装了Jasmine 1.3的记者,然后在我的 setupTestFrameworkScriptFile 中安装:

I've tried to integrate Jest with jasmine-reporters, but didn't manage to get a JUnit XML output. I installed the reporters for Jasmine 1.3 with npm install jasmine-reporters@~1.0.0 and then in my setupTestFrameworkScriptFile:

require('jasmine-reporters');

jasmine.VERBOSE = true;

jasmine.getEnv().addReporter(new jasmine.JUnitXmlReporter({
  savePath: "output/"
}));

当我运行 jest 我得到 NodeJS尝试:path.join的参数必须是字符串 NodeJS尝试:对象[object Object]没有方法'join'

推荐答案

我已经设法在这个 repo 。问题是我没有在测试文件中嘲笑路径 fs

I've managed to get a working version of it in this repo. The problem was I was not mocking path and fs in the test file.

这篇关于詹金斯与Jest整合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆