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

Travis CI slow execution + array.includes is not a function #1524

Closed
alansouzati opened this Issue Aug 31, 2016 · 8 comments

Comments

Projects
None yet
8 participants
@alansouzati
Contributor

alansouzati commented Aug 31, 2016

https://travis-ci.org/grommet/grommet/builds/156392643#L1757

In my recent build for Grommet using Jest (:yay) I noticed the following console error:

ERROR: TypeError: config.coverageReporters.includes is not a function
        STACK: TypeError: config.coverageReporters.includes is not a function
    at CoverageReporter.onRunComplete (/home/travis/build/grommet/grommet/node_modules/jest-cli/build/reporters/CoverageReporter.js:70:33)
    at /home/travis/build/grommet/grommet/node_modules/jest-cli/build/TestRunner.js:441:14
    at Array.forEach (native)
    at ReporterDispatcher.onRunComplete (/home/travis/build/grommet/grommet/node_modules/jest-cli/build/TestRunner.js:440:21)
    at /home/travis/build/grommet/grommet/node_modules/jest-cli/build/TestRunner.js:220:33
    at process._tickCallback (internal/process/next_tick.js:103:7)

Maybe we can replace includes by indexOf to avoid compatibility issues?

If you guys agree I can send a PR for that, otherwise what would be the recommended fix for this?

On a side note, I've noticed that my tests are taking a significantly longer time to execute in Travis when comparing to my local system. Is that expected?

This travis job is configured to use Node 5 and Jest test branch.

@aaronabramov

This comment has been minimized.

Show comment
Hide comment
@aaronabramov

aaronabramov Aug 31, 2016

Member

oh yeah. includes is not available everywhere. indexOf should be totally fine! :)

and travis is significantly slow yes. it is .really. slow :) especially if comparing to macbook pro

Member

aaronabramov commented Aug 31, 2016

oh yeah. includes is not available everywhere. indexOf should be totally fine! :)

and travis is significantly slow yes. it is .really. slow :) especially if comparing to macbook pro

@Daniel15

This comment has been minimized.

Show comment
Hide comment
@Daniel15

Daniel15 Aug 31, 2016

Member

Are you using the free version of Travis, or the paid version? The free version is pretty resource-limited, so slowness is expected. The paid version has much more CPU power available.

This travis job is configured to use Node 5

As a side note - Node v5 is EOL... v4 is the LTS release and v6 is the 'current' release. You should switch to either v4 or v6 depending on whether you want a release with long-term support (v4) or a release with the latest features (v6)

Member

Daniel15 commented Aug 31, 2016

Are you using the free version of Travis, or the paid version? The free version is pretty resource-limited, so slowness is expected. The paid version has much more CPU power available.

This travis job is configured to use Node 5

As a side note - Node v5 is EOL... v4 is the LTS release and v6 is the 'current' release. You should switch to either v4 or v6 depending on whether you want a release with long-term support (v4) or a release with the latest features (v6)

@alansouzati

This comment has been minimized.

Show comment
Hide comment
@alansouzati

alansouzati Aug 31, 2016

Contributor

Thanks for the heads up on v5, I will make sure to update it. I'm not worried about being slow, just wanted to make sure I was not doing anything wrong.

I'm going to work on the PR for the includes issues

Contributor

alansouzati commented Aug 31, 2016

Thanks for the heads up on v5, I will make sure to update it. I'm not worried about being slow, just wanted to make sure I was not doing anything wrong.

I'm going to work on the PR for the includes issues

@cpojer

This comment has been minimized.

Show comment
Hide comment
@cpojer

cpojer Aug 31, 2016

Contributor

I'm fixing the includes issue.

Contributor

cpojer commented Aug 31, 2016

I'm fixing the includes issue.

@cpojer cpojer closed this Aug 31, 2016

@eddywashere

This comment has been minimized.

Show comment
Hide comment
@eddywashere

eddywashere Nov 14, 2016

Re: Travis Slow execution, I found that using the --runInBand helps in an environment with limited resources.

eddywashere commented Nov 14, 2016

Re: Travis Slow execution, I found that using the --runInBand helps in an environment with limited resources.

@mareksuscak

This comment has been minimized.

Show comment
Hide comment
@mareksuscak

mareksuscak Nov 22, 2016

Contributor

Just FYI: Tests on Circle CI were extremely slow too in our case. 4s on local machine vs more than 90 seconds on CircleCI. Using --runInBand switch reduced it to 45s which is 50% improvement.

Contributor

mareksuscak commented Nov 22, 2016

Just FYI: Tests on Circle CI were extremely slow too in our case. 4s on local machine vs more than 90 seconds on CircleCI. Using --runInBand switch reduced it to 45s which is 50% improvement.

@kentcdodds

This comment has been minimized.

Show comment
Hide comment
@kentcdodds

kentcdodds Feb 2, 2017

Contributor

I can verify that --runInBand took our tests from >1.5 hours (actually I don't know how long because Jenkins timed out at 1.5 hours) to around 4 minutes. 😱 (Note: we have really poor resources for our build server)

Contributor

kentcdodds commented Feb 2, 2017

I can verify that --runInBand took our tests from >1.5 hours (actually I don't know how long because Jenkins timed out at 1.5 hours) to around 4 minutes. 😱 (Note: we have really poor resources for our build server)

@rrcobb

This comment has been minimized.

Show comment
Hide comment
@rrcobb

rrcobb Jul 7, 2017

We probably have memory leaks in our tests, but another helpful fix for running specs in docker was the node flag --max_old_space_size.

karma (running in an x-window for the sake of running headless Chrome), for comparison:

$ time xvfb-run node --max_old_space_size=4096 ./node_modules/.bin/karma start --browsers Chrome_without_sandbox
...
real    2m8.409s
user    1m37.480s
sys     0m14.380s

jest with max_old_space_size only

$ time node --max_old_space_size=4096 ./node_modules/.bin/jest spec/javascripts
...
real    3m54.833s
user    3m4.110s
sys     0m23.450s

jest with --runInBand only

$ time node ./node_modules/.bin/jest spec/javascripts --runInBand
...
(crashes with a GC error)

jest with both --runInBand and --max_old_space_size

$ time node --max_old_space_size=4096 ./node_modules/.bin/jest spec/javascripts --runInBand
...

real    3m40.529s
user    2m48.980s
sys     0m22.580s

Our speed would probably be helped most by addressing memory leaks, but wanted to leave the trail in case someone else found it useful.

rrcobb commented Jul 7, 2017

We probably have memory leaks in our tests, but another helpful fix for running specs in docker was the node flag --max_old_space_size.

karma (running in an x-window for the sake of running headless Chrome), for comparison:

$ time xvfb-run node --max_old_space_size=4096 ./node_modules/.bin/karma start --browsers Chrome_without_sandbox
...
real    2m8.409s
user    1m37.480s
sys     0m14.380s

jest with max_old_space_size only

$ time node --max_old_space_size=4096 ./node_modules/.bin/jest spec/javascripts
...
real    3m54.833s
user    3m4.110s
sys     0m23.450s

jest with --runInBand only

$ time node ./node_modules/.bin/jest spec/javascripts --runInBand
...
(crashes with a GC error)

jest with both --runInBand and --max_old_space_size

$ time node --max_old_space_size=4096 ./node_modules/.bin/jest spec/javascripts --runInBand
...

real    3m40.529s
user    2m48.980s
sys     0m22.580s

Our speed would probably be helped most by addressing memory leaks, but wanted to leave the trail in case someone else found it useful.

10xjs added a commit to metalabdesign/bootstart-web that referenced this issue Feb 9, 2018

Use jest for unit tests
Jest has the best online support resources of any test runner and is more-or-lest the standard choice alongside flow and eslint.

The `runInBand` and `coverage` options are enabled by detecting that we are running in a CI environment. (Travis sets `CI=true`: https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables)

Jest runs _much_ better on travis with the `runInBand` enabled (see: facebook/jest#1524 (comment)).

10xjs added a commit to metalabdesign/bootstart-web that referenced this issue Feb 9, 2018

Use jest for unit tests
Jest has the best online support resources of any test runner and is more-or-lest the standard choice alongside flow and eslint.

The `runInBand` and `coverage` options are enabled by detecting that we are running in a CI environment. (Travis sets `CI=true`: https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables)

Jest runs _much_ better on travis with the `runInBand` enabled (see: facebook/jest#1524 (comment)).

10xjs added a commit to metalabdesign/bootstart-web that referenced this issue Feb 9, 2018

Use jest for unit tests
Jest has the best online support resources of any test runner and is more-or-lest the standard choice alongside flow and eslint.

The `runInBand` and `coverage` options are enabled by detecting that we are running in a CI environment. (Travis sets `CI=true`: https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables)

Jest runs _much_ better on travis with the `runInBand` enabled (see: facebook/jest#1524 (comment)).

10xjs added a commit to metalabdesign/bootstart-web that referenced this issue Feb 9, 2018

Use jest for unit tests
Jest has the best online support resources of any test runner and is more-or-less the standard choice alongside flow and eslint.

The `runInBand` and `coverage` options are enabled by detecting that we are running in a CI environment. (Travis sets `CI=true`: https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables)

Jest runs _much_ better on travis with the `runInBand` enabled (see: facebook/jest#1524 (comment)).

@dan1elhughes dan1elhughes referenced this issue Mar 19, 2018

Merged

Run jest unit tests in band on ci #128

1 of 1 task complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment