jest-community / jest-editor-support

A module for handling editor to jest integration
MIT License
28 stars 21 forks source link

Parser crashes on TypeScript inline type imports #96

Closed Xunnamius closed 1 year ago

Xunnamius commented 1 year ago

I'm pretty sure this is the right place to create this issue, but if not let me know.

I'm trying to use vscode to debug some of my unit tests. One of my test files uses the relatively new inline type imports feature to condense imports:

import fs from 'node:fs';
import path from 'node:path';
import assert from 'node:assert';
import { EOL } from 'node:os';
import { isNativeError } from 'node:util/types';
import { declare } from '@babel/helper-plugin-utils';
import { asMockedFunction, type AnyFunction } from '@xunnamius/jest-types';
import babel from '@babel/core';

However, the Jest plugin for vscode crashes, giving me the following error as all IDE UI decorations disappear:

/repos/babel-plugin-tester/test/plugin-tester.test.ts: failed to parse test results: SyntaxError: Unexpected token, expected "," (7:32)

Removing the inline type annotation fixes it. Is this expected behavior (that is: am I missing a babel plugin or something)?

Thanks for reading!

connectdotz commented 1 year ago

ok, I was able to reproduce this error. We need to upgrade the dependency of this library.