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

jest startup performance #292

Closed
dylbarne opened this issue Jan 27, 2021 · 2 comments
Closed

jest startup performance #292

dylbarne opened this issue Jan 27, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@dylbarne
Copy link

Your environment

OS : Windows 10
Node.js version : v14.15.4
suitecloud-cli version : 1.1.2
Terminal/CMD tool : VSCodeTerminal

Describe the bug

running simple included jest test is quite slow, takes ~2.5-3 seconds (seems mainly just to startup of jest/runner itself, however the actual test execution is performed very quickly)
Started looking further into jest docs & issue, seems similar to described here: jestjs/jest#7963
Seems adding Jest Config option of testEnvironment change to 'node' improves performance by ~1.5 seconds

To Reproduce

Steps to reproduce the behavior:

  1. Use suitecloud project:create command to create new SDF Project
  2. Run npm run test to execute jest tests, in context of SDF Project
  3. Observe slow performance
  4. Add testEnvironment : 'node' to exports of jest.config.js https://jestjs.io/docs/en/configuration#testenvironment-string
  5. Observe that performance increases

Actual Behavior

Performance is slow due to default testEnvironment including jsdom components, which should not be needed for SuiteScript testing? There may be other CLI or Config flags to also boost performance (admittedly I am not familiar with jest unit testing much at all, the testEnvironment just seemed like a simple one to verify)

Expected Behavior

Any Config or CLI options that are relevant for SuiteScript Unit Testing would ideally be included in this suitecloud unit-testing package (either coming from SuiteCloudJestConfiguration.build() automatically, or perhaps even just a suggestion in Unit Testing README of relevant additional flags to be added.

@dylbarne dylbarne added the bug Something isn't working label Jan 27, 2021
@alisyed-19
Copy link
Member

@dylbarne Thanks for the suggestions, we will investigate it further and will keep you updated. Thanks

@dylbarne
Copy link
Author

dylbarne commented Nov 7, 2021

I believe this can be closed, since as of Jest v27 now default testEnvironment is node
https://jestjs.io/blog/2021/05/25/jest-27#flipping-defaults

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants