question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

--spec flag should accept array of files or glob pattern

See original GitHub issue

Currently the --spec argument accepts only a single spec file to run, and this could be upgraded to accept an array of files and/or a glob pattern.

Related to #64

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:13
  • Comments:21 (12 by maintainers)

github_iconTop GitHub Comments

13reactions
brian-manncommented, Oct 18, 2017

In case anyone is interested in running your specs in isolation - it is fairly trivial to do this now with the module API.

Here is an example of looping through each of your specs and then iteratively running them…

const cypress = require('cypress')
const Promise = require('bluebird')

const glob = Promise.promisify(require('glob'))

const started = new Date()
let numFailed = 0

return glob('cypress/integration/**/*', {
  nodir: true,
  realpath: true,
})
.tap((specs) => {
  console.log('Found ', specs.length, ' specs:\n\n', specs)
})
.each((spec) => {
  console.log('\nRunning spec:', spec)

  return cypress.run({
    spec: spec,

    // an example of more config stuff
    // record: true,
    // reporter: 'junit',
    // browser: 'chrome',
    // config: {
    //   baseUrl: 'http://localhost:8080',
    //   chromeWebSecurity: false,
    // },
    // env: {
    //   foo: 'bar',
    //   baz: 'quux',
    // }
  })
  .then((results) => {
    numFailed += results.failures
  })
})
.then(() => {
  const duration = new Date() - started

  console.log('\n--All Done--\n')
  console.log('Total duration:', duration) // format this however you like
  console.log('Exiting with final code:', numFailed)

  process.exit(numFailed)
})
.catch((err) => {
  console.error(err)
  throw err
})
4reactions
brian-manncommented, May 30, 2018

Released in 3.0.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

glob - Manual - PHP
GLOB_NOSORT - Return files as they appear in the directory (no sorting). When this flag is not used, the pathnames are sorted alphabetically;...
Read more >
glob - npm
"Globs" are the patterns you type when you do stuff like ls *.js on the command line, or put build/* in a .gitignore...
Read more >
Configuration - Cypress Documentation
A String or Array of glob patterns used to ignore spec files that would otherwise be shown in your list of specs.
Read more >
Ignoring Code - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Configuring Jest
An array of glob patterns indicating a set of files for which coverage information should be collected. If a file matches the specified...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found