File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ [ ![ 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 )
2+ [ ![ codecov] ( https://codecov.io/gh/ianpurvis/jest-ctx/branch/trunk/graph/badge.svg?token=6BGJQKMJEL )] ( https://codecov.io/gh/ianpurvis/jest-ctx )
3+
14# jest-ctx
25
36Pass context to [ Jest] ( https://jestjs.io ) hooks and tests.
47
58## Getting Started
69
7- $ npm i -D github:ianpurvis/ jest-ctx.git
10+ $ npm i -D jest-ctx
811
9- $ yarn add -D github:ianpurvis/ jest-ctx.git
12+ $ yarn add -D jest-ctx
1013
1114` jest-ctx ` exports the same module interface as ` @jest/globals ` , so it is easy
1215to drop into your codebase:
@@ -197,6 +200,16 @@ by the usual args for each table row:
197200` test.concurrent ` and its variations are affected by a known issue with
198201` beforeEach ` (https://github.com/facebook/jest/issues/7997 )
199202
203+
204+ ### Typescript
205+
206+ Types should work as usual except that hooks and tests can now receive and
207+ return context:
208+
209+ beforeAll((): string => '🫐');
210+ it('has typed context', (ctx: string) => expect(ctx).toMatch('🫐'));
211+
212+
200213## License
201214
202215` jest-ctx ` is available as open source under the terms of the [ MIT License] ( LICENSE ) .
Original file line number Diff line number Diff line change 11{
22 "name" : " jest-ctx" ,
3- "version" : " 0 .0.0" ,
3+ "version" : " 1 .0.0" ,
44 "description" : " Pass context to jest hooks and tests" ,
55 "author" : " Ian Purvis <ian@purvisresearch.com>" ,
6+ "repository" : {
7+ "type" : " git" ,
8+ "url" : " https://github.com/ianpurvis/jest-ctx.git"
9+ },
610 "license" : " MIT" ,
711 "type" : " module" ,
812 "exports" : {
2630 },
2731 "peerDependencies" : {
2832 "jest" : " >=25.5.0"
29- }
33+ },
34+ "keywords" : [
35+ " jest" ,
36+ " context" ,
37+ " test" ,
38+ " testing" ,
39+ " javascript"
40+ ]
3041}
You can’t perform that action at this time.
0 commit comments