---
title: "3.1.1"
url: "https://www.cypress.io/releases/3-1-1"
description: "Features: You can now pass a flag option to cy.writeFile(). The following flags are available. Fixes #1249. There is a new CYPRESS_DOWNLOAD_MIRROR environment…"
---

# 3.1.1

ReleasedReleased on November 1, 2018

**Features:**

-   You can now pass a `flag` option to [cy.writeFile()](/api/commands/writefile). The [following flags](https://nodejs.org/api/fs.html#fs_file_system_flags) are available. Fixes [#1249](https://github.com/cypress-io/cypress/issues/1249).
    
-   There is a new [CYPRESS\_DOWNLOAD\_MIRROR](/app/references/advanced-installation#Mirroring) environment variable for installing Cypress at a mirror url. Fixes [#2609](https://github.com/cypress-io/cypress/pull/2609).
    
-   The [Module API](/app/references/module-api) now returns the `runUrl` from `cypress.run()`. Fixes [#2596](https://github.com/cypress-io/cypress/issues/2596).
    
-   Specs now properly display as focused when navigating through specs via the keyboard. Fixes [#2273](https://github.com/cypress-io/cypress/pull/2273).
    
-   Tasks registered in the plugins file with the 'task' event are merged with any tasks registered by previous calls to `on('task')`, instead of overwriting the previous tasks. Fixes [#2284](https://github.com/cypress-io/cypress/issues/2284).
    

**Bugfixes:**

-   Fixed a bug where Cypress would error when a secure cookie flag was set and then expired from an HTTPS url without the subsequent secure flag. Due to the way Cypress was constructing the url, this would fail to actually remove the cookie. Fixes [#1264](https://github.com/cypress-io/cypress/issues/1264), [#1321](https://github.com/cypress-io/cypress/issues/1321), [#1799](https://github.com/cypress-io/cypress/issues/1799).
    
-   We now truncate filenames for screenshots to not exceed 255 characters in length. Previously there were cases where the screenshot filename would exceed 255 characters and error. Fixes [#2403](https://github.com/cypress-io/cypress/issues/2403) and [#2665](https://github.com/cypress-io/cypress/issues/2665).
    
-   Fixed issue when using [cy.writeFile()](/api/commands/writefile) and passing an object to a `.json` file. The object is now correctly written to the JSON file instead of a string. Fixes [#2373](https://github.com/cypress-io/cypress/pull/2373).
    
-   We updated how we handle [trashAssetsBeforeRuns](/app/references/configuration#Screenshots) behavior. We now trash the contents of the `screenshotsFolder` and `videosFolder` directories instead of trashing the directories themselves. This helps maintain any file access permissions for the directories. Fixes [#1943](https://github.com/cypress-io/cypress/issues/1943) and [#2600](https://github.com/cypress-io/cypress/issues/2600).
    
-   Fixed bug where mocked Dates using [cy.clock()](/api/commands/clock) would not be an instance of `Date`. Fixes [#2570](https://github.com/cypress-io/cypress/issues/2570).
    
-   Directories within specs whose names contain `.` are now correctly read as directories instead of spec files within the Test Runner. Fixes [#2423](https://github.com/cypress-io/cypress/issues/2423).
    
-   Cypress no longer automatically takes screenshots of skipped tests. Fixes [#2368](https://github.com/cypress-io/cypress/issues/2368).
    
-   Fixed an issue where returning/resolving `undefined` from a [cy.task()](/api/commands/task) handler resulted in an incorrect runtime error. Fixes [#2553](https://github.com/cypress-io/cypress/issues/2553).
    
-   Update [modifyObstructiveCode](/app/references/configuration#modifyObstructiveCode) to account for framebusting techniques that use `window.frameElement`, so that Applications using this technique will run properly in Cypress. Fixes [#2582](https://github.com/cypress-io/cypress/issues/2582).
    
-   Fixed bug where only the first DOM element of an array of DOM elements would be blacked out after being passed as argument to `blackout` within [cy.screenshot()](/api/commands/screenshot). Fixes [#2508](https://github.com/cypress-io/cypress/issues/2508).
    
-   We fixed an issue involving timers after running [cy.screenshot()](/api/commands/screenshot). Fixes [#2432](https://github.com/cypress-io/cypress/issues/2432).
    
-   The Test Runner now retries node-originated errors from our internal API requests. Fixes [#2341](https://github.com/cypress-io/cypress/issues/2341)
    
-   Fixed issue with multiple `readyStateChanges` with the same `readyState`. Fixes [#1150](https://github.com/cypress-io/cypress/issues/1150).
    
-   Fixed Type error being thrown for users using TypeScript 3. Fixes [#2363](https://github.com/cypress-io/cypress/issues/2363).
    

**Misc**

-   We are now collecting more environment variables from runs when run in Semaphore, GitLab, Bitbucket, Team Foundation Server, Codeship, and Shippable. Fixes [#2460](https://github.com/cypress-io/cypress/issues/2460), [#2358](https://github.com/cypress-io/cypress/issues/2358), [#2343](https://github.com/cypress-io/cypress/issues/2343), and [#2453](https://github.com/cypress-io/cypress/issues/2453).
    
-   The Test Runner's search now resets when switching between projects. Fixes [#2512](https://github.com/cypress-io/cypress/issues/2512).
    
-   Fixed internal Cypress tests. Fixes [#2606](https://github.com/cypress-io/cypress/issues/2606).
    
-   Replaced use of `new Buffer` with `Buffer.from`. Fixes [#2626](https://github.com/cypress-io/cypress/issues/2626).
    
-   Allowed `autoScrollingEnabled` to be saved in `state.json`. Fixes [#2476](https://github.com/cypress-io/cypress/issues/2476).
    
-   Fixed internal test error `beforeSpecRun is not a function`. Fixes [#2401](https://github.com/cypress-io/cypress/issues/2401).
    
-   Switched our internal tests to use CircleCI workspaces. Fixes [#2398](https://github.com/cypress-io/cypress/issues/2398).
    
-   Update TypeScript definition for [cy.screenshot()](/api/commands/screenshot) to include screenshot specific options. Fixes [#2654](https://github.com/cypress-io/cypress/issues/2654).
    
-   URLs printed within the CLI will now display as the color blue. Fixes [#2493](https://github.com/cypress-io/cypress/issues/2493).
    
-   We began bulk converting some of our codebase from CoffeeScript to JavaScript. Fixes [#2686](https://github.com/cypress-io/cypress/issues/2686) and [#2687](https://github.com/cypress-io/cypress/issues/2687).
    
-   We updated some of our internal ESLint rules to be more strict and also to help with CoffeeScript to JavaScript conversions. Fixes [#2688](https://github.com/cypress-io/cypress/issues/2688).
    

**Documentation Changes:**

-   Added `flag` option to [`cy.writeFile()` doc](/api/commands/writefile).
    
-   Added `runUrl` to returned run in [Module API doc](/app/references/module-api).
    
-   Documented new `CYPRESS_DOWNLOAD_MIRROR` flag and rewrote advanced install instructions to be clearer in [Installing Cypress doc](/app/references/advanced-installation).
    

**Dependency Updates**

-   Upgraded `common-tags` from `^1.4.0` to `^1.8.0` [#2415](https://github.com/cypress-io/cypress/pull/2415)
    
-   Upgraded `@cypress/browserify-preprocessor` from `1.1.0` to `1.1.1` [#2513](https://github.com/cypress-io/cypress/issues/2513)
    
-   Upgraded `lolex` from `^1.5.2` to `^3.0.0` [#2570](https://github.com/cypress-io/cypress/issues/2570) {/\* textlint-disable \*/}
    
-   Upgraded `@types/jquery` from `3.2.16` to `3.3.6` [#2363](https://github.com/cypress-io/cypress/issues/2363) {/\* textlint-disable \*/}
    
-   Upgraded `zunder` from `5.6.5` to `6.1.1` [#2541](https://github.com/cypress-io/cypress/issues/2541)