vscode-tmlanguage-snapshot
v1.0.1
Published
Take snapshots of your tmLanguage grammar.
Maintainers
Readme
vscode-tmlanguage-snapshot
Take snapshots of your tmLanguage grammar.
📦 Installation
$ npm install vscode-tmlanguage-snapshot
$ yarn add vscode-tmlanguage-snapshot
$ pnpm add vscode-tmlanguage-snapshot🚀 Usage
// 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.
🤝 Credits
Ported from vscode-tmgrammar-test, refactored for better library usage.
