Skip to content

Commit ff2b054

Browse files
deigamschile
andauthored
feat: Allow choosing a Node version in the run job (#484)
* 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]>
1 parent 9910924 commit ff2b054

File tree

4 files changed

+23
-4
lines changed

4 files changed

+23
-4
lines changed

.circleci/test-deploy.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,17 @@ workflows:
6565
working-directory: examples/npm-install
6666
cypress-cache-key: cypress-cache-{{ arch }}-{{ checksum "examples/npm-install/package.json" }}
6767
post-install: "npm run say-hello && npm run say-goodbye"
68+
- cypress/run:
69+
filters: *filters
70+
name: Custom Node Version Example
71+
working-directory: examples/npm-install
72+
cypress-cache-key: cypress-cache-{{ arch }}-{{ checksum "examples/npm-install/package.json" }}
73+
node-version: "20.15.1"
74+
post-install: |
75+
if ! node --version | grep -q "20.15.1"; then
76+
echo "Node version 20.15.1 not found"
77+
exit 1
78+
fi
6879
- cypress/run:
6980
filters: *filters
7081
name: Yarn Example
@@ -130,6 +141,7 @@ workflows:
130141
requires:
131142
- orb-tools/pack
132143
- Standard Npm Example
144+
- Custom Node Version Example
133145
- Yarn Example
134146
- Custom Install Example
135147
- Wait On Example

src/examples/node-version.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
node-version: "20.6"
1212
steps:
1313
- cypress/install:
14-
package-manager: "yarn"
14+
package-manager: "npm"
1515
- cypress/run-tests:
1616
start-command: "npm run start:dev"
1717
cypress-command: "npx cypress run"

src/executors/default.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: >
33
parameters:
44
node-version:
55
type: string
6-
default: "18.16.1"
6+
default: "18.16.1" # keep in sync with jobs/run.yml
77
description: >
88
The version of Node to run your tests with.
99
docker:

src/jobs/run.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
description: >
22
A single, complete job to run Cypress end-to-end tests in your application.
3-
# What will this job do?
4-
executor: default
3+
4+
executor:
5+
name: default
6+
node-version: << parameters.node-version >>
57

68
parallelism: << parameters.parallelism >>
79

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

0 commit comments

Comments
 (0)