【问题标题】:Success Test Hanging the Jenkin Build挂起 Jenkins 构建的成功测试
【发布时间】:2021-06-01 05:21:51
【问题描述】:

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

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);
    });
});

这是 Jenkins 日志的截图:

Jenkin Log Image

有人可以帮忙吗?

【问题讨论】:

  • 这是更大的 Jenkins 管道的一部分吗?如果是这样,发布整个管道源和/或作业配置的屏幕截图可能会有所帮助。帮助我们看到更大的图景。我不是 Mocha、supertest,甚至不是 NPM 专家,但在 Jenkins 中管道可能相当复杂。

标签: node.js jenkins continuous-integration continuous-deployment supertest


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-02-26
    • 1970-01-01
    • 2015-11-15
    • 1970-01-01
    • 2019-11-23
    • 1970-01-01
    • 2014-12-13
    • 2023-04-01
    相关资源
    最近更新 更多