Do you want to request a feature or report a bug?
Bug
What is the current behavior?
If a snapshot serializer's test method throws an exception, the stack trace doesn't point to it at all. This can make it difficult to determine where the exception is coming from.
Example:
Serializer:
const DummySerializer = {
test: val => { throw new Error('Where is this error?') },
print: val => '',
};
Config:
{
"snapshotSerializers": [
"<rootDir>/dummySerializer.js"
],
"testRegex": ".*-test\\.js$"
}
Test:
test('hello world', () => {
expect('foo').toMatchSnapshot();
})
Output:
FAIL ./add-test.js
● hello world
Where is this error?
at Object.<anonymous>.test (add-test.js:2:17)
add-test.js:2 is simply the expect('foo').toMatchSnapshot() call.
repl.it demo: https://repl.it/HKH4
What is the expected behavior?
Stack trace should point to the test method in the snapshot serializer.
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
I encountered this internally at Facebook, but can also repro on Jest v19.0.2 using repl.it.
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
If a snapshot serializer's
testmethod throws an exception, the stack trace doesn't point to it at all. This can make it difficult to determine where the exception is coming from.Example:
Serializer:
Config:
Test:
Output:
add-test.js:2is simply theexpect('foo').toMatchSnapshot()call.repl.it demo: https://repl.it/HKH4
What is the expected behavior?
Stack trace should point to the
testmethod in the snapshot serializer.Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
I encountered this internally at Facebook, but can also repro on Jest v19.0.2 using repl.it.