-
Notifications
You must be signed in to change notification settings - Fork 154
Test DependencyManagementPane component #363
Conversation
53b2374
to
eda3093
Compare
package.json
Outdated
@@ -28,7 +28,7 @@ | |||
"dist:all": "cross-env GENERATE_SOURCEMAP=false npm run build && electron-builder -mwl -c.extraMetadata.main=build/electron.js", | |||
"publish": "yarn dist --publish always", | |||
"publish:all": "yarn dist:all --publish always", | |||
"test": "node scripts/test.js --maxWorkers=2 --env=node", | |||
"test": "node scripts/test.js --maxWorkers=2 --env=node --verbose=false", |
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.
Note: I'll remove verbose later today. So we're getting the default output. With verbose=false
console.logs are visible in the console but not every test step.
I didn't have a deep look, but at least on surface these changes look good :) |
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.
Should we move more related components into DependencyManagementPane folder? I think DeleteDependencyButton, DependencyDetailsTable & DependencyInfoFromNpm would also fit
Agreed - they should be moved under DependencyManagementPane
. I did a search across the codebase for DeleteDependencyButton
, DependencyDetailsTable
, DependencyInfoFromNpm
, and also DependencyUpdateRow
to see where they're imported and they don't seem to be used anywhere other than DependencyDetails
(which is already under DependencyManagementPane
). And let's go with the __tests__
folder pattern here too since these are many files.
I think this is good to go after that! Thanks @Haroenv for also taking a look 👍
@melanieseltzer on #367:
Is there another flag to enable logging during test runs without disabling verbose output for single tests? Corollary, isn't console logging enabled by default during test runs? |
@superhawk610 It looks like Ultimately if the logging is important let's just add the verbose=false in, I don't mind removing it when necessary since the verbose output is only useful to me when I'm reviewing larger PRs file-by-file (to get a quick overview of each test case). Or maybe two separate package.json scripts? :) |
Ahh, gotcha. Yeah I'm all about adding more package.json scripts. What's a logical place to leave an explanation for why there's two test scripts? Standard JSON sadly doesn't support any real sort of comments :( |
There's this solution for commenting however personally that just seems clunky to me. I think this would be pretty self explanatory?
|
You're right, that's pretty immediately understandable. I'd probably go with |
I think it would be better to have the default with-out
|
* moved related components to DependencyManagementPane * added tests * fixed flow * added a constant instead of Date.now() * updated snapshot * removed white-spaces * removed verbose * fixed linting & mocked AlgoliaLogo * move related component files & moved tests to __tests__ folder * Add script for test:dev
* add analytics tags * Update AddDependencySearchProvider.js * #352 Disable actions that require an internet connection (#368) * Online check component added * add reducer & action for online check component. also included in App.js * removed sidebar functionality when offline * removed depedency functionality when offline * removed functionality from create new project wizard when offline * fixed tests to align with disabled pattern * add infoBanner to Z-indexes for future usage. * removed random {' '}, changed IS_ONLINE_CHECK to SET_ONLINE_STATUS * pull request requested changes missed one file. * updated infobar to be fixed header. * flow fix * remove random whitespace * Pull request changes remove state type, move styled components to before redux part, change background color of infobar to be transparent. * enable menu items based on isOnline * Setup ESlint rules for Jest (#366) * WIP: Added eslint-jest & fixed issues (except snapshots) * reduced snapshot size to meet max 100 lines * fixed snapshot * changed comment to a note about noPadding prop * updated snapshot * Test ProjectConfigurationModal component (#360) * WIP: Added render test * WIP: Added tests * fixed flow * added focus test * Merge branch 'master' into test-project-configuration-modal * fixed linting warnings * removed typing as no flow used in test files * Test CreateNewProjectWizard components (#361) * WIP: Added tests * WIP: ProjectType undefined not throwing in test * fixed flow * added tests * reverted to children render props * Merge branch 'master' into test-create-new-project-wiz * Fixed linting & replaced snapshot with simple smoke tests * addressed review comments * Test DependencyManagementPane component (#363) * moved related components to DependencyManagementPane * added tests * fixed flow * added a constant instead of Date.now() * updated snapshot * removed white-spaces * removed verbose * fixed linting & mocked AlgoliaLogo * move related component files & moved tests to __tests__ folder * Add script for test:dev * Fix spaces and update lint-staged (#369) * Switch to advanced config to silence validation warning * Fix spacing issues * chore: fix merge changes
This is quite a large PR so I'm not going into every test detail.
I've tried to hit a coverage of over 80% and to reduce the size per snapshot.
Related Issue:
#309
Summary:
DependencyManagementPane
folder (see discussion below for more details)renderProps
support--verbose=false
option in the test script enablesconsole.log
during test (I'd like to add it as it's quite handy to log some stuff - no need to start a debug seesion in VS code)AddDependencySearchResult.test.js
how to limit a snapshot. I'll setup linting in a separate PR.Discussion
DeleteDependencyButton
,DependencyDetailsTable
&DependencyInfoFromNpm
would also fit into that folder but I'm not sure. Is there a way to see where components are used so I could see if theses where also used at other locations? I moved the components to DependencyManagementPane folder to have a better grouping and I think these components are only used there - so it's OK to do the grouping.__tests__
folder? Same question as inCreateNewProjectWizard
PR. Should we move all tests into a subdirectory if there are many tests in a folder e.g. more than 2 tests? (Would probably reduce some noise)