Skip to content

Commit

Permalink
feat: Allow choosing a Node version in the run job (#484)
Browse files Browse the repository at this point in the history
* Allow choosing a Node version in the run job

* Fix linter issue

* updates to fix build

* Improve test command for custom node version

---------

Co-authored-by: Matthew Schile <[email protected]>
  • Loading branch information
deiga and mschile authored Sep 24, 2024
1 parent 9910924 commit ff2b054
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
12 changes: 12 additions & 0 deletions .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ workflows:
working-directory: examples/npm-install
cypress-cache-key: cypress-cache-{{ arch }}-{{ checksum "examples/npm-install/package.json" }}
post-install: "npm run say-hello && npm run say-goodbye"
- cypress/run:
filters: *filters
name: Custom Node Version Example
working-directory: examples/npm-install
cypress-cache-key: cypress-cache-{{ arch }}-{{ checksum "examples/npm-install/package.json" }}
node-version: "20.15.1"
post-install: |
if ! node --version | grep -q "20.15.1"; then
echo "Node version 20.15.1 not found"
exit 1
fi
- cypress/run:
filters: *filters
name: Yarn Example
Expand Down Expand Up @@ -130,6 +141,7 @@ workflows:
requires:
- orb-tools/pack
- Standard Npm Example
- Custom Node Version Example
- Yarn Example
- Custom Install Example
- Wait On Example
Expand Down
2 changes: 1 addition & 1 deletion src/examples/node-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
node-version: "20.6"
steps:
- cypress/install:
package-manager: "yarn"
package-manager: "npm"
- cypress/run-tests:
start-command: "npm run start:dev"
cypress-command: "npx cypress run"
Expand Down
2 changes: 1 addition & 1 deletion src/executors/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: >
parameters:
node-version:
type: string
default: "18.16.1"
default: "18.16.1" # keep in sync with jobs/run.yml
description: >
The version of Node to run your tests with.
docker:
Expand Down
11 changes: 9 additions & 2 deletions src/jobs/run.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
description: >
A single, complete job to run Cypress end-to-end tests in your application.
# What will this job do?
executor: default
executor:
name: default
node-version: << parameters.node-version >>

parallelism: << parameters.parallelism >>

Expand Down Expand Up @@ -66,6 +68,11 @@ parameters:
description: |
Number of Circle machines to use for load balancing, min 1
(requires `parallel` and `record` flags in your `cypress-command`)
node-version:
type: string
default: "18.16.1" # keep in sync with executors/default.yml
description: >
The version of Node to run your tests with.
steps:
- install:
Expand Down

0 comments on commit ff2b054

Please sign in to comment.