Open Janatbek opened 7 years ago
@Janatbek
The wallabyTest.ts
file is executed before all of your tests once.
This method:
TestBed.initTestEnvironment( BrowserDynamicTestingModule, platformBrowserDynamicTesting()
can only be called once, otherwise angular throws the Cannot set base providers because it has already been called
error.
So I'd rather suggest you remove your beforeAll
test hook, because it is not required. Your karma runner also has the method called once here, so you don't need the beforeAll
test hook.
But if I remove it, my test fails.
@Janatbek Please update the repo so that I could reproduce the issue.
https://github.com/Janatbek/wallaby-playground/tree/injector-of-null it's in this branch
the video screen shot https://www.youtube.com/watch?v=lo7OeTSzZ2k&feature=youtu.be
you can fast forward the video npm test takes too long to execute.
https://github.com/Janatbek/wallaby-playground/tree/injector-of-null
Just ran wallaby on the branch code, everything is working as expected for me:
the video screen shot
The video is unavailable.
the code is just to show you my karma config wallaby and and soe code, but actual code is huge and I cannot upload it here. It is explained in the video
I understand, and I wasn't suggesting to upload your real code. Try isolating the issue in your real project (by only including a single problematic spec file in the tests
list, removing dependencies that a re not required to reproduce the issue, etc.) and then updating your sample repo so that I can reproduce it.
https://www.youtube.com/watch?v=lo7OeTSzZ2k the video is public now
Thanks for publishing the video.
It looks like your karma setup doesn't have the equivalent of the wallabyTest
file (where it bootstraps the environment). It's a bit strange, because all project I have seen normally have one.
Anyway, here's what you can do: https://github.com/Janatbek/wallaby-playground/pull/4. This way you may still have your beforeAll
call with the TestBed.initTestEnvironment
call, which will just be ignored by wallaby (because it had already called it in the wallabyTest
file).
@ArtemGovorov The problem is in wallabyTest.ts file In order to have below method in my test
TestBed.initTestEnvironment( BrowserDynamicTestingModule, platformBrowserDynamicTesting() );
I am getting error from wallaby: Error: Cannot set base providers because it has already been calledI f I comment this out the error goes away.
Do I need this file if wallaby.js can work without this file?