The `typescript-snapshots-plugin` enhances the TypeScript language service to provide deep IDE support for Jest or similar snapshot testing frameworks. It integrates features directly into the editor, such as displaying snapshot content on quick info (hover) for `toMatchSnapshot` calls and enabling "Go to Definition" navigation from the test call to its corresponding `.snap` file. The plugin also supports dynamically constructed test names, albeit currently limited to constant expressions for accurate linking. It is installed as a development dependency and configured within the `plugins` array of your `tsconfig.json`. The current stable version is 1.7.0, indicating active maintenance and development. Its key differentiator is streamlining the snapshot testing workflow by bringing snapshot content and navigation directly into the TypeScript editor experience, reducing context switching and improving developer productivity.
npm install typescript-snapshots-pluginNo compatibility data collected yet for this library.
Demonstrates `typescript-snapshots-plugin` setup in `package.json` and `tsconfig.json`, with a sample Jest test file. Highlights hover-to-view and go-to-definition features, and configures VSCode for optimal plugin usage.
In VSCode, open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P), search for 'TypeScript: Select TypeScript Version...', and choose 'Use Workspace Version'.
Ensure that any parts of your `test()` or `it()` block descriptions that contribute to the snapshot name are defined as constants within the scope of the test file.
Ensure `npm install typescript-snapshots-plugin typescript --save-dev` has been run and verify the `plugins` array in `tsconfig.json` correctly references `"name": "typescript-snapshots-plugin"`.
Verify that your IDE is configured to use the TypeScript version installed in your project's `node_modules`. For VSCode, use 'TypeScript: Select TypeScript Version...' from the Command Palette and choose 'Use Workspace Version'.