Skip to content

Commit

Permalink
Feature/implementation (#1)
Browse files Browse the repository at this point in the history
* scenario numbering progress

* readme + expanding tests

* added debug

* adding github workflow + some configs

* updating package-lock

* fixing pr comments

* pruning id

* fixing pr comments

* Update .github/workflows/release.yml

Co-authored-by: Szikszai László <sziklaszlo@gmail.com>

* applying new versions

Co-authored-by: Balazs_Racz <balazs_racz@epam.com>
Co-authored-by: Szikszai László <sziklaszlo@gmail.com>
  • Loading branch information
3 people authored Feb 3, 2022
1 parent 55f75d1 commit be5f236
Show file tree
Hide file tree
Showing 22 changed files with 6,510 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
21 changes: 21 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_"
}
],
"@typescript-eslint/ban-ts-comment": 0
}
}
50 changes: 50 additions & 0 deletions .github/workflows/beta-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Beta Release

on:
push:
branches:
- 'beta/**'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16
- run: npm ci
- run: npm run build

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- name: Generate build number
uses: einaregilsson/build-number@v3
with:
token: ${{secrets.github_token}}
- name: Checkout
uses: actions/checkout@v2
- name: Setting up Node.js
uses: actions/setup-node@v1
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- name: Install
run: npm ci
- name: Build
run: npm run buildUpdate
- name: Release
run: |
cv=$(cat package.json | grep version | cut -d '"' -f 4)
echo "$cv-beta.$BUILD_NUMBER"
npm --no-git-tag-version version "$cv-beta.$BUILD_NUMBER"
npm publish --tag beta .
working-directory: ./dist
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: CI

on:
push:
branches:
- master
- 'feature/**'
- 'bugfix/**'
- 'hotfix/**'
workflow_dispatch:

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build
70 changes: 70 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '40 19 * * 5'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
32 changes: 32 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Docs

on:
push:
branches:
- master
workflow_dispatch:

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.1 # If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work correctly.
with:
persist-credentials: false

- name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built.
run: |
npm install
npm run build
- name: Deploy
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: docs # The folder the action should deploy.
CLEAN: true # Automatically remove deleted files from the deploy branch
31 changes: 31 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Pull requests

on: [pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build
- name: Monitor coverage
if: ${{ always() }}
uses: szikszail/coverage-monitor-action@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
clover_file: "coverage/clover.xml"
threshold_alert: 60
threshold_warning: 80
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Release

on:
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16
- run: npm ci
- run: npm run build

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run buildUpdate
- run: npm publish ./dist
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
13 changes: 9 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ bower_components
# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
# Typescript v1 declaration files
typings/

# Optional npm cache directory
Expand All @@ -57,5 +57,10 @@ typings/
# dotenv environment variables file
.env

# next.js build output
.next
.vscode
.idea
/reports
/coverage
/dist
/docs
yarn.lock
6 changes: 6 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/node_modules
/coverage
.idea
*.log
/test
.travis.yml
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 GherKing
Copyright (c) 2021-2022 GherKing

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
61 changes: 60 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,60 @@
# gpc-scenario-numbering
# gpc-scenario-numbering

![Downloads](https://img.shields.io/npm/dw/gpc-scenario-numbering?style=flat-square) ![Version@npm](https://img.shields.io/npm/v/gpc-scenario-numbering?label=version%40npm&style=flat-square) ![Version@git](https://img.shields.io/github/package-json/v/gherking/gpc-scenario-numbering/master?label=version%40git&style=flat-square) ![CI](https://img.shields.io/github/workflow/status/gherking/gpc-scenario-numbering/CI/master?label=ci&style=flat-square) ![Docs](https://img.shields.io/github/workflow/status/gherking/gpc-scenario-numbering/Docs/master?label=docs&style=flat-square)

The ScenarioNumbering precompiler is responsible for adding an index to all scenarios and scenario outlines.

## Example

```gherkin
@tag1
Scenario Outline: Test language (<language>)
Given I am on Home page <language> user
When <language> language is choosen
Then I should be on Home page
And the title should be "<title>"
@tag2
Examples:
| language | title |
| EN | Welcome |
| FR | Bienvenue |
Scenario: Test without tag
Given I am on Home page user
Then I should be on Home page
```
It will be modified to:
```gherkin
@tag1
Scenario Outline: 1. Test language (<language>)
Given I am on Home page <language> user
When <language> language is choosen
Then I should be on Home page
And the title should be "<title>"
@tag2
Examples:
| language | title |
| EN | Welcome |
| FR | Bienvenue |
Scenario: 2. Test without tag
Given I am on Home page user
Then I should be on Home page
```

## Configuration

ScenarioNumbering accepts the following configuration:

| Option | Type | Description | Default |
|:------:|:----:|:------------|:--------|
| `format` | `String` | The format, how index should be added to the name of the scenario/scenairo outline. Possible tokens: <ul><li>`${name}` the original name</li><li>`${i}` the index</li></ul> | `${i}. ${name}` |

## Other
This package uses [debug](https://www.npmjs.com/package/debug) for logging, use `gpc:scenario-numbering` :
```shell
DEBUG=gpc:scenario-numbering* gherking ...
```
For detailed documentation see the [TypeDocs documentation](https://gherking.github.io/gpc-scenario-numbering/).
Loading

0 comments on commit be5f236

Please sign in to comment.