Open bahmutov opened 7 years ago
The code that gets the call site is in https://github.com/bahmutov/snap-shot/blob/57eb06e3b971c155a45e5b688bf7455bd5acea52/src/index.js#L37
function snapshot (what, update) {
const sites = stackSites()
if (sites.length < 3) {
// hmm, maybe there is test (like we are inside Cypress)
if (this && this.test && this.test.title) {
debug('no callsite, but have test title "%s"', this.test.title)
return this.test.title
}
debug(sites)
const msg = 'Do not have caller function callsite'
throw new Error(msg)
}
where const stackSites = require('stack-sites')
from https://github.com/bahmutov/stack-sites
See src/async-spec.js test "promise to snapshot"
The reported stack does not have "async-spec.js" at all, instead only has