@scenarist/nextjs-adapter 0.1.11 → 0.1.12
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/README.md +20 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,17 +64,17 @@ This package provides complete Next.js integration for Scenarist's scenario mana
|
|
|
64
64
|
|
|
65
65
|
## 📖 Documentation
|
|
66
66
|
|
|
67
|
-
**
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
| **🎯 React Server Components Guide** | [scenarist.io/frameworks/nextjs-app-router/rsc-guide](https://scenarist.io/frameworks/nextjs-app-router/rsc-guide)
|
|
75
|
-
| **
|
|
76
|
-
| **
|
|
77
|
-
| **Testing
|
|
67
|
+
**Choose your router:**
|
|
68
|
+
|
|
69
|
+
- **→ [App Router Getting Started](https://scenarist.io/frameworks/nextjs-app-router/getting-started)** — Server Components, Route Handlers, Server Actions
|
|
70
|
+
- **→ [Pages Router Getting Started](https://scenarist.io/frameworks/nextjs-pages-router/getting-started)** — API Routes, getServerSideProps, getStaticProps
|
|
71
|
+
|
|
72
|
+
| Topic | Link |
|
|
73
|
+
| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
|
|
74
|
+
| **🎯 React Server Components Guide** | [scenarist.io/frameworks/nextjs-app-router/rsc-guide](https://scenarist.io/frameworks/nextjs-app-router/rsc-guide) |
|
|
75
|
+
| **Why Scenarist?** | [scenarist.io/getting-started/why-scenarist](https://scenarist.io/getting-started/why-scenarist) |
|
|
76
|
+
| **Tool Comparison** | [scenarist.io/comparison](https://scenarist.io/comparison) |
|
|
77
|
+
| **Parallel Testing** | [scenarist.io/testing/parallel-testing](https://scenarist.io/testing/parallel-testing) |
|
|
78
78
|
|
|
79
79
|
## Core Capabilities
|
|
80
80
|
|
|
@@ -355,9 +355,16 @@ if (typeof window === "undefined" && scenarist) {
|
|
|
355
355
|
> export const scenarist = createScenarist({ enabled: true, scenarios });
|
|
356
356
|
> ```
|
|
357
357
|
>
|
|
358
|
-
> **Why:** Next.js
|
|
358
|
+
> **Why:** Next.js has a [well-documented singleton problem](https://github.com/vercel/next.js/discussions/68572) where webpack bundles modules multiple times across different chunks, breaking the classic JavaScript singleton pattern. This is compounded by [MSW's process model challenges with Next.js](https://github.com/mswjs/msw/issues/1644)—Next.js keeps multiple Node.js processes that make global module patches difficult to maintain.
|
|
359
|
+
>
|
|
360
|
+
> **Symptoms of this problem:**
|
|
361
|
+
>
|
|
362
|
+
> - `[MSW] Multiple handlers with the same URL pattern` warnings
|
|
363
|
+
> - Intermittent 500 errors during tests
|
|
364
|
+
> - Scenarios not switching properly
|
|
365
|
+
> - Different tests getting wrong scenario responses
|
|
359
366
|
>
|
|
360
|
-
>
|
|
367
|
+
> **How Scenarist solves this:** The `createScenarist()` function includes built-in singleton protection using `globalThis` guards, ensuring only ONE MSW instance exists even when Next.js duplicates your module. This protection **only works if you export a constant**—wrapping in a function bypasses the singleton guard.
|
|
361
368
|
|
|
362
369
|
### 3. Create Scenario Endpoint
|
|
363
370
|
|
package/package.json
CHANGED