test: add SENTRY env

This commit is contained in:
DIYgod
2019-09-09 14:47:44 +08:00
parent a9221fc275
commit 889f3118b1
2 changed files with 8 additions and 0 deletions

View File

@@ -11,6 +11,8 @@ if (config.sentry) {
Sentry.configureScope((scope) => {
scope.setTag('node_name', config.nodeName);
});
logger.info('Sentry inited.');
}
module.exports = async (ctx, next) => {

View File

@@ -1,3 +1,5 @@
process.env.SENTRY = 'https://mock@mock.com/1';
const supertest = require('supertest');
const { server } = require('../../lib/index');
const request = supertest(server);
@@ -6,6 +8,10 @@ afterAll(() => {
server.close();
});
afterAll(() => {
delete process.env.SENTRY;
});
describe('error', () => {
it(`error`, async () => {
const response = await request.get('/test/error');