Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Eliminate yarn test spam #1024

Merged
merged 13 commits into from
Apr 3, 2018
Merged

Eliminate yarn test spam #1024

merged 13 commits into from
Apr 3, 2018

Conversation

lieut-data
Copy link
Member

Summary

Finding it hard to iterate on webapp unit tests when there's so many console logs and warnings scrolling by. This set of commits eliminates them -- comments below where it's not obvious how or why.

It also adds a global override on console.(log|warn|error) to throw an Error and prevent future such issues.

Ticket Link

None.

Checklist

  • Ran make check-style to check for style errors (required for all pull requests)
  • Ran make test to ensure unit and component tests passed
  • Added or updated unit tests (required for all new features)

@@ -200,6 +200,7 @@ class ProfilePopover extends React.Component {
delete popoverProps.hasMention;
delete popoverProps.dispatch;
delete popoverProps.enableWebrtc;
delete popoverProps.showEmailAddress;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Injected by the connector but wasn't removed, like enableWebrtc, and ended up incorrectly as a DOM property.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are not using showEmailAddress at all, so, the solution would be remove that from the connect function.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh, I like that better -- somehow, I thought this was being passed in via a plugin, but you're right that it's only part of the pluggable unit tests.

@@ -76,12 +76,12 @@ export default class Sidebar extends React.PureComponent {
/**
* Current team object
*/
currentTeam: PropTypes.object.isRequired,
currentTeam: PropTypes.object,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code handles these not being present.

@@ -88,6 +88,7 @@
"image-webpack-loader": "3.6.0",
"imports-loader": "0.7.1",
"jest": "22.1.4",
"jest-canvas-mock": "1.0.2",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that the doughtnut chart doesn't throw errors about getContext not being defined.

@@ -73,7 +73,7 @@ export default function configureStore(initialState) {
const storage = localforage;
const KEY_PREFIX = 'reduxPersist:';

localforage.ready(() => {
localforage.ready().then(() => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See localForage/localForage#722 for more details.

store/index.js Outdated
@@ -135,6 +135,11 @@ export default function configureStore(initialState) {
});
}
});
}).catch((error) => {
store.dispatch({
type: General.STORE_REHYDRATION_FAILED,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've got a pending PR to add this constant to mattermost-redux... if we think we need it. No one is going to handle it right now. Feedback requested!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if I prefer simply a log message for now. Anyway, I think it must be in the webapp redux flow, not in the mattermost-redux one. Because all the storage thing is handle independently from RN app and webapp.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll move the constant locally -- the log message would defeat the point of this change, at present ;P

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hahaha, you are completely right, I'm an idiot :)

@@ -10,8 +10,18 @@ describe('components/channel_notifications_modal/ChannelNotificationsModal', ()
show: true,
onHide: () => {}, //eslint-disable-line no-empty-function
channel: {id: 'channel_id', display_name: 'channel_display_name'},
channelMember: {notify_props: {desktop: NotificationLevels.ALL}},
currentUser: {id: 'current_user_id', notify_props: {desktop: NotificationLevels.ALL}},
channelMember: {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required props.

@@ -20,3 +20,15 @@ Object.defineProperty(document, 'queryCommandSupported', {
Object.defineProperty(document, 'execCommand', {
value: (cmd) => supportedCommands.includes(cmd),
});

beforeEach(() => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't let this regress in the future.

@@ -8,7 +8,6 @@ const MIN_NETWORK_RETRY_TIME = 3000; // 3 sec
const MAX_NETWORK_RETRY_TIME = 300000; // 5 mins

function handle(callback, online) {
console.log('Network status set to ' + online); //eslint-disable-line no-console
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked with author: no longer needed.

@@ -9,8 +9,6 @@ export function getPrefix(state) {
}
}

console.warn('Storage tried to operate without user present'); //eslint-disable-line no-console
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked with author: no longer needed.

@jwilander jwilander added the 2: Dev Review Requires review by a core commiter label Mar 28, 2018
Copy link
Member

@jespino jespino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we must remove the showEmailAddress property. The other comment related to REHYDRATATION, I'm ok with your proposed solution (in mattermost-webapp, not in mattermost-redux).

@enahum
Copy link
Contributor

enahum commented Apr 3, 2018

Agree with @jespino

@lieut-data
Copy link
Member Author

Done, thanks @jespino and @enahum :)

Copy link
Member

@jespino jespino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@lieut-data
Copy link
Member Author

Hmm, I'm confused -- not seeing these test failures locally, nor in the previous build. I'll investigate.

@lieut-data
Copy link
Member Author

Looks like just some recent regressions on exactly this front, now also fixed. Going forward, this will be caught by individual developers.

@lieut-data lieut-data merged commit 61e2433 into master Apr 3, 2018
@lieut-data lieut-data deleted the eliminate-yarn-test-spam branch April 3, 2018 14:02
@amyblais amyblais added Changelog/Not Needed Does not require a changelog entry Docs/Not Needed Does not require documentation labels Apr 3, 2018
@lindalumitchell lindalumitchell added the Tests/Not Needed Does not require new release tests label Apr 5, 2018
hmhealey pushed a commit that referenced this pull request Aug 28, 2020
#1024)

* MM-21290: Checks for license AND config prior to overriding user's display name account setting.

* MM-21290: Adds license to mock.
hmhealey pushed a commit that referenced this pull request Mar 17, 2021
#1024)

* MM-21290: Checks for license AND config prior to overriding user's display name account setting.

* MM-21290: Adds license to mock.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
2: Dev Review Requires review by a core commiter Changelog/Not Needed Does not require a changelog entry Docs/Not Needed Does not require documentation Tests/Not Needed Does not require new release tests
Projects
None yet
6 participants