Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File rename errors in Jest Supertest integration tests. #661

Open
ComputerCarl opened this issue Dec 16, 2020 · 0 comments
Open

File rename errors in Jest Supertest integration tests. #661

ComputerCarl opened this issue Dec 16, 2020 · 0 comments

Comments

@ComputerCarl
Copy link

ComputerCarl commented Dec 16, 2020

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: "carl@redacted.com"})
            .expect(200, done);
    });
    it('super route', done => {
        request(app)
            .post( '/app/client/api/profile/super')
            .send({username: "carl@redacted.com"})
            .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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant