Skip to content

Latest commit

 

History

History
157 lines (106 loc) · 3.58 KB

javascript-cucumber-sample.adoc

File metadata and controls

157 lines (106 loc) · 3.58 KB

JavaScript sample with Cucumber

Node and Yarn versions

$ node -v
v12.18.3
$ yarn -v
1.22.4

Initial and final code download

$ git clone https://github.com/paulojeronimo/javascript-cucumber-sample
$ cd javascript-cucumber-sample; javascript_cucumber_sample=$PWD

Final code test

$ cd final
$ yarn install
$ yarn test

Tutorial

$ d=$javascript_cucumber_sample/tutorial; rm -rf $d && mkdir $d && cd $d
$ yarn init -y
$ yarn add @cucumber/cucumber --dev
$ echo node_modules > .gitignore
$ git init; git add .
$ git apply < ../patches/package.json.diff
$ (cd ../initial; rsync -R features/is_it_friday_yet.feature ../tutorial/)
$ yarn test
$ mkdir -p features/step_definitions
$ cat > features/step_definitions/steps.js <<EOF
const { Given, When, Then } = require('@cucumber/cucumber')

$(`yarn bin`/cucumber-js --format snippets 2> /dev/null)
EOF
$ yarn test
$ git add .
$ cp ../initial/features/step_definitions/steps.js features/step_definitions/
$ yarn test
$ git add .
$ git apply ../patches/features/step_definitions/steps.js.2.diff
$ yarn test
$ git add .
$ git apply ../patches/features/is_it_friday_yet.feature.diff
$ git apply ../patches/features/step_definitions/steps.js.3.diff
$ yarn test
$ git add .
$ git apply ../patches/features/step_definitions/steps.js.4.diff
$ yarn test
$ git apply ../patches/features/is_it_friday_yet.feature.2.diff
$ git apply ../patches/features/step_definitions/steps.js.5.diff
$ yarn test
$ git add .
$ git commit -m 'Initial commit'

If you are "Paulo Jerônimo" (hehehe) push this code this way:

$ cd ..
$ rsync -av --exclude .git --exclude node_modules tutorial/ final/
$ git remote add origin git@github.com:paulojeronimo/javascript-cucumber-sample.git
$ git branch -M main
$ git push -u origin main -f --tags