-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(commands): run and open commands added for building config then running/opening cypress * feat(commands): add support for loading path from `cypress.json` * feat(core): add prettier
- Loading branch information
1 parent
bc3f6e0
commit d7a8439
Showing
16 changed files
with
1,884 additions
and
1,594 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,44 @@ | ||
module.exports = { | ||
parser: "babel-eslint", | ||
"extends": "airbnb", | ||
'extends': ['airbnb', 'prettier'], | ||
root: true, | ||
plugins: ['import', 'babel', 'prettier'], | ||
settings: { | ||
'import/resolver': { | ||
node: { | ||
moduleDirectory: ['node_modules', '/'] | ||
} | ||
} | ||
}, | ||
env: { | ||
browser: true, | ||
node: true | ||
}, | ||
rules: { | ||
"comma-dangle": [2, "never"], | ||
"import/prefer-default-export": 0, | ||
"no-shadow": 0, | ||
"consistent-return": 0, | ||
"no-new": 0, | ||
"new-cap": 0, | ||
"max-len": 0, | ||
"brace-style": [2, "stroustrup"] | ||
"prettier/prettier": [ | ||
'error', | ||
{ | ||
singleQuote: true, // airbnb | ||
trailingComma: 'all', // airbnb | ||
} | ||
] | ||
}, | ||
plugins: [ | ||
"react" | ||
] | ||
overrides: { | ||
files: ['cmds/**'], | ||
rules: { | ||
"comma-dangle": ["error", { "functions": "never" }], | ||
"prettier/prettier": [ | ||
'error', | ||
{ | ||
singleQuote: true, // airbnb | ||
trailingComma: 'none', // airbnb | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* run commander component | ||
* To use add require('../cmds/run.js')(program) to your commander.js based node executable before program.parse | ||
*/ | ||
|
||
const chalk = require('chalk'); | ||
const { runCommand } = require('../lib/utils'); | ||
const logger = require('../lib/logger'); | ||
|
||
/** | ||
* @name open | ||
* @description Create test environment config then open Cypress Test Runner | ||
* @param {String} envName | ||
*/ | ||
module.exports = function open(program) { | ||
program | ||
.command('open [envName]') | ||
.description( | ||
'Build configuration file containing a token for authorizing a firebase instance' | ||
) | ||
.action((envArg) => { | ||
const envName = typeof envArg === 'string' ? envArg : 'local'; | ||
return runCommand({ command: `cypress-firebase createTestEnvFile ${envName}` }) | ||
.then(() => { | ||
logger.info(`Opening test runner for environment: ${chalk.cyan(envName)}`); | ||
return runCommand({ command: 'npx', args: ['cypress', 'open', '--env', `envName=${envName}`] }); | ||
}) | ||
.then(() => process.exit(0)) | ||
.catch((err) => { | ||
logger.error(`Test runner open could not be completed:\n${err.message}`); | ||
process.exit(1); | ||
return Promise.reject(err); | ||
}); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* run commander component | ||
* To use add require('../cmds/run.js')(program) to your commander.js based node executable before program.parse | ||
*/ | ||
|
||
const chalk = require('chalk'); | ||
const { runCommand } = require('../lib/utils'); | ||
const logger = require('../lib/logger'); | ||
|
||
/** | ||
* @name run | ||
* @description Deploy to Firebase only on build branches (master, stage, prod) | ||
* @param {String} envName | ||
*/ | ||
module.exports = function run(program) { | ||
program | ||
.command('run [envName]') | ||
.description( | ||
'Build configuration file containing a token for authorizing a firebase instance' | ||
) | ||
.action((envArg) => { | ||
const envName = typeof envArg === 'string' ? envArg : 'local'; | ||
return runCommand({ command: `cypress-firebase createTestEnvFile ${envName}` }) | ||
.then(() => { | ||
logger.info(`Starting test run for environment: ${chalk.cyan(envName)}`); | ||
return runCommand({ command: 'npx', args: ['cypress', 'run', '--env', `envName=${envName}`] }); | ||
}) | ||
.then(() => process.exit(0)) | ||
.catch((err) => { | ||
logger.error(`Run could not be completed:\n${err.message}`); | ||
process.exit(1); | ||
return Promise.reject(err); | ||
}); | ||
}); | ||
}; |
Oops, something went wrong.