Skip to content

Commit

Permalink
Merge pull request #29 from betrybe/update-json-server-script
Browse files Browse the repository at this point in the history
Adiciona json-server-auth e configura arquivo de rotas
  • Loading branch information
renatofreire authored Jan 24, 2024
2 parents a1dedb3 + 44fd933 commit f2a4fe5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,15 @@ This action evaluate Tryber projects with [Cypress](https://www.npmjs.com/packag

- `json-server-db`

**Default: db.json**
**Default: ./server/db.json**

Define json-server db file.

- `json-server-routes`

**Default: ./server/routes.json**

Define json-server routes file.

## Outputs

Expand Down
8 changes: 6 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,22 @@ inputs:
default: "3050"
json-server-db:
description: "Define json-server db file"
default: "db.json"
default: "./server/db.json"
json-server-routes:
description: "Define json-server route file"
default: "./server/routes.json"

outputs:
result:
description: "Cypress unit tests JSON results in base64 format."
runs:
using: "docker"
image: "docker://betrybe/cypress-evaluator-action:v9.0"
image: "docker://betrybe/cypress-evaluator-action:v10.0"
args:
- ${{ inputs.npm-start }}
- ${{ inputs.headless }}
- ${{ inputs.browser }}
- ${{ inputs.json-server }}
- ${{ inputs.json-server-port }}
- ${{ inputs.json-server-db }}
- ${{ inputs.json-server-routes }}
5 changes: 3 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ CYPRESS_BROWSER=$3
RUN_JSON_SERVER=$4
JSON_SERVER_PORT=$5
JSON_SERVER_DB=$6
JSON_SERVER_ROUTES=$7

export CY_CLI=true

Expand All @@ -18,8 +19,8 @@ if $RUN_NPM_START ; then
fi

if $RUN_JSON_SERVER ; then
npx json-server --watch $JSON_SERVER_DB --port $JSON_SERVER_PORT &
npx wait-on -t 300000 http://localhost:$JSON_SERVER_PORT
npx json-server-auth --watch $JSON_SERVER_DB -r $JSON_SERVER_ROUTES --port $JSON_SERVER_PORT --delay 1500 &
npx wait-on -t 300000 http://localhost:$JSON_SERVER_PORT/users
fi

headless_flag=''
Expand Down

0 comments on commit f2a4fe5

Please sign in to comment.