-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[EC-423] Fix unit tests #3265
[EC-423] Fix unit tests #3265
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eliykat Thank you for fixing these. I also noticed some broken tests earlier today.
I can approve all change besides the button.directive. I was not part of that initiative. Will leave that up to EC and SSG
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the testEnvironment = node
, but I can't see that it hurts anything
I've made the following additional changes. This is all to enable #3216 so that we can have unit tests run in the pipeline again.
I've forked this and merged #3216 into it to confirm that it successfully runs all tests: https://github.com/eliykat/bitwarden-clients/runs/7759609192?check_suite_focus=true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm concerned about including spec and test setup files in tsconfig
. I think webpack should always treeshake these out in production builds, but I'm not 100% confident in my knowledge of that witchcraft.
regardless, we have tsconfig.spec.json
to handle these -- does that solution not work for some reason? Jest should be honoring those...
apps/web/tsconfig.json
Outdated
"./test.setup.ts" | ||
], | ||
"include": ["src/connectors/*.ts", "src/**/*.stories.ts", "src/**/*.spec.ts"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have tsconfig.spec.json
to configure test includes in, I don't think we want to include any specs or test setups in the base tsconfig
files.
Happy to be wrong about that, but I don't want tests in our prod outputs and I'm not sure they won't be if they are included here.
I've had some wins and losses here 😅 Win: ts-jest didn't know to use Lose: as discussed, we need to include the After these changes, All your feedback should be addressed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type of change
Objective
Fix a few unrelated issues we were having when running tests.
Code changes
package.json
tojest.config.ts
. You can use one location or the other, but not both.libs/common/spec/models/domain/encArrayBuffer.spec.ts
bitButton
. Per this test, settingbuttonType = null
should default to the secondary type, but this test is currently failing. Fix how we handle the default buttonType.baseImporter
was logging parsing errors to the console every time tests were run, presumably from malformed test data. This probably meant that the test was passing for the wrong reason. Replacing this line with fresh (redacted) export data fixes it.Screenshots
Before you submit