tschaub / mock-fs

Configurable mock for the fs module
https://npmjs.org/package/mock-fs
Other
906 stars 86 forks source link

uvBinding.getErrorMap is not a function #345

Closed MatiasDelorenzi closed 2 years ago

MatiasDelorenzi commented 2 years ago

I'm using mocha/chai in this project and when I run my tests locally it works just fine, but when I push them to gitlab it throws this error in the pipeline.

{"error":{"name":"TypeError","message":"uvBinding.getErrorMap is not a function","stack":"TypeError: uvBinding.getErrorMap is not a function\n at Object.<anonymous> (.../node_modules/mock-fs/lib/error.js:10:11)

I can't share much code because It's from the company I work for, but I'm calling the module like:

const mock = require('mock-fs)
...

describe( 'test', function(){
 it('should mock filesystem, function() {
    mock({
        'path-to-file': JSON.stringify(ObjectStub)
    });
    ....
    mock.restore()
    })
})
3cp commented 2 years ago

Check your gitlab ci nodejs version. Latest mock-fs only supports nodejs v12+.

danilobassi8 commented 2 years ago

Thanks! Worked for me.