- Checkout repo
- run
npm i
- run
node jasmine.config.js
to run tests
The task is to run onprepare function before kicking off specs. This function serves 2 main purposes:
- runs several async functions
- sets up jasmine reporters, ONE OF THE REPORTERS IS USING A VALUE RETURNED BY ASYNC FUNC
The code goes to on-prepare.js. For better explanation, see console.log, which has integers for the expected order
The spec is ran before on-prep function is completed. One of the reported is not even added. Below is the output
jasmine-on-prepare sp$ node jasmine.config.js
1 modules imported
2 reporters setup
Jasmine started
6 it #1
example
✓ it #1 (0.001 sec)
7 it #2
✓ it #2 (0 sec)
8 it #3
✓ it #3 (0 sec)
Executed 3 of 3 specs SUCCESS in 0.008 sec.
3 setup func #1 executed
4 setup func #2 executed
5 onPrepare work completed
The code goes to jasmine.config.js
.
I get jasmine.getEnv() is not a function
.
Likely because the line is ran, before jasmine.execute()
is called.
I'm not sure if I can construct Env class and add reporters directly
This doesn't work for me, because one of the reporters uses value from async function to construct it