bahmutov / snap-shot

Jest-like snapshot feature for the rest of us, works magically by finding the right caller function
169 stars 3 forks source link

Get accurate info for ES6 transformed module file #17

Closed bahmutov closed 7 years ago

bahmutov commented 7 years ago

For example in https://github.com/bahmutov/snap-shot-modules-test the source file is very short

import sum from './sum'
import snapshot from 'snap-shot'
// const snapshot = require('snap-shot')

it('2 + 5 should match snap-shot', () => {
  const result = sum(2, 5)
  snapshot(result) // 7
})

Yet snap-shot things the "snapshot" is from line 17, probably because it was transformed via "test": "mocha --compilers js:babel-register *.test.js"