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

Typescript root level hooks #40

Open
guillenotfound opened this issue Nov 3, 2020 · 5 comments
Open

Typescript root level hooks #40

guillenotfound opened this issue Nov 3, 2020 · 5 comments

Comments

@guillenotfound
Copy link

Could you provide an example of root level hooks like described here for typescript? When I create a hooks.js or hooks.ts it doesn't get called.

@jardimihaly
Copy link

I'm having the same issue, where no matter what I try, the root level hooks are not getting called in .ts files.
Have you managed to find a solution?

@dayafigueroa
Copy link

same here

@dayafigueroa
Copy link

Jic you are still looking for the solution, We ended up adding it to the nodejs namespace and referencing it using the triple slash directive

@Kana00
Copy link

Kana00 commented Jul 5, 2021

Can you give us the definition file you created? @dayafigueroa

@Kana00
Copy link

Kana00 commented Jul 5, 2021

I found a solution from the documentation here

You just need to pass as an argument --require to the mocha command with the file containing the hooks.

Example: mocha -r ts-node/register --require './src/test/hooks.ts' './src/**/*.test.ts'

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

4 participants