Tests time increased after adding libraries
UnleashSpirit opened this issue · comments
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 ?