Closed ZeroX-DG closed 4 years ago
@ZeroX-DG Can you fix the tests?
Interesting, all tests pass on CI but not at my local. I'll investigate more :smile:
The bug appears on my local:
TypeError: Cannot read property 'prototype' of undefined
8 | const uniqueSlug = require('unique-slug')
9 | const mdurl = require('mdurl')
> 10 | const fse = require('fs-extra')
11 | jest.mock('sander')
12 | const sander = require('sander')
13 |
at patch (node_modules/fs-extra/node_modules/graceful-fs/graceful-fs.js:166:54)
at Object.<anonymous> (node_modules/fs-extra/node_modules/graceful-fs/graceful-fs.js:27:18)
at Object.<anonymous> (node_modules/fs-extra/lib/fs/index.js:4:12)
at Object.<anonymous> (node_modules/fs-extra/lib/index.js:8:12)
at Object.<anonymous> (tests/dataApi/attachmentManagement.test.js:10:1)
This is due to graceful-fs so it's an upstream issue. I got no idea how the test passed on Travis tho :thinking: https://github.com/isaacs/node-graceful-fs/issues/109
Turns out this could be related to the process of jest
mocking fs
module. I need to investigate this deeper :weary:
Turns out it's because there's an error running jest on node 13. I changed to v8 and things works fine.
Description
As a first step to migrate from ava to Jest, I've choosen all tests in "tests/lib" as a first target.
Take over from https://github.com/BoostIO/Boostnote/pull/3207
Related issue
1826
Type of changes
Checklist:
Test coverage differencies
Just check to see the coverage don't get worse accidentally.
Before
yarn cross-env NODE_ENV=test nyc ava --serial tests/lib/*-test.js
After
yarn jest --coverage tests/lib