Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type error in test runner #44

Closed
KFlash opened this issue Mar 27, 2021 · 9 comments
Closed

type error in test runner #44

KFlash opened this issue Mar 27, 2021 · 9 comments
Assignees

Comments

@KFlash
Copy link
Contributor

KFlash commented Mar 27, 2021

test/cli.ts:30:111 - error TS2322: Type 'number' is not assignable to type '{ label: number; sent: () => any; trys: any[]; ops: any[]; }'.

30 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }

@aladdin-add
Copy link
Collaborator

can you describe how you get this error, and the raw output?

@KFlash
Copy link
Contributor Author

KFlash commented Mar 27, 2021

I simply wrote a test and tried to test it. Then the test runner froze and after a few sec that messages pops up. I got confused because '30 if (!(t = _.trys, t = t.length > 0' has nothing to do with Kataw source code or the test runner.

I modified the tests, and it works now except I need to update all the time. Normal testing are broken - always complaining about mismatch.

Anyway. This is common TS issue. I guess related to something in ts-node library

@KFlash
Copy link
Contributor Author

KFlash commented Mar 27, 2021

I was wrong. It points to some code in ts-lib. Not ts-node.

Closest I got in tracking it is this issue egoist/bili#280

@KFlash
Copy link
Contributor Author

KFlash commented Mar 27, 2021

@aladdin-add It's related to async/await

TypeStrong/ts-node#774

@KFlash
Copy link
Contributor Author

KFlash commented Mar 31, 2021

I tried to run coverage

test/cli.ts:30:111 - error TS2322: Type 'number' is not assignable to type '{ label: number; sent: () => any; trys: any[]; ops: any[]; }'.

30 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
~
at createTSError (D:\x\node_modules\ts-node\src\index.ts:513:12)
at reportTSError (D:\x\node_modules\ts-node\src\index.ts:517:19)

@aladdin-add
Copy link
Collaborator

the code was compiled twice? TypeStrong/ts-node#774 (comment)

but why? I was not able to repro on my macos, can you share the command that you used to run?

@KFlash
Copy link
Contributor Author

KFlash commented Apr 2, 2021

I only tried to run code coverage. 'npm run coverage'

@aladdin-add
Copy link
Collaborator

not sure why. maybe another "windows-compat" issue. ╮( ̄▽ ̄)╭

a workaround could be setting "target" to >="es2017", to avoid compiling async functions to regenerator.

@KFlash
Copy link
Contributor Author

KFlash commented Apr 6, 2021

@aladdin-add is there a fix for this? And what's the test runner update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants