And in my test I try using it like I would normally do:
import request from 'supertest';
import { expressApp } from '../src/app';
describe('Analyze Movements', () => {
test('succeeds list of analyze movements', async () => {
const response = await request(expressApp)
.get(`/analyze`)
.expect(200);
let body = response.body;
expect(body.length).toBeGreaterThan(1);
});
}
But I'm getting a SyntaxError: SyntaxError: Unexpected identifier queries.js:1 ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import moment from 'moment';
I suspect this is a problem related with the fact that my expressApp() method is async but I can't figure it out..
I've tried cutting the
startServer()
method with anexpressApp()
one that I can export:And in my test I try using it like I would normally do:
But I'm getting a SyntaxError:
SyntaxError: Unexpected identifier queries.js:1 ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import moment from 'moment';
I suspect this is a problem related with the fact that my expressApp() method is async but I can't figure it out..