Skip to content

Commit

Permalink
Merge pull request #200 from pplancq/feature/commitlint
Browse files Browse the repository at this point in the history
  • Loading branch information
bencompton committed Mar 26, 2024
2 parents 475edb4 + 396deb7 commit 1c8c510
Show file tree
Hide file tree
Showing 5 changed files with 1,283 additions and 19 deletions.
43 changes: 36 additions & 7 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,48 @@ name: Tests

on: [push, pull_request]

env:
HUSKY: 0 # for disable husky on ci

jobs:
build:
name: Build
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x, 21.x]

steps:
- uses: actions/checkout@v2
- name: Testing with Node.js v${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Testing with Node.js v${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

# Checks if package-lock.json is Up To Date
# https://www.npmjs.com/package/package-lock-utd
- name: Check package-lock.json
run: npm exec --yes package-lock-utd@1.1.3

# https://docs.npmjs.com/cli/v10/commands/npm-ci
- name: Install Package
run: npm ci

# https://commitlint.js.org/guides/ci-setup.html#github-actions
- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request'
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose --color

- name: Run Lint
run: npm run lint

- name: Run Test
run: npm run test:ci

- name: Run Build
run: npm run build
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no -- commitlint --edit ${1}
53 changes: 52 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
# Overview
# Contributing to jest-cucumber

First of all, thank you for taking the time to contribute! ❤️

All types of contributions are encouraged and appreciated.
Please be sure to read this document before making your contribution.
It will make our job as maintainers easier and the experience much more enjoyable for everyone involved.
The community looks forward to your contributions. 🎉

> And if you like the project but don't have the time to contribute, that's okay. There are other easy ways to support the project and show your appreciation, and we'd love to hear from you:
>
> Give the project a star
> Share it on social media
> Refer to the project in your project's readme file.
> Mention the project at local meetings and tell your friends/colleagues about it.
## Overview

Just as a disclaimer, this package is maintained by a single person who has fairly limited time to keep this up to date, so apologies for any lack of timeliness.

This project generally aims to have feature parity with Cucumber where it makes sense in the context of Jest. Many people may have certain niche preferences or experimental ideas outside of the realm of existing Jest or Cucumber features, which in many cases can work against keeping this project as simple to use and maintain as possible. If you're able to get something new and interesting working by adding additional code in your own projects to leverage the package in a unique way, please feel free to share it with the community in the [Discussions](https://github.com/bencompton/jest-cucumber/discussions) area! In the past, such ideas have even been incorporated into the package itself--one example is Automatic Step Binding.

## Code of Conduct

This project and everyone participating in it is governed by the [Code of Conduct](CODE_OF_CONDUCT.md).
By participating, you are expected to uphold this code.

## Issues

Issues in this repo are generally for reporting bugs and proposing new features, as opposed to asking for support. If you're strugging to get something working, you may have better luck in the Q&A area under [Discussions](https://github.com/bencompton/jest-cucumber/discussions).
Expand All @@ -25,3 +46,33 @@ Documentation and examples should be concrete, easily understood, and devoid of
Funny rule to have for a package with a front page example about Elon Musk and rockets, which perhaps some people may have found amusing, but many others may have not because it doesn't actually help new users to understand how teams should write Gherkin in the real world. I remember my team and I initially struggling to understand how to properly use the Gherkin `Rule` keyword many years ago, and we were all scratching our heads because the only examples we could find in the Cucumber docs were about ninjas. We would have learned faster if we had more examples that demonstrated how the `Rule` keyword should be used in a real system, preferably detailing workflows that are widely used and understood, like adding a product to a shopping cart / basket, logging into a web app, making a bank deposit, etc. Examples about ninjas, Chuck Norris, and Elon Musk are probably be more entertaining when they aren't the only examples available.

With this mindset, many of the less concrete examples in this repo have already been replaced with more concrete ones, and at the risk of sounding like a killjoy, we should continute in that direction. If your docs or examples are rejected, it's not because you aren't clever or funny enough, it's that it's more important to educate than to entertain, especially when you may be providing the only examples in existence on how to use a particular feature.

## Commit conventions

We follow the conventions of [Conventional Commits](https://www.conventionalcommits.org/). This means that the commit message must be structured as follows:

```
<type>([optional scope]): <description>
[optional body]
[optional footer(s)]
```

For examples:

```
feat(feature): add a new feature
```
```
fix(bug): fix a bug
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Issue: #42
```
```
feat(feature)!: add a new feature with
BREAKING CHANGE: Lorem Ipsum is simply dummy text of the printing and typesetting industry.
```

0 comments on commit 1c8c510

Please sign in to comment.