File: dist.typescript-4.8.ts

package info (click to toggle)
node-csstype 3.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 2,320 kB
  • sloc: javascript: 49; makefile: 2
file content (22 lines) | stat: -rw-r--r-- 867 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import * as path from 'path';
import * as ts from 'typescript4.8';
import { removeAbsolutePaths, COMPILER_OPTIONS } from './typescript-utils';

describe('Typescript 4.8', () => {
  it('detects errors', async () => {
    const program = ts.createProgram([path.resolve(__dirname, '__fixtures__/typecheck.ts')], COMPILER_OPTIONS);
    const diagnostics = ts.getPreEmitDiagnostics(program);
    const errors = diagnostics.map(diagnostic => {
      const { line, character } = diagnostic.file!.getLineAndCharacterOfPosition(diagnostic.start!);
      return `${line}:${character} - ${removeAbsolutePaths(
        ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'),
      )}`;
    });

    expect(Number(ts.versionMajorMinor)).toBe(4.8);
    expect(errors.length).toBe(16);
    for (const error of errors) {
      expect(error).toMatchSnapshot();
    }
  });
});