0

I'm running 60 E2E tests with Jest and Puppeteer on an EC2 Jenkins slave. Tests' times ranging between 7-90 seconds, averaged at 24 seconds - meaning total time when running sequentially ~24-25 min. When running jest -w 10 it runs 10 tests in parallel but every test takes longer and the time is resembles jest --runInBand both finish at about 24-26 min.

I read this and related links, and so changed the machine I'm running on to r5ad.12xlarge (48 cores, 384 GB!) because of the assumption of limited resources and still no effect on the total running time. More attempts I made:

  • Tried with and without --ci --detectOpenHandles, still nothing.
  • NODE_OPTIONS=--max_old_space_size=4096 didn't change it either.
  • Ran with default, 2, 3, 9, 15... workers.
  • Checked heap usage with node --expose-gc ./node_modules/.bin/jest --runInBand --logHeapUsage and saw some leak - heap usage gradually increased from ~100MB to 1100MB
  • Tried running locally on the machine (without Jenkins restrictions on resources if any...)

My question is if I'm missing something (a flag, Jenkins agent policy)? Maybe I should try a different test runner for the purpose of E2E because jest is aimed more at unit testing?

Moshisho
  • 2,781
  • 1
  • 23
  • 39

1 Answers1

0

After a couple more attempts, I figured out the main problems:

  1. There's a bug in Jenkins when you update the defaultValue in pipeline it only takes effect after another build. So removing --detectOpenHandles made my build long even after removing it. Plus, it made the results were hard to follow.
  2. Jest really depends on the number of cores available, so I changed the machine to a c5.4xlarge with 16 vCPUs and that also made a big difference. My fine tune was to set --maxWorkers=33% because our web app also runs on the same machine.

Hope this helps someone.

Moshisho
  • 2,781
  • 1
  • 23
  • 39