Commit 280fa84
fix(mock): only reuse currentContext owned by the same app
mockContext() reused this.currentContext without checking the context
belongs to this app. When the async-local context storage is shared
across app instances (multiple mm.app() apps in one realm, or vitest
`isolate: false` carry-over) app2.mockContext() could return app1's
context, binding helpers/services to the wrong app config — e.g.
security `surl` custom-protocol returning '' and csrf 401s.
Guard the reuse with `this.currentContext.app === this`.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 28cf009 commit 280fa84
1 file changed
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
104 | 109 | | |
105 | 110 | | |
106 | 111 | | |
| |||
0 commit comments