挂起 Jenkins 构建的成功测试

问题描述

我是 Jenkins 的新手,有 Supertest 和 Mocha。我正在运行一个测试脚本并在 Jenkins 中构建一个脚本。我的测试成功了,但 Build 挂了。

supertest npm 的测试脚本:

var request = require('supertest');
var app = require('../index.js');
describe('GET /',function() {
    it('Respond with hello world',function(done) {
        //navigate to root and check the the response is "hello world"
        request(app).get('/').expect({
            status : true,message : 'hello world'
        },done);
    });
});

这是詹金日志的截图:

Jenkin Log Image

有人可以帮忙吗?

解决方法

Mocha 4 需要 --exit 标志才能在测试后终止。或者,您必须将应用配置为自行清理。

在测试脚本中我写了 ./node_modules/.bin/mocha ./test/test.js 而不是 ./node_modules/.bin/mocha ./test/test.js --exit

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...