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

Некорректный тип функции it( #847

Open
dicrtarasov opened this issue Feb 21, 2024 · 4 comments
Open

Некорректный тип функции it( #847

dicrtarasov opened this issue Feb 21, 2024 · 4 comments

Comments

@dicrtarasov
Copy link

dicrtarasov commented Feb 21, 2024

Last Hermione version that worked

7.x.x

Hermione version

8.1.0

Code to reproduce the issue

it("Мой тест", async ({currentTest}) => {
    ....
});

В новой версии ругается что currentTest не определена в Mocha.TestFunction, хотя ранее тут был тип TestDefinition от Hermione.

Expected behavior

syntax correct

Actual behavior

TS2339: Property 'currentTest' does not exist on type 'Done'.

Additional information

Лечится вот так в проектном global.d.ts:

// noinspection ES6UnusedImports
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import type Hermione from 'hermione';

Node.js version

20.10.0

Operating System

macOS

@DudaGod
Copy link
Member

DudaGod commented Mar 5, 2024

Hello.

In your tsconfig.json file try to specify:

{
    "compilerOptions": {
        "types": [
            "hermione"
        ]
    }
}

@dicrtarasov
Copy link
Author

This does not helps :((

image

image

But this is workaround:

image

@shadowusr shadowusr self-assigned this Mar 18, 2024
@shadowusr
Copy link
Member

You are right. Only your workaround or similar triple-slash directive works.

I'm working on this issue now and will let you know as soon as I figure out a solution.

@shadowusr
Copy link
Member

After discussion with the team, I believe the only viable solution for us would be to publish typings separately in the @types package, even though hermione itself is now written in TypeScript. This way, everything would work as expected and global API would be visible automatically. Jest uses the same approach. I tried to do this quickly, but encountered some deeper types issues in one of our dependencies, so for now I'll put it into backlog.

Up until that, I suggest using the workaround you mentioned. We'll get back to this issue as soon as we can.

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

No branches or pull requests

3 participants