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

fix: cleanup files made by the tmp library in cypress.run() #24957

Merged
merged 4 commits into from
Dec 8, 2022
Merged

fix: cleanup files made by the tmp library in cypress.run() #24957

merged 4 commits into from
Dec 8, 2022

Conversation

alexsch01
Copy link
Contributor

@alexsch01 alexsch01 commented Dec 4, 2022

Without this PR, tmp files (in format "tmp-dynamicNum-dynamicString") made by the cypress.run() function will exist in the OS temp directory forever. I am using setGracefulCleanup by the tmp library

I have an example project on Linux here to showcase the default behavior: https://github.com/alexsch01/exampleForIssue

Let me know if you have any concerns

  • Closes

User facing changelog

Additional details

Steps to test

How has the user experience changed?

PR Tasks

  • Have tests been added/updated?
  • Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • Has a PR for user-facing changes been opened in cypress-documentation?
  • Have API changes been updated in the type definitions?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Dec 4, 2022

Thanks for taking the time to open a PR!

@alexsch01
Copy link
Contributor Author

However, it would be nice if we didn't need to use temp files for this purpose.

@cypress
Copy link

cypress bot commented Dec 4, 2022



Test summary

24842 0 2490 0Flakiness 20


Run details

Project cypress
Status Passed
Commit 5c21f00
Started Dec 4, 2022 12:36 AM
Ended Dec 4, 2022 12:53 AM
Duration 17:19 💡
OS Linux Debian -
Browser Multiple

View run in Cypress Dashboard ➡️


Flakiness

cypress/e2e/e2e/origin/cookie_behavior.cy.ts Flakiness
1 ... > same site / cross origin > XMLHttpRequest > sets cookie on same-site request if withCredentials is true, and attaches to same-site request if withCredentials is true
2 ... > same site / cross origin > fetch > sets same-site cookies if "include" credentials option is specified from request, but does not attach same-site cookies to request by default (same-origin)
3 ... > same site / cross origin > XMLHttpRequest > sets cookie on same-site request if withCredentials is true, and attaches to same-site request if withCredentials is true
4 ... > same site / cross origin > fetch > sets same-site cookies if "include" credentials option is specified from request, but does not attach same-site cookies to request by default (same-origin)
5 ... > same site / cross origin > XMLHttpRequest > sets cookie on same-site request if withCredentials is true, and attaches to same-site request if withCredentials is true
This comment includes only the first 5 flaky tests. See all 20 flaky tests in the Cypress Dashboard.

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@alexsch01
Copy link
Contributor Author

alexsch01 commented Dec 4, 2022

Where in the cypress code is it generating this (relative to the cypress.run() function)?

{"status":"finished","startedTestsAt":"2022-12-04T16:25:58.105Z","endedTestsAt":"2022-12-04T16:25:58.105Z","totalDuration":0,"totalSuites":1,"totalTests":0,"totalPassed":0,"totalPending":0,"totalFailed":0,"totalSkipped":0,"runs":[{"stats":{"suites":1,"tests":0,"passes":0,"pending":0,"skipped":0,"failures":0,"duration":0,"startedAt":"2022-12-04T16:25:58.105Z","endedAt":"2022-12-04T16:25:58.105Z"},"reporter":"spec","reporterStats":{"suites":0,"tests":0,"passes":0,"pending":0,"failures":0,"start":"2022-12-04T16:25:58.106Z","end":"2022-12-04T16:25:58.107Z","duration":1},"hooks":[],"tests":[],"error":null,"video":null,"spec":{"fileExtension":".js","baseName":"spec.cy.js","fileName":"spec","specFileExtension":".cy.js","relativeToCommonRoot":"spec.cy.js","specType":"integration","name":"cypress/e2e/spec.cy.js","relative":"cypress/e2e/spec.cy.js","absolute":"/home/alex/exampleForIssue/cypress/e2e/spec.cy.js"},"shouldUploadVideo":true}],"browserPath":"","browserName":"electron","browserVersion":"106.0.5249.51","osName":"linux","osVersion":"Debian - ","cypressVersion":"11.2.0","config":{"video":false,"setupNodeEvents":"[Function setupNodeEvents]","projectRoot":"/home/alex/exampleForIssue","projectName":"exampleForIssue","repoRoot":"/home/alex/exampleForIssue","rawJson":{"e2e":{"setupNodeEvents":"[Function setupNodeEvents]"},"video":false,"setupNodeEvents":"[Function setupNodeEvents]","envFile":{},"projectRoot":"/home/alex/exampleForIssue","projectName":"exampleForIssue","repoRoot":"/home/alex/exampleForIssue"},"configFile":"cypress.config.js","morgan":false,"isTextTerminal":true,"socketId":"181wskwqc0","report":true,"animationDistanceThreshold":5,"arch":"x64","baseUrl":null,"blockHosts":null,"chromeWebSecurity":true,"clientCertificates":[],"defaultCommandTimeout":4000,"downloadsFolder":"/home/alex/exampleForIssue/cypress/downloads","env":{},"execTimeout":60000,"experimentalFetchPolyfill":false,"experimentalInteractiveRunEvents":false,"experimentalRunAllSpecs":false,"experimentalSessionAndOrigin":false,"experimentalModifyObstructiveThirdPartyCode":false,"experimentalSourceRewriting":false,"experimentalSingleTabRunMode":false,"experimentalStudio":false,"experimentalWebKitSupport":false,"fileServerFolder":"/home/alex/exampleForIssue","fixturesFolder":"/home/alex/exampleForIssue/cypress/fixtures","excludeSpecPattern":"*.hot-update.js","includeShadowDom":false,"keystrokeDelay":0,"modifyObstructiveCode":true,"numTestsKeptInMemory":0,"platform":"linux","pageLoadTimeout":60000,"port":37561,"projectId":null,"redirectionLimit":20,"reporter":"spec","reporterOptions":null,"requestTimeout":5000,"resolvedNodePath":"/usr/bin/node","resolvedNodeVersion":"18.12.1","responseTimeout":30000,"retries":{"runMode":0,"openMode":0},"screenshotOnRunFailure":true,"screenshotsFolder":"/home/alex/exampleForIssue/cypress/screenshots","slowTestThreshold":10000,"scrollBehavior":"top","supportFile":"/home/alex/exampleForIssue/cypress/support/e2e.js","supportFolder":"/home/alex/exampleForIssue/cypress/support","taskTimeout":60000,"testIsolation":null,"trashAssetsBeforeRuns":true,"userAgent":null,"videoCompression":32,"videosFolder":"/home/alex/exampleForIssue/cypress/videos","videoUploadOnPasses":true,"viewportHeight":660,"viewportWidth":1000,"waitForAnimations":true,"watchForFileChanges":false,"specPattern":"cypress/e2e/**/*.cy.{js,jsx,ts,tsx}","additionalIgnorePattern":[],"autoOpen":false,"browsers":[{"name":"electron","channel":"stable","family":"chromium","displayName":"Electron","version":"106.0.5249.51","path":"","majorVersion":106}],"clientRoute":"/__/","cypressBinaryRoot":"/home/alex/.cache/Cypress/11.2.0/Cypress/resources/app","devServerPublicPathRoute":"/__cypress/src","hosts":null,"isInteractive":true,"namespace":"__cypress","reporterRoute":"/__cypress/reporter","socketIoCookie":"__socket","socketIoRoute":"/__socket","version":"11.2.0","xhrRoute":"/xhrs/","cypressEnv":"production","resolved":{"animationDistanceThreshold":{"value":5,"from":"default"},"arch":{"value":"x64","from":"default"},"baseUrl":{"value":null,"from":"default"},"blockHosts":{"value":null,"from":"default"},"chromeWebSecurity":{"value":true,"from":"default"},"clientCertificates":{"value":[],"from":"default"},"defaultCommandTimeout":{"value":4000,"from":"default"},"downloadsFolder":{"value":"cypress/downloads","from":"default"},"env":{},"execTimeout":{"value":60000,"from":"default"},"experimentalFetchPolyfill":{"value":false,"from":"default"},"experimentalInteractiveRunEvents":{"value":false,"from":"default"},"experimentalRunAllSpecs":{"value":false,"from":"default"},"experimentalSessionAndOrigin":{"value":false,"from":"default"},"experimentalModifyObstructiveThirdPartyCode":{"value":false,"from":"default"},"experimentalSourceRewriting":{"value":false,"from":"default"},"experimentalSingleTabRunMode":{"value":false,"from":"default"},"experimentalStudio":{"value":false,"from":"default"},"experimentalWebKitSupport":{"value":false,"from":"default"},"fileServerFolder":{"value":"","from":"default"},"fixturesFolder":{"value":"cypress/fixtures","from":"default"},"excludeSpecPattern":{"value":"*.hot-update.js","from":"default"},"includeShadowDom":{"value":false,"from":"default"},"keystrokeDelay":{"value":0,"from":"default"},"modifyObstructiveCode":{"value":true,"from":"default"},"nodeVersion":{"from":"default"},"numTestsKeptInMemory":{"value":0,"from":"config"},"platform":{"value":"linux","from":"default"},"pageLoadTimeout":{"value":60000,"from":"default"},"port":{"value":null,"from":"default"},"projectId":{"value":null,"from":"default"},"redirectionLimit":{"value":20,"from":"default"},"reporter":{"value":"spec","from":"default"},"reporterOptions":{"value":null,"from":"default"},"requestTimeout":{"value":5000,"from":"default"},"resolvedNodePath":{"value":null,"from":"default"},"resolvedNodeVersion":{"value":null,"from":"default"},"responseTimeout":{"value":30000,"from":"default"},"retries":{"value":{"runMode":0,"openMode":0},"from":"default"},"screenshotOnRunFailure":{"value":true,"from":"default"},"screenshotsFolder":{"value":"cypress/screenshots","from":"default"},"slowTestThreshold":{"value":10000,"from":"default"},"scrollBehavior":{"value":"top","from":"default"},"supportFile":{"value":"cypress/support/e2e.{js,jsx,ts,tsx}","from":"default"},"supportFolder":{"value":false,"from":"default"},"taskTimeout":{"value":60000,"from":"default"},"testIsolation":{"value":null,"from":"default"},"trashAssetsBeforeRuns":{"value":true,"from":"default"},"userAgent":{"value":null,"from":"default"},"video":{"value":false,"from":"config"},"videoCompression":{"value":32,"from":"default"},"videosFolder":{"value":"cypress/videos","from":"default"},"videoUploadOnPasses":{"value":true,"from":"default"},"viewportHeight":{"value":660,"from":"default"},"viewportWidth":{"value":1000,"from":"default"},"waitForAnimations":{"value":true,"from":"default"},"watchForFileChanges":{"value":false,"from":"config"},"specPattern":{"value":"cypress/e2e/**/*.cy.{js,jsx,ts,tsx}","from":"default"},"browsers":{"value":[{"name":"electron","channel":"stable","family":"chromium","displayName":"Electron","version":"106.0.5249.51","path":"","majorVersion":106,"isHeadless":true,"isHeaded":false}],"from":"runtime"},"hosts":{"value":null,"from":"default"},"isInteractive":{"value":true,"from":"default"}},"testingType":"e2e","remote":{"origin":"http://localhost:37561","strategy":"file","fileServer":"http://localhost:45171","domainName":"localhost","props":null},"browser":null,"specs":[],"proxyUrl":"http://localhost:37561","browserUrl":"http://localhost:37561/__/","reporterUrl":"http://localhost:37561/__cypress/reporter","xhrUrl":"__cypress/xhrs/","proxyServer":"http://localhost:37561","state":{}}}

I used my repo (https://github.com/alexsch01/exampleForIssue) to generate this temp file

@nagash77 nagash77 requested a review from mjhenkes December 5, 2022 19:11
@mjhenkes mjhenkes self-assigned this Dec 5, 2022
@alexsch01
Copy link
Contributor Author

@mjhenkes

The CircleCI linux-lint test is failing
/root/cypress/cli/lib/cypress.js
35:1 error Trailing spaces not allowed no-trailing-spaces

The CircleCI driver-integration-tests-electron is failing
e2e/origin/navigation.cy.ts file has one failure

cli/lib/cypress.js Outdated Show resolved Hide resolved
@alexsch01 alexsch01 requested a review from mjhenkes December 6, 2022 02:30
@nagash77 nagash77 assigned BlueWinds and unassigned mjhenkes Dec 6, 2022
@BlueWinds
Copy link
Contributor

This looks like a good change to me, and verified the fix with the repro repo (thank you for providing!). Poking the rest of the team for a second review.

@BlueWinds BlueWinds merged commit c9afe18 into cypress-io:develop Dec 8, 2022
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Dec 13, 2022

Released in 12.1.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v12.1.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Dec 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants