Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 1.0.0 #11

Merged
merged 6 commits into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
[![CI](https://github.com/ianpurvis/jest-ctx/actions/workflows/ci.yml/badge.svg?branch=trunk)](https://github.com/ianpurvis/jest-ctx/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/ianpurvis/jest-ctx/branch/trunk/graph/badge.svg?token=6BGJQKMJEL)](https://codecov.io/gh/ianpurvis/jest-ctx)

# jest-ctx

Pass context to [Jest](https://jestjs.io) hooks and tests.

## Getting Started

$ npm i -D github:ianpurvis/jest-ctx.git
$ npm i -D jest-ctx

$ yarn add -D github:ianpurvis/jest-ctx.git
$ yarn add -D jest-ctx

`jest-ctx` exports the same module interface as `@jest/globals`, so it is easy
to drop into your codebase:
Expand Down Expand Up @@ -197,6 +200,16 @@ by the usual args for each table row:
`test.concurrent` and its variations are affected by a known issue with
`beforeEach` (https://github.com/facebook/jest/issues/7997)


### Typescript

Types should work as usual except that hooks and tests can now receive and
return context:

beforeAll((): string => '🫐');
it('has typed context', (ctx: string) => expect(ctx).toMatch('🫐'));


## License

`jest-ctx` is available as open source under the terms of the [MIT License](LICENSE).
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 13 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"name": "jest-ctx",
"version": "0.0.0",
"version": "1.0.0",
"description": "Pass context to jest hooks and tests",
"author": "Ian Purvis <ian@purvisresearch.com>",
"repository": {
"type": "git",
"url": "https://github.com/ianpurvis/jest-ctx.git"
},
"license": "MIT",
"type": "module",
"exports": {
Expand All @@ -26,5 +30,12 @@
},
"peerDependencies": {
"jest": ">=25.5.0"
}
},
"keywords": [
"jest",
"context",
"test",
"testing",
"javascript"
]
}