Skip to content

Commit

Permalink
Add glob escape for --spec paths
Browse files Browse the repository at this point in the history
  • Loading branch information
ypresto committed Apr 13, 2022
1 parent 32e05c8 commit f22d333
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 25 deletions.
3 changes: 3 additions & 0 deletions cypress/integration/1/[foo].js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
describe('Spec filename contains glob characters', () => {
it('should run', () => { cy.wrap(true).should('eq', true) })
})
3 changes: 3 additions & 0 deletions cypress/integration/2/[foo].js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
describe('Spec filename contains glob', () => {
it('should run', () => { cy.wrap(true).should('eq', true) })
})
3 changes: 3 additions & 0 deletions cypress/integration/3/[foo].js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
describe('Spec filename contains glob', () => {
it('should run', () => { cy.wrap(true).should('eq', true) })
})
3 changes: 3 additions & 0 deletions cypress/integration/4/[foo].js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
describe('Spec filename contains glob', () => {
it('should run', () => { cy.wrap(true).should('eq', true) })
})
3 changes: 3 additions & 0 deletions cypress/integration/5/[foo].js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
describe('Spec filename contains glob', () => {
it('should run', () => { cy.wrap(true).should('eq', true) })
})
3 changes: 3 additions & 0 deletions cypress/integration/6/[foo].js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
describe('Spec filename contains glob', () => {
it('should run', () => { cy.wrap(true).should('eq', true) })
})
49 changes: 30 additions & 19 deletions lib/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@
"cli-table3": "^0.6.0",
"colors": "^1.4.0",
"cross-spawn": "^7.0.3",
"fs-extra": "^10.0.0",
"glob-escape": "^0.0.2",
"is-npm": "^5.0.0",
"lodash.camelcase": "^4.3.0",
"mocha": "^8.2.1",
"yargs": "15.3.1",
"fs-extra": "^10.0.0"
"yargs": "15.3.1"
},
"peerDependencies": {
"cypress-multi-reporters": "^1.5.0"
Expand Down
7 changes: 4 additions & 3 deletions lib/thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const { isYarn } = require('is-npm');
const path = require('path');
const fs = require('fs');
const camelCase = require('lodash.camelcase');
const globEscape = require('glob-escape');

const { settings } = require('./settings');
const { sleep } = require('./utility');
Expand All @@ -11,8 +12,8 @@ function getPackageManager() {
const pckManager = isYarn
? 'yarn'
: process.platform === 'win32'
? 'npm.cmd'
: 'npm';
? 'npm.cmd'
: 'npm';

return pckManager;
}
Expand Down Expand Up @@ -49,7 +50,7 @@ function createReporterConfigFile(path) {
}

function createCommandArguments(thread) {
const specFiles = `'${thread.list.join(',')}'`;
const specFiles = `${thread.list.map(path => globEscape(path)).join(',')}`;
const childOptions = [
'run',
`${settings.script}`,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"start": "npm start --prefix demo-app",
"cy:open": "cypress open",
"cy:run": "cypress run --browser chrome --headless",
"cy:parallel": "node_modules/.bin/cypress-parallel -s cy:run -t 4 -d 'cypress/integration/1/*.js' -m false",
"cy:parallel": "node_modules/.bin/cypress-parallel -s cy:run -t 4 -d 'cypress/integration/1/*.js'",
"cy:parallel:many": "node_modules/.bin/cypress-parallel -s cy:run -t 8 -d 'cypress/integration/**/*.js'",
"cy:parallel:spec": "node_modules/.bin/cypress-parallel -s cy:run -t 2 -d cypress/integration/1 -r spec",
"cy:parallel:junit": "node_modules/.bin/cypress-parallel -s cy:run -t 2 -d cypress/integration/1 -r mocha-junit-reporter -o 'mochaFile=demo-app/reporting/junit/e2e-junit-[hash].xml'",
Expand Down

0 comments on commit f22d333

Please sign in to comment.