You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to comply to mocha/no-top-level-hooks but I'm using global hooks to initialize my tests, an init.js file is executed before all of my tests:
consthelper=require('./helper')// GLOBAL HOOKSbefore(asyncfunction(){// Make a connection to the database to be used in all testsawaithelper.db.start()// Run the serverhelper.app.run()})// Used to gracefully shutdown at the endafter(asyncfunction(){constserver=helper.app.getServer()server.close()awaithelper.db.stop()})
Note that in all my tests I have an afterEach hook to clean the db
With this implementation all my tests (107) are executed in 2 seconds.
However, I tried to move that in beforeEach and afterEach in all my tests files to see if I can run the setup in each tests an now all the tests are executed in 2 minutes.
So should I just turn off this rule or is there a way to replace global hooks but keep nice performances ?
The text was updated successfully, but these errors were encountered:
If @BourgoisMickael is using "globals" to refer to Root Hook Plugins, then I have the same question and a potential suggestion. The suggestion being to add an argument to this rule definition that accepts an array of root hook file names, which will then be excluded from the linter parsing.
I'd like to comply to
mocha/no-top-level-hooks
but I'm using global hooks to initialize my tests, aninit.js
file is executed before all of my tests:Note that in all my tests I have an
afterEach
hook to clean the dbWith this implementation all my tests (107) are executed in 2 seconds.
However, I tried to move that in
beforeEach
andafterEach
in all my tests files to see if I can run the setup in each tests an now all the tests are executed in 2 minutes.So should I just turn off this rule or is there a way to replace global hooks but keep nice performances ?
The text was updated successfully, but these errors were encountered: