Skip to content

Do not start Cypress on prebuild if not enabled #312

Open
@cesarvarela

Description

@cesarvarela

I have a build that keeps "randomly" crashing when running it alongside Cypress. One thing I've noticed is that even when I have the plugin configured to run on postBuild, Cypress is started on preBuild, leaving less memory for the build process.

This is our netlify.toml:

[build.environment]
CYPRESS_CACHE_FOLDER = "./node_modules/CypressBinary"
TERM = "xterm"

[[plugins]]
 package = "@netlify/plugin-gatsby"

[[plugins]]
 package = "netlify-plugin-cypress"
 [plugins.inputs]
   enable = false
 [plugins.inputs.postBuild]
   record = true
   enable = true
   spa = true
   start = 'gatsby serve -p 8080'

And this is the build log:

3:20:22 PM: ​
3:20:22 PM: ────────────────────────────────────────────────────────────────
3:20:22 PM:   2. netlify-plugin-cypress (onPreBuild event)                  
3:20:22 PM: ────────────────────────────────────────────────────────────────
3:20:22 PM: ​
3:20:23 PM: [STARTED] Task without title.
3:20:24 PM: [SUCCESS] Task without title.
3:20:26 PM: [3820:0928/182026.128392:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.
3:20:26 PM: Displaying Cypress info...
3:20:26 PM: Detected no known browsers installed
3:20:26 PM: Proxy Settings: none detected
3:20:26 PM: Environment Variables:
3:20:26 PM: CYPRESS_RECORD_KEY: <redacted>
3:20:26 PM: CYPRESS_CACHE_FOLDER: ./node_modules/CypressBinary
3:20:26 PM: CYPRESS_PROJECT_ID: 1w1vze
3:20:26 PM: Application Data: /opt/buildhome/.config/cypress/cy/development
3:20:26 PM: Browser Profiles: /opt/buildhome/.config/cypress/cy/development/browsers
3:20:26 PM: Binary Caches: /opt/build/repo/site/gatsby-site/node_modules/CypressBinary
3:20:26 PM: Cypress Version: 10.8.0 (stable)
3:20:26 PM: System Platform: linux (Ubuntu - 20.04)
3:20:26 PM: System Memory: 66.1 GB free 59.1 GB
3:20:26 PM: ​
3:20:26 PM: (netlify-plugin-cypress onPreBuild completed in 3.8s)
3:20:26 PM: ​
3:20:26 PM: ────────────────────────────────────────────────────────────────
3:20:26 PM:   3. Build command from Netlify app                             
3:20:26 PM: ────────────────────────────────────────────────────────────────
3:20:26 PM: ​
3:20:26 PM: $ gatsby build
3:20:28 PM: success compile gatsby files - 0.960s
3:20:29 PM: success load gatsby config - 0.190s
3:20:30 PM: success load plugins - 1.479s
3:20:30 PM: warning gatsby-plugin-react-helmet: Gatsby now has built-in support for modifying the document head. Learn more at https://gatsby.dev/gatsby-head

Cypress is started but is not used until the build finishes, I think it would make sense to start it when it is actually enabled, which is the postBuild step.

This is the complete log: https://app.netlify.com/sites/aiid/deploys/633490029dfb6400080b80ac

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions