Skip to content

Error: write EPIPE on test when updating to version 3.1.0 #491

@EdouardDubois

Description

@EdouardDubois

Hello,

First, thank you for this module that I've been using for a while now.

I've recently run into a problem when updating module to 3.1.0.
A test I have is no longer working and throws me : Error: write EPIPE.

This is the following test :

it('uploads a file but 400 during validation', () => app.server
    .post(`${baseUrl}/files`)
    .set('Authorization', token)
    .attach('file', `${fixturesPath}/files.jpg`)
    .expect(400)
    .then((res) => {
        expect(res.body).have.property('success').and.equal(false);
        expect(res.body).have.property('error').and.to.be.an('object');
        expect(res.body.error).have.property('fileType').and.equal('is required');
    }));

The function I try to test here, just throws an error which should validate the expect(400) and expects in the then.

The expected error is sent and printed in the terminal :

BadRequest { status: 400, message: { fileType: 'is required' } }
[0mPOST /api/v1/prospect/files [33m400[0m6.224 ms - 51[0m

But right after the end of the request I get the Error: write EPIPE., before entering the validation part of the test.

I've try logging something in the then but the error happens before that but after request is completed.

it('uploads a file but 400 during validation', () => app.server
    .post(`${baseUrl}/files`)
    .set('Authorization', token)
    .attach('file', `${fixturesPath}/files.jpg`)
    .expect(400)
    .then((res) => {
        console.log('something');    // <-- This code is never reached
        expect(res.body).have.property('success').and.equal(false);
        expect(res.body).have.property('error').and.to.be.an('object');
        expect(res.body.error).have.property('fileType').and.equal('is required');
    }));

Is this an issue with the way I write the test ? (I have 630 other tests working fine, with similar syntax).

This test is still working fine with 3.0.0 and only breaks in 3.1.0, I'm therefore unable to update the module since I don't know how to make this test work.

Would you need any more info on how we could fix this ?

Thank you,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions