const app = require('koa')();console.log(typeof app); // object主要错误就是出现在项目实例是对象,在express下,就不错出现这种问题const app = require('express')();const.log(typeof app); // function完整代码:// app.jsconst app = require('koa')();
app.listen(3000);module.exports = app;// article.test.js
const expect = require('chai').expect;
const request = require('supertest');
const app = require('../app');
describe('api: /article', () => {
describe('GET /article', (done) => {
it('response is success', () => {
request(app)
.get('http://localhost/article')
.expect(200)
.end(() => {
done();
}); // console.log(typeof app);
})
});
});
添加回答
举报
0/150
提交
取消