Skip to content

Commit

Permalink
add custom directory example
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Jul 9, 2019
1 parent 83a049a commit c19b1bd
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ In all cases, you are using `run` and `install` job definitions that Cypress pro
- [store other folders as artifacts on Circle](docs/examples.md#any-artifacts)
- [use your own custom command to run tests](docs/examples.md#custom-command)
- [skip saving workspace](docs/examples.md#no-workspace)
- [run commands in a subfolder of a monorepo](docs/examples.md#custom-directory)

All examples are in [docs/examples.md](docs/examples.md) and are generated from the [src/orb.yml](src/orb.yml) file.

Expand Down
19 changes: 19 additions & 0 deletions docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- [custom-command](#custom-command) - use a custom command to launch tests
- [no-workspace](#no-workspace) - faster for a single cypress/run job without saving workspace
- [private-npm-module](#private-npm-module) - complete NPM module publishing example
- [custom-directory](#custom-directory) - run commands in a subfolder of a monorepo

## simple

Expand Down Expand Up @@ -475,3 +476,21 @@ workflows:

```

## custom-directory


Runs all commands in a custom directory, this is useful when using a monorepo where the `package.json` file isn't at the root of the repository (eg. in the `frontend/` subfolder).

```yaml
version: 2.1
orbs:
cypress: cypress-io/cypress@1
workflows:
build:
jobs:
- cypress/run:
yarn: true
working_directory: frontend

```

20 changes: 20 additions & 0 deletions docs/jobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ Public jobs defined in this orb that your config workflow can use. See [examples
- yarn
- cache-key
- no-workspace
- working_directory

- [install](#install)
- executor
- build
- yarn
- working_directory


## run
Expand Down Expand Up @@ -181,6 +183,15 @@ default: `false`
type: string


**`working_directory`**

> Directory containing package.json. Use this parameter if you're using a monorepo and your
> cypress tests aren't at the root of the repository (eg. `frontend`).

type: string


**`yarn`**

> Use yarn to install NPM modules instead of npm.
Expand Down Expand Up @@ -216,6 +227,15 @@ type: executor
default: `base-10`


**`working_directory`**

> Directory containing package.json. Use this parameter if you're using a monorepo and your
> cypress tests aren't at the root of the repository (eg. `frontend`).

type: string


**`yarn`**

> Use yarn to install NPM modules instead of npm.
Expand Down
3 changes: 2 additions & 1 deletion scripts/examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ const exampleTitles = {
'any-artifacts': 'store other folders as artifacts on Circle',
'custom-command': 'use a custom command to launch tests',
'no-workspace': 'faster for a single cypress/run job without saving workspace',
'private-npm-module': 'complete NPM module publishing example'
'private-npm-module': 'complete NPM module publishing example',
'custom-directory': 'run commands in a subfolder of a monorepo'
}

// we want to make sure all orb examples are represented in the object above
Expand Down

0 comments on commit c19b1bd

Please sign in to comment.