feat(nx): add in spec option for Cypress Builder

Add in spec option to angular.json so it can be passed to they cypress builder
This commit is contained in:
Nick Favero 2019-05-22 15:41:36 -06:00 committed by Victor Savkin
parent 356d288fd6
commit cf5ebf59d7
2 changed files with 12 additions and 2 deletions

View File

@ -29,6 +29,7 @@ export interface CypressBuilderOptions extends JsonObject {
watch: boolean;
browser?: string;
env?: Record<string, string>;
spec?: string;
}
try {
@ -80,7 +81,8 @@ function run(
options.watch,
baseUrl,
options.browser,
options.env
options.env,
options.spec
)
),
options.watch ? tap(noop) : take(1),
@ -187,7 +189,8 @@ function initCypress(
isWatching: boolean,
baseUrl: string,
browser?: string,
env?: Record<string, string>
env?: Record<string, string>,
spec?: string
): Observable<BuilderOutput> {
// Cypress expects the folder where a `cypress.json` is present
const projectFolderPath = path.dirname(cypressConfig);
@ -207,6 +210,9 @@ function initCypress(
if (env) {
options.env = env;
}
if (spec) {
options.spec = spec;
}
options.exit = exit;
options.headed = !headless;

View File

@ -56,6 +56,10 @@
"env": {
"type": "object",
"description": "A key-value Pair of environment variables to pass to Cypress runner"
},
"spec": {
"type": "string",
"description": "A comma delimited glob string that is provided to the Cypress runner to specify which spec files to run. i.e. '**examples/**,**actions.spec**"
}
},
"additionalProperties": false,