Skip to content

Commit

Permalink
fix(server): Fix 5.0 spec duration always reporting as 0ms (#8313)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuceb committed Aug 18, 2020
1 parent 4ca9ddc commit 9a32d22
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/server/lib/modes/run.js
Expand Up @@ -1295,7 +1295,7 @@ module.exports = {
})),
})

return writeOutput(outputPath, moduleAPIResults).return(moduleAPIResults)
return writeOutput(outputPath, moduleAPIResults).return(results)
})
},

Expand Down
13 changes: 9 additions & 4 deletions packages/server/test/e2e/5_spec_isolation_spec.js
@@ -1,13 +1,14 @@
// TODO: rename this file to 5_module_api_spec

const path = require('path')
const _ = require('lodash')
const snapshot = require('snap-shot-it')
const fs = require('../../lib/util/fs')
const e2e = require('../support/helpers/e2e').default
const { default: e2e, STDOUT_DURATION_IN_TABLES_RE } = require('../support/helpers/e2e')
const Fixtures = require('../support/helpers/fixtures')
const { expectCorrectModuleApiResult } = require('../support/helpers/resultsUtils')
const e2ePath = Fixtures.projectPath('e2e')
const it = e2e.it
const { it } = e2e

const outputPath = path.join(e2ePath, 'output.json')

Expand All @@ -26,8 +27,12 @@ describe('e2e spec_isolation', () => {
outputPath,
snapshot: false,
expectedExitCode: 5,
async onRun (exec) {
await exec()
async onRun (execFn) {
const { stdout } = await execFn()

_.each(STDOUT_DURATION_IN_TABLES_RE.exec(stdout), (str) => {
expect(str.trim(), 'spec durations in tables should not be 0ms').not.eq('0ms')
})

// now what we want to do is read in the outputPath
// and snapshot it so its what we expect after normalizing it
Expand Down
4 changes: 3 additions & 1 deletion packages/server/test/support/helpers/e2e.ts
Expand Up @@ -44,6 +44,8 @@ const availableBrowsersRe = /(Available browsers found on your system are:)([\s\
const crossOriginErrorRe = /(Blocked a frame .* from accessing a cross-origin frame.*|Permission denied.*cross-origin object.*)/gm
const whiteSpaceBetweenNewlines = /\n\s+\n/

export const STDOUT_DURATION_IN_TABLES_RE = /(\s+?)(\d+ms|\d+:\d+:?\d+)/g

// this captures an entire stack trace and replaces it with [stack trace lines]
// so that the stdout can contain stack traces of different lengths
// '@' will be present in firefox stack trace lines
Expand Down Expand Up @@ -153,7 +155,7 @@ const normalizeStdout = function (str, options: any = {}) {
// numbers in parenths
.replace(/\s\(\d+([ms]|ms)\)/g, '')
// 12:35 -> XX:XX
.replace(/(\s+?)(\d+ms|\d+:\d+:?\d+)/g, replaceDurationInTables)
.replace(STDOUT_DURATION_IN_TABLES_RE, replaceDurationInTables)
.replace(/(coffee|js)-\d{3}/g, '$1-456')
// Cypress: 2.1.0 -> Cypress: 1.2.3
.replace(/(Cypress\:\s+)(\d+\.\d+\.\d+)/g, replaceCypressVersion)
Expand Down

3 comments on commit 9a32d22

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 9a32d22 Aug 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/linux-x64/circle-develop-9a32d226bbd2fabf27266a8d143b1a71e6eb2826-425712/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/circle-develop-9a32d226bbd2fabf27266a8d143b1a71e6eb2826-425701/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 9a32d22 Aug 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

Instructions are included below, depending on the shell you are using.

In Command Prompt (cmd.exe):

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/win32-x64/appveyor-develop-9a32d226bbd2fabf27266a8d143b1a71e6eb2826-34726925/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-9a32d226bbd2fabf27266a8d143b1a71e6eb2826-34726925/cypress.tgz

In PowerShell:

$env:CYPRESS_INSTALL_BINARY = https://cdn.cypress.io/beta/binary/5.0.0/win32-x64/appveyor-develop-9a32d226bbd2fabf27266a8d143b1a71e6eb2826-34726925/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-9a32d226bbd2fabf27266a8d143b1a71e6eb2826-34726925/cypress.tgz

In Git Bash:

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/win32-x64/appveyor-develop-9a32d226bbd2fabf27266a8d143b1a71e6eb2826-34726925/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-9a32d226bbd2fabf27266a8d143b1a71e6eb2826-34726925/cypress.tgz

Using cross-env:

If the above commands do not work for you, you can also try using cross-env:

npm i -g cross-env
cross-env CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/win32-x64/appveyor-develop-9a32d226bbd2fabf27266a8d143b1a71e6eb2826-34726925/cypress.zip npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-9a32d226bbd2fabf27266a8d143b1a71e6eb2826-34726925/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 9a32d22 Aug 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 ia32 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

Instructions are included below, depending on the shell you are using.

In Command Prompt (cmd.exe):

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/win32-ia32/appveyor-develop-9a32d226bbd2fabf27266a8d143b1a71e6eb2826-34726925/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-9a32d226bbd2fabf27266a8d143b1a71e6eb2826-34726925/cypress.tgz

In PowerShell:

$env:CYPRESS_INSTALL_BINARY = https://cdn.cypress.io/beta/binary/5.0.0/win32-ia32/appveyor-develop-9a32d226bbd2fabf27266a8d143b1a71e6eb2826-34726925/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-9a32d226bbd2fabf27266a8d143b1a71e6eb2826-34726925/cypress.tgz

In Git Bash:

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/win32-ia32/appveyor-develop-9a32d226bbd2fabf27266a8d143b1a71e6eb2826-34726925/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-9a32d226bbd2fabf27266a8d143b1a71e6eb2826-34726925/cypress.tgz

Using cross-env:

If the above commands do not work for you, you can also try using cross-env:

npm i -g cross-env
cross-env CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/win32-ia32/appveyor-develop-9a32d226bbd2fabf27266a8d143b1a71e6eb2826-34726925/cypress.zip npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-9a32d226bbd2fabf27266a8d143b1a71e6eb2826-34726925/cypress.tgz

Please sign in to comment.