PauloGoncalvesBH / jest-evaluator-action

🛼 Jest evaluator Action for Tryber projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jest-evaluator-action

Jest evaluator action for Tryber projects

This action evaluate Tryber projects with Jest library.

WARNING: the image docker version specified in the action.yml must be the same as the last evaluator release version

Inputs

  • npm-start

    Optional

    Run npm start and waits to url before testing.

  • wait-for

    Optional

    Url that npm start command waits for

  • pr_author_username

    Required

    Pull Request author username.

Outputs

  • result

    Jest unit tests JSON results in base64 format.

Usage example

- uses: betrybe/jest-evaluator-action@v8
  with:
    pr_author_username: ${{ github.event.inputs.pr_author_username }}
  with:
    npm-start: true # false is default
    wait-for: 'http://localhost:8080' # http://localhost:3000 is default

How to get result output

- name: Jest evaluator
  id: evaluator
  uses: betrybe/jest-evaluator-action@v8
  with:
    pr_author_username: ${{ github.event.inputs.pr_author_username }}
- name: Next step
  uses: another-github-action
  with:
    param: ${{ steps.evaluator.outputs.result }}

Project contraints

The project that want to use this action should implement unit tests grouping them using describe statements. Each describe statement will be mapped to a requirement.

Example:

describe('requirement #1' () => {
  it('unit test1', () => {});
  it('unit test2', () => {});
  it('unit test3', () => {});
});

describe('requirement #2' () => {
  it('unit test1', () => {});
  it('unit test2', () => {});
  it('unit test3', () => {});
});

describe('requirement #3' () => {
  it('unit test1', () => {});
  it('unit test2', () => {});
  it('unit test3', () => {});
});

Project repository must create a file called requirements.json inside .trybe folder.

This file should have the following structure:

{
  "requirements": [{
    "description": "requirement #1",
    "bonus": false
  }, {
    "description": "requirement #2",
    "bonus": true
  }, {
    "description": "requirement #3",
    "bonus": false
  }]
}

where the "requirement #1", "requirement #2" and "requirement #3" are the requirements and describes names.

Learn about GitHub Actions

About

🛼 Jest evaluator Action for Tryber projects


Languages

Language:JavaScript 69.2%Language:Dockerfile 16.4%Language:Shell 14.4%