Snapshot files should be resolved relative from the file, not from cwd
Opened this issue · 0 comments
mcollina commented
In a npm workspace project, I would like to:
- have the snapshots stored in the root of the module
- to run my tests from the root of the repository as well as the root of the module
I could not find a way to set it up. I thought to do it with snapshotFile
but the snapshot entries are created with a packages/mymodule
prefix added depending on my cwd()
. I tracked it down to
Lines 1199 to 1205 in 7d2934a
The fullname
of a test is created from cwd()
.
I'm currently fixing this with:
Object.defineProperty(t, 'fullname', {
value: 'mymodule/mytest'
})
I can work on a PR but I would need some direction. I see two possible fixes:
- make the
test.fullname
not dependent fromcwd()
- make the snapshot file not use the
fullname
for the internal entries
Wdyt?