asvetliakov/typescript-snapshots-plugin

Support concatenated test titles

Closed this issue ยท 3 comments

Somewhat related to #1, but this doesn't involve resolving variable names.

When writing tests, I often end up with long test titles. If I break up the test titles into multiple lines of concatenated strings, this plugin fails to match the test to the snapshot. With prettier defaulting to 80 chars per line, it's common in my project to split a test title.

  it(
    `should error if the sun is blue and the moon is green but user doesn't have` +
      ` binoculars or a telescope`,
    async () => {
    ...
    expect(response).toMatchSnapshot();  // fails to show corresponding snapshot
  });

Yeah, it becomes binary expression instead of string like literal and the parser doesn't handle it. Should be easy to fix

thanks, works great! ๐ŸŽ‰

You're welcome! ๐Ÿ˜„