Closed YichenTang97 closed 5 years ago
Tests for UserService is being fixed in #172 so blocking for now. Nice finding the solution by the way! Will test on macOS soon. I wonder why electron and nodegit was being picked up (macOS only) in early commits when the tests were being added.
Fixed merge conflicts and now both tests pass (also made a small fix on authenticate.component.test.ts). Some error message was thrown because document is not defined as shown below, but that does not affect the test result (test cases not covering that part). I think it would be fine to leave it like this by now?
Tests for UserService is being fixed in #172 so blocking for now. Nice finding the solution by the way! Will test on macOS soon. I wonder why electron and nodegit was being picked up (macOS only) in early commits when the tests were being added.
Fixed merge conflicts and now both tests pass (also made a small fix on authenticate.component.test.ts). Some error message was thrown because document is not defined as shown below, but that does not affect the test result (test cases not covering that part). I think it would be fine to leave it like this by now?
Tests not working on macOS, also cannot npm run compile
, it throws a lot of Cannot find name x
errors when trying to compile, might be related to the downgrading of reflect-metadata
but I'm unsure.
Note: There are a lot more errors that this.
@sloushsu So weird... I've just made two another changes:
Works fine on Windows 10, can you test again on MacOS? Thanks By the way, is there anyone using Linux?
@sloushsu So weird... I've just made two another changes:
- Change moduleNameMapper to map nodegit to the mocked nodegit.js instead of the actual module
- Change the target config in tsconfig.ts from es5 to es6 (which should solve the "Cannot find name X" problem according to this post)
Works fine on Windows 10, can you test again on MacOS? Thanks By the way, is there anyone using Linux?
I get the error you are getting now. But the test passes.
Just adding some note about the long process (4 days with dozens of failed trails) I went through until reaching the real reason causing the problem:
The whole process took me 4 days, but it finally made tests possible on windows pcs which most of us use.
Resolves #146.
Reason for the problem
What to do on the mocks You can add mock functions in the mocked modules (nodegit.js and electron.js) in one place to make them behave in the way you want for testing other classes, these mocked functions will be reflected in every test where these modules are required.