-
-
Notifications
You must be signed in to change notification settings - Fork 9.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
Use jest for unittesting - standardize unit testing epic #904
Conversation
So far, we've set up the tools and have one failing test inside storyshots.
The mocks here a bit complicated, so I'm leaving them for later
# Conflicts: # .eslintrc # .gitignore # package.json # packages/addon-knobs/package.json # packages/addon-knobs/yarn.lock # packages/react-storybook/package.json # packages/storybook-ui/package.json # packages/storybook-ui/src/modules/api/actions/__tests__/api.js # packages/storybook-ui/src/modules/shortcuts/actions/__tests__/shortcuts.js # packages/storybook-ui/src/modules/ui/actions/__tests__/ui.js # packages/storybook-ui/src/modules/ui/configs/__tests__/handle_keyevents.js # packages/storybook-ui/src/modules/ui/configs/__tests__/handle_routing.js # packages/storybook-ui/src/modules/ui/configs/__tests__/init_panels.js # packages/storyshots/package.json # packages/storyshots/stories/__test__/__snapshots__/storyshots.test.js.snap
6f6a652
to
13b0938
Compare
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.
Approved but with some caviats. See comments.
.travis.yml
Outdated
notifications: | ||
email: false | ||
node_js: | ||
- "node" | ||
before_install: ./scripts/travis/before_install.sh | ||
after_success: ./scripts/travis/after_success.sh | ||
script: npm run lint && npm run test | ||
script: | ||
- "npm run lint" |
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.
@ndelangen remove "
marks? see https://docs.travis-ci.com/user/customizing-the-build
import { expect } from 'chai'; | ||
import ClientAPI from '../client_api'; | ||
|
||
const { describe, it } = global; |
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.
@ndelangen don't we want this across the board?
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.
What do you mean here @shilman?
@@ -1,6 +1,4 @@ | |||
import actions from '../shortcuts'; | |||
import { expect } from 'chai'; | |||
const { describe, it } = global; |
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.
ditto ;-)
|
||
describe('manager.ui.containers.layout', () => { | ||
describe('mapper', () => { | ||
it('should give correct data', () => { | ||
test('should give correct data', () => { |
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.
why test? should be it
?
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.
it should
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.
test
is the default and mentioned all over the documentation.
@@ -1,2 +0,0 @@ | |||
import initStoryshots from '../../src'; |
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.
are we not testing storyshots? is this temporary?
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.
The way they were tested was just a smoke test, which breaks now because the main index isn't executed within the context of that package's package.json
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.
yes temporary indeed, the implementation was a bad smoke-test. Someone needs to do a thorough analysis on how to test it.
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.
If I change .eslintrc.js
to extend airbnb-base
, it shows me lots of linting errors.
extends: [
'airbnb-base',
],
I believe the current configuration is incorrectly swallowing a lot of errors.
@ndelangen I see you're trying out |
Ok, @shilman I agree, linting can be made much more strict then it is now. I will setup a new branch and PR for that. I think we can merge this and then start working on improving linting? |
OK @ndelangen I agree with that solution, because we are doing heavy lifting on the monorepo transition and it's better to have these big changes merged. But FYI, I added a line in some source file that said only |
Issue:
What I did