Does anyone have any suggestions for debugging spe...
# help
Does anyone have any suggestions for debugging spec files that take an extremely long time (up to 2 minutes!) to load/compile and often lock up my machine during initial loading? I think the root cause is too many JS imports AND/OR a suspicious helper class that's full of interdependent functions and re-used variable names. Spec files with fewer imports (that also happen to not import the suspicious helper class) load very quickly and don't cause machine lockups. If it helps, sometimes these slow-compiling spec fails fail quickly with a maximum call stack size exceeded error ( .
Here's a sample of the import statements at the top of a slow-loading spec file:
Copy code
import { checkoutPage } from '../../support/page-objects/pages/checkoutPage'
import { header } from '../../support/page-objects/components/header'
import { addToBasket } from '../../support/page-objects/components/addToBasket'
import { basketPage } from '../../support/page-objects/pages/basketPage'
import { dbhelper } from '../../support/db.helper'
import { loginPage } from '../../support/page-objects/pages/account/loginPage'
import { onlyOn, skipOn } from '@cypress/skip-test'
import { UserBuilder } from '../../support/builder/user.builder'
import { SuiteTag } from '../../support/enums/suiteTag'
import { customerAPI } from '../../support/api/endpoints/customer'
import { FeatureFlag } from '../../../../src/config/constants/feature-flags'
import { AccountType } from '../../support/enums/accountType'
import { getErrorMessage } from '../../support/helper'
const faker = require('faker')
The only other relevant plugin not mentioned above is the cypress-tags plugin, which is imported in the
And the suspicious helper class is a DB query builder + executor that has objects for building each type of query, which depend on objects in the same class that actually execute the queries in postgres.