nedb
nedb copied to clipboard
File rename errors in Jest Supertest integration tests.
I am using Jest and Supertest to run integration tests and Jest will exit with an error.
Q:\redacted\portal-api\node_modules\nedb\lib\datastore.js:77
if (err) { throw err; }
^
[Error: EPERM: operation not permitted, rename 'Q:\redacted\portal-api\data\employer.db~' -> 'Q:\redacted\portal-api\data\employer.db'] {
errno: -4048,
code: 'EPERM',
syscall: 'rename',
path: 'Q:\\redacted\\portal-api\\data\\employer.db~',
dest: 'Q:\\redacted\\portal-api\\data\\employer.db'
}
npm ERR! Test failed. See above for more details.
I have multiple tests in multiple files which resemble the following:
const request = require('supertest');
const app = require('../app');
describe('answers profile routes', () => {
it('info route', done => {
request(app)
.post('/app/client/api/profile/info')
.send({username: "[email protected]"})
.expect(200, done);
});
it('super route', done => {
request(app)
.post( '/app/client/api/profile/super')
.send({username: "[email protected]"})
.expect(200, done);
});
});
I tried to run jest test --runInBand
as per issue, but does not resolve my issue.
I think the issue may be running multiple instance of the Express app, via supertest(app)
, but I didn't know whether to open in here, or Supertest.
Edit: the redacted
folder path is alphanumeric with dashes only.