From 76bfde5a1de7608c7221d328a2f0257316174ffc Mon Sep 17 00:00:00 2001 From: Matan Borenkraout Date: Wed, 25 Nov 2020 18:24:51 +0200 Subject: [PATCH 1/5] ci: add validate workflow based on yo kcd-oss --- .github/workflows/validate.yml | 80 ++++++++++++++++++ CONTRIBUTING.md | 11 +-- README.md | 40 +++++---- other/CODE_OF_CONDUCT.md | 143 ++++++++++++++++++++++----------- other/MAINTAINING.md | 8 +- 5 files changed, 212 insertions(+), 70 deletions(-) create mode 100644 .github/workflows/validate.yml diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 00000000..5e627efb --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,80 @@ +name: validate +on: + push: + branches: + - '+([0-9])?(.{+([0-9]),x}).x' + - 'main' + - 'next' + - 'next-major' + - 'beta' + - 'alpha' + - '!all-contributors/**' + pull_request: {} +jobs: + main: + # ignore all-contributors PRs + if: ${{ !contains(github.head_ref, 'all-contributors') }} + strategy: + matrix: + node: [10.14, 12, 14, 15] + runs-on: ubuntu-latest + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@v2 + + - name: ⎔ Setup node + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + + - name: 📥 Download deps + uses: bahmutov/npm-install@v1 + with: + useLockFile: false + + - name: ▶️ Run validate script + run: npm run validate + + - name: ⬆️ Upload coverage report + uses: codecov/codecov-action@v1 + + release: + needs: main + runs-on: ubuntu-latest + if: + ${{ github.repository == 'testing-library/jest-dom' && + contains('refs/heads/main,refs/heads/beta,refs/heads/next,refs/heads/alpha', + github.ref) && github.event_name == 'push' }} + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@v2 + + - name: ⎔ Setup node + uses: actions/setup-node@v1 + with: + node-version: 14 + + - name: 📥 Download deps + uses: bahmutov/npm-install@v1 + with: + useLockFile: false + + - name: 🏗 Run build script + run: npm run build + + - name: 🚀 Release + uses: cycjimmy/semantic-release-action@v2 + with: + semantic_version: 17 + branches: | + [ + '+([0-9])?(.{+([0-9]),x}).x', + 'main', + 'next', + 'next-major', + {name: 'beta', prerelease: true}, + {name: 'alpha', prerelease: true} + ] + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8d5db71a..d67d8b5d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,9 +7,9 @@ series [How to Contribute to an Open Source Project on GitHub][egghead] ## Project setup -1. Fork and clone the repo -2. Run `npm run setup -s` to install dependencies and run validation -3. Create a branch for your PR with `git checkout -b pr/your-branch-name` +1. Fork and clone the repo +2. Run `npm run setup -s` to install dependencies and run validation +3. Create a branch for your PR with `git checkout -b pr/your-branch-name` > Tip: Keep your `master` branch pointing at the original repository and make > pull requests from branches on your fork. To do this, run: @@ -39,7 +39,8 @@ Please checkout the [the open issues][issues] Also, please watch the repo and respond to questions/bug reports/feature requests! Thanks! -[egghead]: - https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github + +[egghead]: https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github [all-contributors]: https://github.com/all-contributors/all-contributors [issues]: https://github.com/testing-library/jest-dom/issues + diff --git a/README.md b/README.md index f3f79421..e3c3cb82 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ --- + [![Build Status][build-badge]][build] [![Code Coverage][coverage-badge]][coverage] [![version][version-badge]][package] [![downloads][downloads-badge]][npmtrends] @@ -28,6 +29,7 @@ [![Watch on GitHub][github-watch-badge]][github-watch] [![Star on GitHub][github-star-badge]][github-star] [![Tweet][twitter-badge]][twitter] + ## The problem @@ -158,7 +160,9 @@ expect(getByTestId('input')).toBeDisabled() expect(getByText('link')).not.toBeDisabled() ``` -> This custom matcher does not take into account the presence or absence of the `aria-disabled` attribute. For more on why this is the case, check [#144](https://github.com/testing-library/jest-dom/issues/144). +> This custom matcher does not take into account the presence or absence of the +> `aria-disabled` attribute. For more on why this is the case, check +> [#144](https://github.com/testing-library/jest-dom/issues/144).
@@ -174,7 +178,9 @@ perspective. It works like `not.toBeDisabled()`. Use this matcher to avoid double negation in your tests. -> This custom matcher does not take into account the presence or absence of the `aria-disabled` attribute. For more on why this is the case, check [#144](https://github.com/testing-library/jest-dom/issues/144). +> This custom matcher does not take into account the presence or absence of the +> `aria-disabled` attribute. For more on why this is the case, check +> [#144](https://github.com/testing-library/jest-dom/issues/144).
@@ -243,9 +249,7 @@ This allows you to assert whether an element is present in the document or not. expect( getByTestId(document.documentElement, 'html-element'), ).toBeInTheDocument() -expect( - getByTestId(document.documentElement, 'svg-element'), -).toBeInTheDocument() +expect(getByTestId(document.documentElement, 'svg-element')).toBeInTheDocument() expect( queryByTestId(document.documentElement, 'does-not-exist'), ).not.toBeInTheDocument() @@ -1160,6 +1164,7 @@ Thanks goes to these people ([emoji key][emojis]): + This project follows the [all-contributors][all-contributors] specification. @@ -1169,33 +1174,33 @@ Contributions of any kind welcome! MIT + [jest]: https://facebook.github.io/jest/ [dom-testing-library]: https://github.com/testing-library/dom-testing-library [react-testing-library]: https://github.com/testing-library/react-testing-library [npm]: https://www.npmjs.com/ [node]: https://nodejs.org -[build-badge]: - https://img.shields.io/travis/testing-library/jest-dom.svg?style=flat-square -[build]: https://travis-ci.org/testing-library/jest-dom -[coverage-badge]: +[build-badge]: https://img.shields.io/github/workflow/status/testing-library/jest-dom/validate?logo=github&style=flat-square +[build]: https://github.com/testing-library/jest-dom/actions?query=workflow%3Avalidate +[coverage-badge]: https://img.shields.io/codecov/c/github/testing-library/jest-dom.svg?style=flat-square [coverage]: https://codecov.io/github/testing-library/jest-dom [version-badge]: - https://img.shields.io/npm/v/@testing-library/jest-dom.svg?style=flat-square + https://img.shields.io/npm/v/@testing-library/jest-dom.svg?style=flat-square [package]: https://www.npmjs.com/package/@testing-library/jest-dom -[downloads-badge]: +[downloads-badge]: https://img.shields.io/npm/dm/@testing-library/jest-dom.svg?style=flat-square [npmtrends]: http://www.npmtrends.com/@testing-library/jest-dom -[license-badge]: +[license-badge]: https://img.shields.io/npm/l/@testing-library/jest-dom.svg?style=flat-square [license]: https://github.com/testing-library/jest-dom/blob/master/LICENSE -[prs-badge]: +[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square [prs]: http://makeapullrequest.com -[coc-badge]: +[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square -[coc]: +[coc]: https://github.com/testing-library/jest-dom/blob/master/other/CODE_OF_CONDUCT.md [github-watch-badge]: https://img.shields.io/github/watchers/testing-library/jest-dom.svg?style=social @@ -1207,8 +1212,11 @@ MIT https://twitter.com/intent/tweet?text=Check%20out%20jest-dom%20by%20%40gnapse%20https%3A%2F%2Fgithub.com%2Ftesting-library%2Fjest-dom%20%F0%9F%91%8D [twitter-badge]: https://img.shields.io/twitter/url/https/github.com/testing-library/jest-dom.svg?style=social -[emojis]: https://allcontributors.org/docs/en/emoji-key +[emojis]: https://github.com/all-contributors/all-contributors#emoji-key [all-contributors]: https://github.com/all-contributors/all-contributors +[all-contributors-badge]: + https://img.shields.io/github/all-contributors/testing-library/jest-dom?color=orange&style=flat-square [guiding-principle]: https://testing-library.com/docs/guiding-principles [discord-badge]: https://img.shields.io/discord/723559267868737556.svg?color=7389D8&labelColor=6A7EC2&logo=discord&logoColor=ffffff&style=flat-square [discord]: https://discord.gg/c6JN9fM + diff --git a/other/CODE_OF_CONDUCT.md b/other/CODE_OF_CONDUCT.md index 070cb5f6..47681ae0 100644 --- a/other/CODE_OF_CONDUCT.md +++ b/other/CODE_OF_CONDUCT.md @@ -2,74 +2,127 @@ ## Our Pledge -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, gender identity and expression, level of -experience, nationality, personal appearance, race, religion, or sexual identity -and orientation. +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. ## Our Standards -Examples of behavior that contributes to creating a positive environment -include: +Examples of behavior that contributes to a positive environment for our +community include: -- Using welcoming and inclusive language -- Being respectful of differing viewpoints and experiences -- Gracefully accepting constructive criticism -- Focusing on what is best for the community -- Showing empathy towards other community members +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +- Focusing on what is best not just for us as individuals, but for the overall + community -Examples of unacceptable behavior by participants include: +Examples of unacceptable behavior include: -- The use of sexualized language or imagery and unwelcome sexual attention or - advances -- Trolling, insulting/derogatory comments, and personal or political attacks +- The use of sexualized language or imagery, and sexual attention or advances of + any kind +- Trolling, insulting or derogatory comments, and personal or political attacks - Public or private harassment -- Publishing others' private information, such as a physical or electronic - address, without explicit permission +- Publishing others' private information, such as a physical or email address, + without their explicit permission - Other conduct which could reasonably be considered inappropriate in a professional setting -## Our Responsibilities +## Enforcement Responsibilities -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. -Project maintainers have the right and responsibility to remove, edit, or reject +Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are -not aligned to this Code of Conduct, or to ban temporarily or permanently any -contributor for other behaviors that they deem inappropriate, threatening, -offensive, or harmful. +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. ## Scope -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at kent+coc@doddsfamily.us. All -complaints will be reviewed and investigated and will result in a response that -is deemed necessary and appropriate to the circumstances. The project team is -obligated to maintain confidentiality with regard to the reporter of an -incident. Further details of specific enforcement policies may be posted -separately. +reported to the community leaders responsible for enforcement at +me+coc@kentcdodds.com. All complaints will be reviewed and investigated promptly +and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], -version 1.4, available at [http://contributor-covenant.org/version/1/4][version] +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. diff --git a/other/MAINTAINING.md b/other/MAINTAINING.md index 703126da..cade1c2a 100644 --- a/other/MAINTAINING.md +++ b/other/MAINTAINING.md @@ -32,9 +32,9 @@ any more of you than that. As a maintainer, you're fine to make your branches on the main repo or on your own fork. Either way is fine. -When we receive a pull request, a travis build is kicked off automatically (see -the `.travis.yml` for what runs in the travis build). We avoid merging anything -that breaks the travis build. +When we receive a pull request, a github action is kicked off automatically (see +the `.github/workflows/validate.yml` for what runs in the action). We avoid +merging anything that breaks the validate action. Please review PRs and focus on the code rather than the individual. You never know when this is someone's first ever PR and we want their experience to be as @@ -49,7 +49,7 @@ to release. See the next section on Releases for more about that. ## Release Our releases are automatic. They happen whenever code lands into `master`. A -travis build gets kicked off and if it's successful, a tool called +github action gets kicked off and if it's successful, a tool called [`semantic-release`](https://github.com/semantic-release/semantic-release) is used to automatically publish a new release to npm as well as a changelog to GitHub. It is only able to determine the version and whether a release is From 196c3fc531a3a9ba0a3ecfe8ec9ae3cdf0080630 Mon Sep 17 00:00:00 2001 From: Matan Borenkraout Date: Wed, 25 Nov 2020 18:29:53 +0200 Subject: [PATCH 2/5] chore: remove travis file --- .travis.yml | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index fdc18924..00000000 --- a/.travis.yml +++ /dev/null @@ -1,24 +0,0 @@ -language: node_js -env: - - FORCE_COLOR=true -cache: npm -notifications: - email: false -node_js: - - 10.14 - - 12 - - node -install: npm install -script: - - npm run validate - - npx codecov@3 -branches: - only: - - master - - beta - -jobs: - include: - - stage: release - node_js: 12 - script: kcd-scripts travis-release From a66edca3309d796200136621fd40f45304aeabd9 Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Wed, 25 Nov 2020 22:31:51 -0500 Subject: [PATCH 3/5] chore: force enabling colors for validate script --- .github/workflows/validate.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 5e627efb..08e4cd27 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -34,6 +34,8 @@ jobs: - name: ▶️ Run validate script run: npm run validate + env: + FORCE_COLOR: true - name: ⬆️ Upload coverage report uses: codecov/codecov-action@v1 From f43e65a2a0b55913c48d3ccb7d32a018cf85573d Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Wed, 25 Nov 2020 22:36:41 -0500 Subject: [PATCH 4/5] chore: use master branch --- .github/workflows/validate.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 08e4cd27..fa292e04 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -3,7 +3,7 @@ on: push: branches: - '+([0-9])?(.{+([0-9]),x}).x' - - 'main' + - 'master' - 'next' - 'next-major' - 'beta' @@ -45,7 +45,7 @@ jobs: runs-on: ubuntu-latest if: ${{ github.repository == 'testing-library/jest-dom' && - contains('refs/heads/main,refs/heads/beta,refs/heads/next,refs/heads/alpha', + contains('refs/heads/master,refs/heads/beta,refs/heads/next,refs/heads/alpha', github.ref) && github.event_name == 'push' }} steps: - name: ⬇️ Checkout repo @@ -71,7 +71,7 @@ jobs: branches: | [ '+([0-9])?(.{+([0-9]),x}).x', - 'main', + 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, From 8a566be45a37ced1e9e54a058ae5aa46445b8e95 Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Sat, 28 Nov 2020 23:28:47 -0500 Subject: [PATCH 5/5] chore: update Code of Conduct email address --- other/CODE_OF_CONDUCT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/other/CODE_OF_CONDUCT.md b/other/CODE_OF_CONDUCT.md index 47681ae0..cfe82c06 100644 --- a/other/CODE_OF_CONDUCT.md +++ b/other/CODE_OF_CONDUCT.md @@ -60,7 +60,7 @@ representative at an online or offline event. Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at -me+coc@kentcdodds.com. All complaints will be reviewed and investigated promptly +TestingLibraryOSS@gmail.com. All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the