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

🚀 Example: TypeScript with root level hooks #40

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

🚀 Example: TypeScript with root level hooks #40

guillenotfound opened this issue Nov 3, 2020 · 7 comments
Labels
area: examples status: accepting prs Please, send a pull request to resolve this! 🙏 type: feature New feature or request

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'

@JoshuaKGoldberg
Copy link
Member

Now that #76 is in, I think it'd be great to have another example showing one of those with hooks. Accepting PRs!

@JoshuaKGoldberg JoshuaKGoldberg changed the title Typescript root level hooks 🚀 Example: TypeScript with root level hooks Jul 4, 2024
@JoshuaKGoldberg JoshuaKGoldberg added area: examples type: feature New feature or request status: accepting prs Please, send a pull request to resolve this! 🙏 labels Jul 4, 2024
@AdamFestive

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: examples status: accepting prs Please, send a pull request to resolve this! 🙏 type: feature New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants