Skip to content

Snapshotting still occurs when numTestsKeptInMemory is 0 #4104

Closed
@CoryDanielson

Description

@CoryDanielson
Contributor

Current behavior:

When running cypress in GUI mode with numTestsKeptInMemory set to 0, snapshotting still occurs even though none of them should be kept in memory. This has a negative impact on performance and memory consumption.

In this screenshot, you can see that numTestsKeptInMemory is 0, but 5 seconds is spent taking snapshots that will not be used.

Screen Shot 2019-05-03 at 12 35 28 PM

In this screenshot you can see where the majority of the snapshot execution took place, 3.4s converting rules from large stylesheets into a string, and 0.4s replacing URLs in those strings with absolute paths.

Screen Shot 2019-05-03 at 12 40 53 PM

Desired behavior:

When running with numTestsKeptInMemory set to 0, snapshotting should be avoided in the same way that occurs while running in headless mode.

Steps to reproduce:

  1. Set numTestsKeptInMemory to 0.
  2. Run cypress GUI mode.

Versions

Cypress: 3.2.0
Chrome: Chrome 74

Activity

jennifer-shehane

jennifer-shehane commented on May 3, 2019

@jennifer-shehane
Member

Hey @CoryDanielson, can you take a look at your resolved configuration and confirm that the numTestsKeptInMemory configuration is being read as set to 0? https://on.cypress.io/configuration#Resolved-Configuration

CoryDanielson

CoryDanielson commented on May 3, 2019

@CoryDanielson
ContributorAuthor

@jennifer-shehane I updated the original post with new screenshots.

CoryDanielson

CoryDanielson commented on May 3, 2019

@CoryDanielson
ContributorAuthor

I opened up a PR to address this #4123

I extended the if statement to include a check for numTestsKeptInMemory

    snapshot: (name, options = {}) ->
      ## bail early and dont snapshot
      ## if we're in headless mode
      ## TODO: fix this
      if not config("isInteractive") || _.toString(config("numTestsKeptInMemory")) is '0'
        return @
brian-mann

brian-mann commented on May 17, 2019

@brian-mann
Member

I'll take this PR from here and we'll get it out in the next patch release or so.

9 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @brian-mann@jennifer-shehane@CoryDanielson

      Issue actions

        Snapshotting still occurs when numTestsKeptInMemory is 0 · Issue #4104 · cypress-io/cypress