The parsed Langium document with markers to check for issues.
An array of expected issues.
Optional
parameters: IgnoreParametersOptional parameters to customize which issues to ignore.
import { expect, test } from 'vitest';
import { parseDocument } from './your-langium-test-setup';
test('document has expected issues', async () => {
const parsedDoc = await parseMarkedDSL(`
let [[x: string]] = 5;
print(x);
`, '[[', ']]');
expect(parsedDoc).toHaveDocumentIssues([
{
message: "Type 'number' is not assignable to type 'string'",
markerId: 0
}
]);
});
test('document has a warning, ignoring errors', async () => {
const parsedDoc = await parseMarkedDSL(`
let [[foo]];
`, '[[', ']]');
expect(parsedDoc).toHaveDocumentIssues(
[
{
severity: DocumentIssueSeverity.WARNING,
message: "Variable 'foo' is never used",
markerId: 0
}
],
{ ignoreValidationErrors: true }
);
});
Expects a parsed Langium document with markers to have specific issues.