This repository was archived by the owner on Nov 2, 2025. It is now read-only.

Description
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
|
get fullname () { |
|
const main = process.argv.slice(1).join(' ').trim() |
|
return (this.parent ? this.parent.fullname |
|
: main.indexOf(cwd) === 0 ? main.substr(cwd.length + 1) |
|
: path.basename(main)).replace(/\\/g, '/') + |
|
' ' + (this.name || '').trim() |
|
} |
.
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 from cwd()
- make the snapshot file not use the
fullname for the internal entries
Wdyt?