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

Tests time increased after adding libraries #505

Open
UnleashSpirit opened this issue Aug 2, 2023 · 0 comments
Open

Tests time increased after adding libraries #505

UnleashSpirit opened this issue Aug 2, 2023 · 0 comments

Comments

@UnleashSpirit
Copy link

Hello,

I recently add the libs @testing-library/angular and @testing-library/jest-dom to an angular project.

We have ~870 tests that take ~2min to be executed
After adding thoses libraries, the time goes up to 3min every time, I test it multiple times and still 3min.
I have only 4 tests with expect(getByTestId(document.documentElement, 'button')).toContainHTML('todo') or expect(queryByTestId(document.documentElement, 'button')).not.toBeInTheDocument();

I change the configuration to use the libraries :

tsconfig.spec.json
/* add "@testing-library/jest-dom" and "jest-setup.ts" */

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "module": "commonjs",
    "outDir": "./out-tsc/spec",
    "types": ["jest", "node", "@testing-library/jest-dom"]
  },
  "files": ["src/polyfills.ts"],
  "include": ["src/**/*.spec.ts", "src/**/*.d.ts", "jest-setup.ts"]
}
// jest-setup.ts

import '@testing-library/jest-dom';
import 'jest-preset-angular/setup-jest';

Tests are runned with : node --expose-gc ./node_modules/jest/bin/jest.js --maxWorkers=50% --logHeapUsage -c=jest.config.ts

Versions used :
"@angular/*": "^14.2.9",
"jest": "^29.2.2",
"jest-preset-angular": "^12.2.0",
"@testing-library/angular": "^14.2.0",
"@testing-library/jest-dom": "^5.17.0",

Did I miss something or misconfigured ? Or does the increased time seem normal to you ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant