-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 35d679c
Showing
19 changed files
with
10,505 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "@dword-design/babel-config" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"extends": [ | ||
"@commitlint/config-conventional" | ||
], | ||
"rules": { | ||
"body-max-line-length": [ | ||
0 | ||
], | ||
"footer-max-line-length": [ | ||
0 | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"path": "cz-conventional-changelog" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Editor configuration, see http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
max_line_length = off | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* text=auto eol=lf | ||
*.jpg filter=lfs diff=lfs merge=lfs -text | ||
*.png filter=lfs diff=lfs merge=lfs -text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
jobs: | ||
cancel-existing: | ||
if: "!contains(github.event.head_commit.message, '[skip ci]')" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
uses: rokroskar/[email protected] | ||
release: | ||
needs: test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
lfs: true | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 12 | ||
- run: git config --global user.email "[email protected]" | ||
- run: git config --global user.name "GitHub Actions" | ||
- run: yarn --frozen-lockfile | ||
- run: yarn lint | ||
- env: | ||
GITHUB_REPOSITORY: ${{ secrets.GITHUB_REPOSITORY }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
name: Push changed files | ||
run: yarn dw-ci push-changed-files | ||
- env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
if: github.ref == 'refs/heads/master' | ||
name: Release | ||
run: yarn semantic-release | ||
test: | ||
needs: cancel-existing | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
lfs: true | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
- run: yarn --frozen-lockfile | ||
- run: yarn test | ||
- run: yarn check-unknown-files | ||
- env: | ||
COVERALLS_GIT_BRANCH: ${{ github.ref }} | ||
COVERALLS_GIT_COMMIT: ${{ github.sha }} | ||
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
COVERALLS_SERVICE_NAME: github | ||
if: matrix.os == 'ubuntu-latest' && matrix.node == 12 | ||
name: Coveralls | ||
run: yarn dw-ci coveralls | ||
strategy: | ||
matrix: | ||
exclude: | ||
- node: 10 | ||
os: macos-latest | ||
- node: 10 | ||
os: windows-latest | ||
node: | ||
- 10 | ||
- 12 | ||
os: | ||
- macos-latest | ||
- windows-latest | ||
- ubuntu-latest | ||
name: build | ||
on: | ||
push: | ||
branches: | ||
- "**" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.DS_Store | ||
/.env.json | ||
/.eslintrc.json | ||
/.nyc_output | ||
/.test.env.json | ||
/coverage | ||
/dist | ||
/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Need to add :latest, otherwise old versions (e.g. of node) are installed | ||
FROM gitpod/workspace-full:latest | ||
|
||
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash | ||
RUN sudo apt-get install git-lfs | ||
RUN git lfs install | ||
|
||
# Puppeteer dependencies | ||
RUN sudo apt-get update && sudo apt-get install -y libgtk-3-0 libx11-xcb1 libnss3 libxss1 libasound2 libgbm1 libxshmfence1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
image: | ||
file: .gitpod.Dockerfile | ||
tasks: | ||
- init: git lfs pull | ||
- init: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >>~/.npmrc | ||
- init: yarn --frozen-lockfile | ||
vscode: | ||
extensions: | ||
- [email protected]:8jjyZYuYF6yW6nwsAiulrg== | ||
- [email protected]:pj4yxebPvdfdMeVIjOEuRQ== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"hooks": { | ||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS" | ||
}, | ||
"skipCI": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/changelog", | ||
"@semantic-release/npm", | ||
"@semantic-release/github", | ||
[ | ||
"@semantic-release/git", | ||
{ | ||
"message": "chore: ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"extends": [ | ||
":semanticCommits" | ||
], | ||
"labels": [ | ||
"maintenance" | ||
], | ||
"semanticCommitScope": null, | ||
"packageRules": [ | ||
{ | ||
"packagePatterns": [ | ||
"*" | ||
], | ||
"semanticCommitType": "chore" | ||
}, | ||
{ | ||
"depTypeList": [ | ||
"dependencies", | ||
"devDependencies", | ||
"peerDependencies", | ||
"optionalDependencies" | ||
], | ||
"semanticCommitType": "fix" | ||
} | ||
], | ||
"lockFileMaintenance": { | ||
"enabled": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"files.exclude": { | ||
".babelrc.json": true, | ||
".commitlintrc.json": true, | ||
".cz.json": true, | ||
".editorconfig": true, | ||
".eslintrc.json": true, | ||
".gitattributes": true, | ||
".github": true, | ||
".gitignore": true, | ||
".gitpod.Dockerfile": true, | ||
".gitpod.yml": true, | ||
".huskyrc.json": true, | ||
".nyc_output": true, | ||
".releaserc.json": true, | ||
".renovaterc.json": true, | ||
"CHANGELOG.md": true, | ||
"LICENSE.md": true, | ||
"coverage": true, | ||
"dist": true, | ||
"node_modules": true, | ||
"yarn.lock": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# License | ||
|
||
Unless stated otherwise all works are: | ||
|
||
Copyright © Sebastian Landwehr <[email protected]> | ||
|
||
and licensed under: | ||
|
||
[MIT License](https://opensource.org/licenses/MIT) | ||
|
||
## MIT License | ||
|
||
MIT License | ||
|
||
Copyright (c) <year> <copyright holders> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<!-- TITLE/ --> | ||
# expect-mocha-image-snapshot | ||
<!-- /TITLE --> | ||
|
||
<!-- BADGES/ --> | ||
[![NPM version](https://img.shields.io/npm/v/expect-mocha-image-snapshot.svg)](https://npmjs.org/package/expect-mocha-image-snapshot) | ||
![Linux macOS Windows compatible](https://img.shields.io/badge/os-linux%20%7C%C2%A0macos%20%7C%C2%A0windows-blue) | ||
[![Build status](https://github.com/undefined/workflows/build/badge.svg)](https://github.com/undefined/actions) | ||
[![Coverage status](https://img.shields.io/coveralls/undefined)](https://coveralls.io/github/undefined) | ||
[![Dependency status](https://img.shields.io/david/undefined)](https://david-dm.org/undefined) | ||
![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen) | ||
|
||
<a href="https://gitpod.io/#https://github.com/dword-design/bar"> | ||
<img src="https://gitpod.io/button/open-in-gitpod.svg" alt="Open in Gitpod"> | ||
</a><a href="https://www.buymeacoffee.com/dword"> | ||
<img | ||
src="https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg" | ||
alt="Buy Me a Coffee" | ||
height="32" | ||
> | ||
</a><a href="https://paypal.me/SebastianLandwehr"> | ||
<img | ||
src="https://dword-design.de/images/paypal.svg" | ||
alt="PayPal" | ||
height="32" | ||
> | ||
</a><a href="https://www.patreon.com/dworddesign"> | ||
<img | ||
src="https://dword-design.de/images/patreon.svg" | ||
alt="Patreon" | ||
height="32" | ||
> | ||
</a> | ||
<!-- /BADGES --> | ||
<!-- DESCRIPTION/ --> | ||
A wrapper around jest-image-snapshot that makes it compatible to Mocha. | ||
<!-- /DESCRIPTION --> | ||
|
||
Snapshot testing is very Jest-centered. There are not too many solutions for other testing frameworks to test against snapshots. Even less for image snapshots. There is [expect-mocha-snapshot](https://www.npmjs.com/package/expect-mocha-snapshot) that enables snapshot testing with Mocha and [expect](https://www.npmjs.com/package/expect). | ||
|
||
This package uses a similar approach to make [jest-image-snapshot](https://www.npmjs.com/package/jest-image-snapshot) Mocha compatible, allowing Mocha users to do image snapshot testing. | ||
|
||
<!-- INSTALL/ --> | ||
## Install | ||
|
||
```bash | ||
# NPM | ||
$ npm install expect-mocha-image-snapshot | ||
|
||
# Yarn | ||
$ yarn add expect-mocha-image-snapshot | ||
``` | ||
<!-- /INSTALL --> | ||
|
||
## Usage | ||
|
||
```js | ||
import expect from 'expect' | ||
import { toMatchImageSnapshot } from 'expect-mocha-image-snapshot' | ||
|
||
expect.extend({ toMatchImageSnapshot }) | ||
|
||
it('works', function () { | ||
... | ||
const screenshot = await puppeteer.screenshot() | ||
expect(screenshot).toMatchSnapshot(this) // this is important here | ||
}); | ||
``` | ||
|
||
Note that it is important to pass `this` to the matcher because it contains the test metadata. | ||
|
||
It is also possible to configure default options: | ||
|
||
```js | ||
import { configureToMatchImageSnapshot } from 'expect-mocha-image-snapshot' | ||
|
||
expect.extend({ | ||
toMatchImageSnapshot: configureToMatchImageSnapshot({ | ||
customSnapshotsDir: '__foo_image_snapshots__', | ||
}), | ||
}) | ||
``` | ||
See the [jest-image-snapshot docs](https://www.npmjs.com/package/jest-image-snapshot) for details. | ||
|
||
<!-- LICENSE/ --> | ||
## License | ||
|
||
Unless stated otherwise all works are: | ||
|
||
Copyright © Sebastian Landwehr <[email protected]> | ||
|
||
and licensed under: | ||
|
||
[MIT License](https://opensource.org/licenses/MIT) | ||
<!-- /LICENSE --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"name": "expect-mocha-image-snapshot", | ||
"version": "1.0.0", | ||
"description": "A wrapper around jest-image-snapshot that makes it compatible to Mocha.", | ||
"keywords": [ | ||
"jest", | ||
"image", | ||
"mocha", | ||
"snapshot" | ||
], | ||
"license": "MIT", | ||
"author": "Sebastian Landwehr <[email protected]>", | ||
"main": "dist/index.js", | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"check-unknown-files": "base check-unknown-files", | ||
"commit": "base commit", | ||
"dev": "base dev", | ||
"lint": "base lint", | ||
"prepare": "base prepare", | ||
"prepublishOnly": "base prepublishOnly", | ||
"test": "base test" | ||
}, | ||
"dependencies": { | ||
"jest-image-snapshot": "^4.4.0", | ||
"jest-snapshot": "^26.6.2" | ||
}, | ||
"devDependencies": { | ||
"@dword-design/base": "^7.2.0", | ||
"@dword-design/functions": "^1.2.0", | ||
"depcheck-package-name": "^1.0.1", | ||
"execa": "^5.0.0", | ||
"fs-extra": "^9.1.0", | ||
"jest-image-matcher": "^1.3.0", | ||
"mocha": "^8.3.0", | ||
"sharp": "^0.27.2", | ||
"with-local-tmp-dir": "^2.2.15" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
Oops, something went wrong.