Take snapshots of your tmLanguage grammar.
npm install vscode-tmlanguage-snapshotTake snapshots of your tmLanguage grammar.

``bash`
$ npm install vscode-tmlanguage-snapshot
$ yarn add vscode-tmlanguage-snapshot
$ pnpm add vscode-tmlanguage-snapshot
`ts
// tests/grammar.spec.ts
import { createGrammarSnapshot } from "vscode-tmlanguage-snapshot";
const packageJsonPath = path.resolve(__dirname, "../package.json");
const snapshot = await createGrammarSnapshot(packageJsonPath);
const fixtures = fs.readdirSync(fixturesDir);
for (const fixture of fixtures) {
it(fixture, async () => {
const result = await snapshot(tests/grammarFixtures/${fixture});
expect(result).toMatchSnapshot();
});
}
``
You can also refer to our tests for more examples.
Ported from vscode-tmgrammar-test, refactored for better library usage.