runwarm 0.1.0-alpha.0 → 0.1.0-alpha.1

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,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.0-alpha.1
4
+
5
+ - Type declarations for `defineAppProfile` and `withApp`.
6
+ - `funding` field pointing to GitHub Sponsors.
7
+ - The npm page now shows the npm install instructions and describes how the pool works without a Mermaid diagram.
8
+
3
9
  ## 0.1.0-alpha.0
4
10
 
5
11
  First pre-release.
package/README.md CHANGED
@@ -29,10 +29,10 @@ When integration tests start the same app in every file, they repeat the work of
29
29
 
30
30
  ## Quick start
31
31
 
32
- RunWarm needs Node.js 22.12.0 or later and node-tap 21.8.1 or later. It is not on npm yet, so build a tarball from a clone with `npm pack` and install it in your project.
32
+ RunWarm needs Node.js 22.12.0 or later and node-tap 21.8.1 or later. Install it from npm. Until the first stable version, this installs the latest alpha.
33
33
 
34
34
  ```sh
35
- npm install --save-dev ./runwarm-0.1.0-alpha.0.tgz
35
+ npm install --save-dev runwarm
36
36
  npx tap plugin add runwarm/plugin
37
37
  npx tap --disable-coverage --app-profile=profile.js
38
38
  ```
@@ -90,17 +90,11 @@ The HTTPS example reads PEM files from `EXAMPLE_TLS_CERT` and `EXAMPLE_TLS_KEY`.
90
90
 
91
91
  ### How the pool works
92
92
 
93
- ```mermaid
94
- flowchart LR
95
- subgraph Runner[tap runner]
96
- Plugin[RunWarm plugin and pool coordinator]
97
- end
98
- Runner --> Test[Test file]
99
- Test -->|Reserve and release over a local socket| Plugin
100
- Plugin -->|Lifecycle commands over IPC| Worker[Application worker]
101
- Test -->|HTTP or HTTPS| Worker
102
- Worker --> Profile[Application profile and resources]
103
- ```
93
+ 1. The tap runner loads the plugin, which starts the pool coordinator.
94
+ 2. Each test file reserves a worker from the coordinator over a local socket.
95
+ 3. The coordinator sends lifecycle commands to the application worker over IPC, and the worker runs your profile.
96
+ 4. The test sends HTTP or HTTPS requests straight to the application.
97
+ 5. On release, the worker resets the application and takes the next case.
104
98
 
105
99
  The runner listens on a Unix socket in a private temporary directory, or on a named pipe on Windows, with a random token for each run. Workers start on demand and callers queue in arrival order when all are busy. Test requests go directly to the application. If preparation or reset fails, or the client disconnects during a reservation, the coordinator discards the affected worker. Lifecycle commands time out after 30 seconds.
106
100
 
@@ -123,9 +117,8 @@ npm run --silent benchmark -- --framework fastify --bootstrap-ms 0
123
117
 
124
118
  ## Status and roadmap
125
119
 
126
- RunWarm is an early alpha (`0.1.0-alpha.0`). The acceptance suite installs the package as a user would and covers reuse and reset, concurrent reservations, failing profiles, crashed workers, disconnected clients and interrupted runs.
120
+ RunWarm is an early alpha (`0.1.0-alpha.1`). The acceptance suite installs the package as a user would and covers reuse and reset, concurrent reservations, failing profiles, crashed workers, disconnected clients and interrupted runs.
127
121
 
128
- - Publish the first pre-release to npm.
129
122
  - Publish benchmark results for the plugin.
130
123
  - Measure a real CI suite with a database-backed profile and background jobs.
131
124
  - Collect application coverage and track changed files for `tap --changed`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runwarm",
3
- "version": "0.1.0-alpha.0",
3
+ "version": "0.1.0-alpha.1",
4
4
  "description": "node-tap plugin that keeps HTTP applications warm between integration tests",
5
5
  "keywords": [
6
6
  "tapjs plugin",
@@ -20,6 +20,7 @@
20
20
  "url": "https://github.com/fabenejr/runwarm/issues"
21
21
  },
22
22
  "homepage": "https://github.com/fabenejr/runwarm#readme",
23
+ "funding": "https://github.com/sponsors/fabenejr",
23
24
  "files": [
24
25
  "src",
25
26
  "CHANGELOG.md"
@@ -29,7 +30,10 @@
29
30
  "node": ">=22.12.0"
30
31
  },
31
32
  "exports": {
32
- ".": "./src/client.js",
33
+ ".": {
34
+ "types": "./src/client.d.ts",
35
+ "default": "./src/client.js"
36
+ },
33
37
  "./plugin": {
34
38
  "types": "./src/tap-plugin.d.ts",
35
39
  "default": "./src/tap-plugin.js"
@@ -0,0 +1,21 @@
1
+ export interface HookContext {
2
+ workerId: string
3
+ }
4
+
5
+ export interface CaseContext extends HookContext {
6
+ caseName: string
7
+ }
8
+
9
+ export interface AppProfile<App extends { url: string }> {
10
+ start(context: HookContext): App | Promise<App>
11
+ prepare?(app: App, context: CaseContext): unknown
12
+ reset(app: App, context: CaseContext): unknown
13
+ stop(app: App): unknown
14
+ }
15
+
16
+ export declare function defineAppProfile<App extends { url: string }>(profile: AppProfile<App>): AppProfile<App>
17
+
18
+ export declare function withApp<T>(
19
+ caseName: string,
20
+ run: (app: { url: string; workerId: string }) => T | Promise<T>,
21
+ ): Promise<T>