Skip to content
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

DCOS_OSS-2185: Upgrade jest #2783

Merged
merged 14 commits into from
Mar 7, 2018
Merged

Conversation

DanielMSchmidt
Copy link
Contributor

@DanielMSchmidt DanielMSchmidt commented Feb 21, 2018

Impact:

The max MB used as a heap are 476MB 👍 This means smaller CI nodes for us

ToDos

  • Update jest version and get jest to execute something
  • Jest has an issue with this.foo in tests, a jscodeshift is work in progress
  • RouterUtil-test depends hard on the location, which seems to be not settable anymore. I would like to change the API and use window.location. ... as a default value to make this easier testable
  • ReducerUtil-test.js fails to a "valid" reason, needs more investigation
  • PackageDetailTab-test.js fails due to transition from jests two argument expect to only one argument being supported (removing the second doesn't work, seems like it was the this or sth?)
  • advanceTimersByTime does not properly move the time forward in MetronomeStore-test
  • We skip this kind of fails and address it in DCOS_OSS-2206/DCOS_OSS-2206: Enzyme #2798 Authenticated-test fails due to findAllInRenderedTree: instance must be a composite component
  • try to change root path so I can cmd+click on failing tests to open them from the terminal
  • Read through changelog and find nice jest features we might enable by now
  • Measure memory consumption

Checklist

  • Did you add a JIRA issue in a commit message or as part of the branch name?
  • Did you add new unit tests?
  • Did you add new integration tests?
  • If this is a regression, did you write a test to catch this in the future?

@d2iq-mergebot
Copy link

This repo has @mesosphere-mergebot integration. You can interact with the following commands.

@mesosphere-mergebot ship-it  
@mesosphere-mergebot integrate  
@mesosphere-mergebot test  

@DanielMSchmidt DanielMSchmidt changed the base branch from master to danielschmidt/upgrade-node February 26, 2018 14:42
@DanielMSchmidt DanielMSchmidt force-pushed the danielmschmidt/upgrade-jest branch 2 times, most recently from ee935a5 to 14c1330 Compare February 26, 2018 14:48
@DanielMSchmidt DanielMSchmidt changed the title Upgrade jest DCOS_OSS-2185: Upgrade jest Feb 27, 2018
@DanielMSchmidt DanielMSchmidt force-pushed the danielschmidt/upgrade-node branch 2 times, most recently from f0537bb to af40809 Compare February 27, 2018 13:14
@DanielMSchmidt DanielMSchmidt force-pushed the danielmschmidt/upgrade-jest branch 3 times, most recently from 62bb818 to f870618 Compare February 28, 2018 09:29
@DanielMSchmidt DanielMSchmidt force-pushed the danielmschmidt/upgrade-jest branch 4 times, most recently from 1636a0a to 366d9e2 Compare March 1, 2018 14:59
Daniel Schmidt added 11 commits March 1, 2018 16:22
This is needed as the updated jest version does not allow this anymore:
jestjs/jest#3970

This jscodeshift did the change together with an eslint --fix
https://gist.github.com/DanielMSchmidt/9e1bc548ab5d8d1a3fadddc2d735f8c2

DCOS_OSS-2185
This jest version does not allow contexts

DCOS_OSS-2185
The codemod run earlier didn't catch this case

DCOS_OSS-2185
Using this is okay in this case

Relates to DCOS_OSS-2185
The second argument of expect would set some context.
This refactoring uses call directly

Relates to DCOS_OSS-2185
jasmine.clock().tick() worked differently, with jest we need to reset

Relates to DCOS_OSS-2185
It works fine when we switch to enzyme, so I created
https://jira.mesosphere.com/browse/DCOS_OSS-2206 to keep track of
the move to enzyme

Relates to DCOS_OSS-2206 & DCOS_OSS-2185
By changing this we can use cmd+click to open up the tests from the
terminal.

Relates to DCOS_OSS-2185
Fabs
Fabs previously requested changes Mar 1, 2018
@@ -9,7 +9,7 @@ import TaskFileViewer from "../TaskFileViewer";

let thisContainer, thisInstance;

describe("TaskFileViewer", function() {
describe.skip("TaskFileViewer", function() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should expend 1hr here trying to have it not skippable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did you get to do this yet?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not yet, but will have some time later today. A Will do it or unblock it.

Jenkinsfile Outdated
@@ -51,7 +51,23 @@ pipeline {
stage('Unit Test') {
steps {
ansiColor('xterm') {
sh '''npm run test -- --maxWorkers=2'''
sh '''npm run test -- --maxWorkers=2 --coverage'''
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we move it to another PR so we make sure that this does not get too many resources, or that it really works independently?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I openend this PR: #2801

@@ -56,7 +56,7 @@ var config = {
moduleFileExtensions: ["js", "json", "es6"],
modulePathIgnorePatterns: ["/tmp/", "/node_modules/", "/.module-cache/"],
timers: "fake",
coverageReporters: ["json", "lcov", "cobertura", "text"],
coverageReporters: ["cobertura"],
Copy link
Contributor

Choose a reason for hiding this comment

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

If you move the previous commit, you have to move this too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#2801 is the PR for this now

@Fabs Fabs self-assigned this Mar 1, 2018
@DanielMSchmidt
Copy link
Contributor Author

He @Fabs Could you review again? :)

@Fabs
Copy link
Contributor

Fabs commented Mar 2, 2018

I ran:

  • nvm install
  • npm install
  • npm run build-shrinkwrap (because I had changes there)

And I was left with some jest untracked files and changes to npm-shrink-wrap.
image

https://gist.github.com/Fabs/e158d9b8031e7a3e16b5bec8f55a9eb3

@Fabs
Copy link
Contributor

Fabs commented Mar 2, 2018

I think I have to run with the respective private branch.
https://github.com/mesosphere/dcos-ui-plugins-private/pull/757

@DanielMSchmidt
Copy link
Contributor Author

@Fabs the untracked file is because you already had a jest/config.json. It is in this PR called jest.config.json, you need to delete the old one.

For the shrinkwrap, they can change with time, because dependencies of dependencies might change

After changing the tests to not use the 'this' keyword
we had some unused variables that we skipped linting. This
commit cleans up this by effectively removing those variables.
@Fabs Fabs force-pushed the danielmschmidt/upgrade-jest branch from d2d517c to d7c03f1 Compare March 5, 2018 10:39
Fixed vartiable declarations and import ReactDOM
@Fabs Fabs dismissed their stale review March 5, 2018 14:54

Have made changes myself.

Copy link
Contributor

@Fabs Fabs left a comment

Choose a reason for hiding this comment

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

I approve daniel work, but I added some commits myself, so maybe lets aim for 3 approvals?

Copy link
Contributor

@ahoskins ahoskins left a comment

Choose a reason for hiding this comment

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

Ran locally and looked over code 🚢

@juliangieseke juliangieseke changed the base branch from danielschmidt/upgrade-node to master March 7, 2018 09:41
@DanielMSchmidt DanielMSchmidt merged commit dc48628 into master Mar 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants