* chore: dumping progress * chore: saving progress * fix: Got a working example of filenames piped from Rust to TS * fix: cleaning up debugging code * fix: TS type for filenames * fix: rust linter errors * fix: cargo fmt * fix: testing code, updating KCLError class for filenames * fix: auto fixes * fix: addressing PR comments * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * fix: fixing the rust struct? * fix: cargo fmt * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
import { kclErrorsToDiagnostics, KCLError } from './errors'
|
|
import { defaultArtifactGraph, topLevelRange } from 'lang/wasm'
|
|
|
|
describe('test kclErrToDiagnostic', () => {
|
|
it('converts KCL errors to CodeMirror diagnostics', () => {
|
|
const errors: KCLError[] = [
|
|
{
|
|
name: '',
|
|
message: '',
|
|
kind: 'semantic',
|
|
msg: 'Semantic error',
|
|
sourceRange: topLevelRange(0, 1),
|
|
operations: [],
|
|
artifactCommands: [],
|
|
artifactGraph: defaultArtifactGraph(),
|
|
filenames: {},
|
|
},
|
|
{
|
|
name: '',
|
|
message: '',
|
|
kind: 'type',
|
|
msg: 'Type error',
|
|
sourceRange: topLevelRange(4, 5),
|
|
operations: [],
|
|
artifactCommands: [],
|
|
artifactGraph: defaultArtifactGraph(),
|
|
filenames: {},
|
|
},
|
|
]
|
|
const diagnostics = kclErrorsToDiagnostics(errors)
|
|
expect(diagnostics).toEqual([
|
|
{
|
|
from: 0,
|
|
to: 1,
|
|
message: 'Semantic error',
|
|
severity: 'error',
|
|
},
|
|
{
|
|
from: 4,
|
|
to: 5,
|
|
message: 'Type error',
|
|
severity: 'error',
|
|
},
|
|
])
|
|
})
|
|
})
|