kinde-testkit 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.2
4
+
5
+ - Show the README diagrams as images, so they display on npm as well as GitHub.
6
+
7
+ ## 0.2.1
8
+
9
+ - Add CI on GitHub Actions: typecheck, tests and build on Node 22 and 24, a runtime check of the built package on Node 20, and the Next.js example's browser tests.
10
+ - Upgrade the development toolchain to Vitest 5 and esbuild 0.28. Nothing changes in the published package.
11
+
3
12
  ## 0.2.0
4
13
 
5
14
  - Add the authorization code flow: a sign-in page at `/oauth2/auth` with seeded users, an organization picker, `org_code`, `login_hint`, `nonce`, `audience`, PKCE and `prompt=none`.
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # kinde-testkit
2
2
 
3
+ [![CI](https://github.com/sholajegede/kinde-testkit/actions/workflows/ci.yml/badge.svg)](https://github.com/sholajegede/kinde-testkit/actions/workflows/ci.yml) [![npm](https://img.shields.io/npm/v/kinde-testkit)](https://www.npmjs.com/package/kinde-testkit)
4
+
3
5
  Test apps that use Kinde without a live Kinde environment. kinde-testkit runs a small issuer on localhost that does what your app needs from Kinde during a test: a sign-in page with test users, the OAuth endpoints Kinde's SDKs call, and access tokens that look like Kinde's, signed with a local key. Your app runs its real Kinde SDK and its real JWT checks against it.
4
6
 
5
7
  There are two ways to use it:
@@ -20,25 +22,7 @@ The last group is hard to produce against a real Kinde tenant at all. These are
20
22
 
21
23
  ## How it works
22
24
 
23
- ```mermaid
24
- flowchart LR
25
- subgraph tests[Your test suite]
26
- S["scenario()<br/>admin, viewer, other org,<br/>expired, unsigned..."]
27
- end
28
- subgraph kit[kinde-testkit on localhost]
29
- K[Test signing key]
30
- D["/.well-known/openid-configuration"]
31
- J["/.well-known/jwks"]
32
- end
33
- subgraph app[Your app, unchanged]
34
- M[JWT middleware]
35
- R[Routes and permission checks]
36
- end
37
- S -- "tokenFor(scenario)" --> K
38
- K -- "Bearer token" --> M
39
- M -- "fetch keys" --> J
40
- M --> R
41
- ```
25
+ ![Your tests ask kinde-testkit for a token, your app checks it against the testkit's JWKS, and your routes answer 200, 401 or 403](https://raw.githubusercontent.com/sholajegede/kinde-testkit/main/docs/how-it-works.png)
42
26
 
43
27
  1. You describe who is calling with `scenario()`.
44
28
  2. kinde-testkit signs an RS256 access token for that scenario with a key that exists only on your machine.
@@ -49,19 +33,7 @@ Nothing is mocked inside your app. If the middleware forgets to check the audien
49
33
 
50
34
  Browser sign-in follows the same flow your app uses with Kinde:
51
35
 
52
- ```mermaid
53
- sequenceDiagram
54
- participant T as Playwright test
55
- participant A as Your app (Kinde SDK)
56
- participant K as kinde-testkit
57
- T->>A: open /api/auth/login
58
- A->>K: redirect to /oauth2/auth
59
- T->>K: pick admin@example.test
60
- K->>A: redirect to callback with a code
61
- A->>K: POST /oauth2/token (code)
62
- K->>A: access, ID and refresh tokens
63
- A->>T: signed-in page
64
- ```
36
+ ![A Playwright test opens the app's login route, picks a user on the kinde-testkit sign-in page, and the app exchanges the code for tokens](https://raw.githubusercontent.com/sholajegede/kinde-testkit/main/docs/sign-in-flow.png)
65
37
 
66
38
  ## Install
67
39
 
@@ -69,7 +41,7 @@ sequenceDiagram
69
41
  npm install --save-dev kinde-testkit
70
42
  ```
71
43
 
72
- Node 20 or later.
44
+ Node 20 or later. Working on kinde-testkit itself needs Node 22.12 or later, because its test runner, Vitest 5, does.
73
45
 
74
46
  ## Quick start with Vitest
75
47
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kinde-testkit",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Test Kinde-authenticated apps offline: a local issuer with a real sign-in flow, Kinde-shaped tokens, reusable auth scenarios, and Vitest and Playwright helpers.",
5
5
  "license": "MIT",
6
6
  "author": "Shola Jegede <jegedeshola@gmail.com>",
@@ -71,8 +71,8 @@
71
71
  "jose": "^6.2.17"
72
72
  },
73
73
  "peerDependencies": {
74
- "vitest": ">=2",
75
- "@playwright/test": ">=1.40"
74
+ "@playwright/test": ">=1.40",
75
+ "vitest": ">=2"
76
76
  },
77
77
  "peerDependenciesMeta": {
78
78
  "vitest": {
@@ -88,6 +88,9 @@
88
88
  "@types/node": "^22.10.0",
89
89
  "tsup": "^8.3.5",
90
90
  "typescript": "^5.7.0",
91
- "vitest": "^3.0.0"
91
+ "vitest": "^5.1.0"
92
+ },
93
+ "overrides": {
94
+ "esbuild": "^0.28.1"
92
95
  }
93
96
  }