@wp-tester/config 0.0.4 → 0.1.0

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.
Files changed (38) hide show
  1. package/dist/auto-mount.d.ts.map +1 -1
  2. package/dist/auto-mount.js +10 -1
  3. package/dist/auto-mount.js.map +1 -1
  4. package/dist/config.d.ts +15 -0
  5. package/dist/config.d.ts.map +1 -1
  6. package/dist/config.js +298 -21
  7. package/dist/config.js.map +1 -1
  8. package/dist/index.d.ts +3 -4
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +1 -2
  11. package/dist/index.js.map +1 -1
  12. package/dist/options/phpunit.js +11 -11
  13. package/dist/options/phpunit.js.map +1 -1
  14. package/dist/options/project-root.d.ts.map +1 -1
  15. package/dist/options/project-root.js +3 -2
  16. package/dist/options/project-root.js.map +1 -1
  17. package/dist/options/project-type-detect.d.ts +1 -1
  18. package/dist/options/project-type-detect.d.ts.map +1 -1
  19. package/dist/options/project-type-detect.js +2 -2
  20. package/dist/options/project-type-detect.js.map +1 -1
  21. package/dist/options/project-type.d.ts.map +1 -1
  22. package/dist/options/project-type.js +29 -5
  23. package/dist/options/project-type.js.map +1 -1
  24. package/dist/options/smoke-tests.d.ts.map +1 -1
  25. package/dist/options/smoke-tests.js +18 -6
  26. package/dist/options/smoke-tests.js.map +1 -1
  27. package/dist/phpunit.d.ts.map +1 -1
  28. package/dist/phpunit.js +14 -8
  29. package/dist/phpunit.js.map +1 -1
  30. package/dist/resolved-types.d.ts +22 -6
  31. package/dist/resolved-types.d.ts.map +1 -1
  32. package/dist/schema.json +1157 -1005
  33. package/dist/tsconfig.tsbuildinfo +1 -1
  34. package/dist/types.d.ts +1 -1
  35. package/dist/types.d.ts.map +1 -1
  36. package/dist/wp-tester-config.d.ts +153 -12
  37. package/dist/wp-tester-config.d.ts.map +1 -1
  38. package/package.json +1 -1
@@ -28,6 +28,19 @@ export type Blueprint = BlueprintV1Declaration | string;
28
28
  * @see https://wordpress.github.io/wordpress-playground/developers/local-development/wp-playground-cli#mounting-a-plugin-programmatically
29
29
  */
30
30
  export interface Mount extends PlaygroundMount {
31
+ /**
32
+ * Absolute or relative path on the host filesystem to mount.
33
+ * Relative paths are resolved from projectHostPath.
34
+ * @example "vendor/bin/phpunit"
35
+ * @example "/absolute/path/to/project"
36
+ */
37
+ hostPath: string;
38
+ /**
39
+ * Virtual filesystem path where the host path should be mounted.
40
+ * @example "/wordpress/wp-content/plugins/my-plugin"
41
+ * @example "/project"
42
+ */
43
+ vfsPath: string;
31
44
  /**
32
45
  * Whether to mount before WordPress installation.
33
46
  * When true, the mount happens before WordPress is installed.
@@ -95,14 +108,61 @@ export interface Tests {
95
108
  /**
96
109
  * PHPUnit test configuration.
97
110
  * When provided, runs PHPUnit tests with the specified paths.
98
- * When undefined, PHPUnit tests are disabled.
111
+ * When undefined, PHPUnit tests are not run.
99
112
  */
100
113
  phpunit?: PHPUnitConfig;
114
+ /**
115
+ * Watch mode configuration.
116
+ * Controls which files are watched when using --watch flag.
117
+ */
118
+ watch?: WatchConfig;
119
+ /**
120
+ * Allow the test suite to pass when no tests are executed.
121
+ * By default, wp-tester exits with code 1 when no tests are found.
122
+ * Set to true to exit with code 0 instead (similar to Jest's --passWithNoTests).
123
+ * @default false
124
+ */
125
+ passWithNoTests?: boolean;
101
126
  }
127
+ /**
128
+ * Base reporter options for filtering test results by status.
129
+ * All options default to false - only explicitly enabled statuses are shown.
130
+ */
131
+ export interface BaseReporterOptions {
132
+ /**
133
+ * Show passed tests in output
134
+ * @default false
135
+ */
136
+ passed?: boolean;
137
+ /**
138
+ * Show failed tests in output
139
+ * @default false
140
+ */
141
+ failed?: boolean;
142
+ /**
143
+ * Show skipped tests in output
144
+ * @default false
145
+ */
146
+ skipped?: boolean;
147
+ /**
148
+ * Show pending tests in output
149
+ * @default false
150
+ */
151
+ pending?: boolean;
152
+ /**
153
+ * Show other test statuses in output
154
+ * @default false
155
+ */
156
+ other?: boolean;
157
+ }
158
+ /**
159
+ * Default reporter configuration options
160
+ */
161
+ export type DefaultReporterOptions = BaseReporterOptions;
102
162
  /**
103
163
  * JSON reporter configuration options
104
164
  */
105
- export interface JsonReporterOptions {
165
+ export interface JsonReporterOptions extends BaseReporterOptions {
106
166
  /**
107
167
  * Path where the JSON report file should be written
108
168
  * @example "test-results.json"
@@ -111,14 +171,31 @@ export interface JsonReporterOptions {
111
171
  outputFile: string;
112
172
  }
113
173
  /**
114
- * Reporter configuration.
115
- * Can be a simple string for reporters without options,
116
- * or a tuple of [reporter name, options] for configurable reporters.
174
+ * Reporter configuration object.
175
+ * Each key is a reporter name, and the value is its options.
117
176
  *
118
- * @example "default"
119
- * @example ["json", { "outputFile": "results.json" }]
177
+ * @example {}
178
+ * @example { "default": { "failed": true, "passed": true } }
179
+ * @example { "json": { "outputFile": "results.json", "failed": true } }
180
+ */
181
+ export interface Reporters {
182
+ /**
183
+ * Default console reporter options.
184
+ * Use `true` to enable with defaults, or an object for custom options.
185
+ */
186
+ default?: boolean | DefaultReporterOptions;
187
+ /**
188
+ * JSON file reporter options
189
+ */
190
+ json?: JsonReporterOptions;
191
+ }
192
+ /**
193
+ * Environment variables for WordPress Playground.
194
+ * Key-value pairs of environment variable names and values.
195
+ * @example { "WP_DEBUG": "1", "WP_DEBUG_LOG": "1" }
196
+ * @default {}
120
197
  */
121
- export type Reporter = "default" | ["json", JsonReporterOptions];
198
+ export type EnvironmentVariables = Record<string, string>;
122
199
  /**
123
200
  * Test environment configuration.
124
201
  * Defines a WordPress environment with specific versions and setup.
@@ -130,16 +207,64 @@ export interface Environment {
130
207
  * @example "WooCommerce Environment"
131
208
  */
132
209
  name?: string;
210
+ /**
211
+ * PHP version(s) for this environment.
212
+ * Can be a single version string or an array of versions for matrix testing.
213
+ * When an array is provided, tests will run for each PHP version combined with each WP version.
214
+ * If blueprint.preferredVersions.php is also set, the blueprint value takes precedence
215
+ * and only that single version will be used.
216
+ * @example "8.2"
217
+ * @example ["8.1", "8.2", "8.3"]
218
+ */
219
+ php?: NonNullable<BlueprintV1Declaration["preferredVersions"]>["php"][];
220
+ /**
221
+ * WordPress version(s) for this environment.
222
+ * Can be a single version string or an array of versions for matrix testing.
223
+ * When an array is provided, tests will run for each WP version combined with each PHP version.
224
+ * If blueprint.preferredVersions.wp is also set, the blueprint value takes precedence
225
+ * and only that single version will be used.
226
+ * @example "6.7"
227
+ * @example ["6.6", "6.7"]
228
+ */
229
+ wp?: NonNullable<BlueprintV1Declaration["preferredVersions"]>["wp"][];
133
230
  /**
134
231
  * WordPress Playground Blueprint configuration.
135
232
  * Can be an inline blueprint object or a file path to a blueprint JSON file.
233
+ * If not specified, a default blueprint will be created using the php and wp version settings.
136
234
  */
137
- blueprint: Blueprint;
235
+ blueprint?: Blueprint;
138
236
  /**
139
237
  * Filesystem mounts to apply to this environment
140
238
  * @default []
141
239
  */
142
240
  mounts?: Mount[];
241
+ /**
242
+ * Environment variables to set when running PHPUnit tests
243
+ * @example { "WP_TESTS_DIR": "/custom/path" }
244
+ * @default {}
245
+ */
246
+ env?: EnvironmentVariables;
247
+ /**
248
+ * Whether this environment should be skipped.
249
+ * Skipped environments are excluded from test execution.
250
+ * Useful for temporarily excluding environments without removing them from configuration.
251
+ * @default false
252
+ */
253
+ skip?: boolean;
254
+ }
255
+ /**
256
+ * Watch mode configuration for automatic test re-runs.
257
+ */
258
+ export interface WatchConfig {
259
+ /**
260
+ * Glob patterns for files/directories to watch (relative to projectHostPath).
261
+ * If not specified, watches all files in the projectHostPath directory.
262
+ */
263
+ include?: string[];
264
+ /**
265
+ * Glob patterns to exclude from watching.
266
+ */
267
+ exclude?: string[];
143
268
  }
144
269
  /**
145
270
  * Complete wp-tester configuration.
@@ -159,6 +284,21 @@ export interface WPTesterConfig {
159
284
  * @example "./my-project"
160
285
  */
161
286
  projectHostPath?: string;
287
+ /**
288
+ * Path where your project directory will be mounted in the WordPress environment.
289
+ *
290
+ * When not specified, the path is automatically determined based on projectType:
291
+ * - plugin: /wordpress/wp-content/plugins/{dir-name}
292
+ * - theme: /wordpress/wp-content/themes/{dir-name}
293
+ * - wp-content: /wordpress/wp-content
294
+ * - wordpress: /wordpress
295
+ * - other: **Required** - You must specify where your project directory should be mounted
296
+ *
297
+ * @example "/project" - Mount your project at the root level
298
+ * @example "/wordpress/wp-content/mu-plugins/my-mu-plugin" - Mount as a must-use plugin
299
+ * @example "/wordpress/wp-content/plugins/my-custom-plugin" - Mount as a WordPress plugin
300
+ */
301
+ projectVFSPath?: string;
162
302
  /**
163
303
  * Detected WordPress project type.
164
304
  * Automatically detected during setup based on project structure.
@@ -176,9 +316,10 @@ export interface WPTesterConfig {
176
316
  */
177
317
  tests: Tests;
178
318
  /**
179
- * Output reporters for test results
180
- * @default ["default"]
319
+ * Output reporters for test results.
320
+ * Each reporter can be configured with filtering options.
321
+ * @default { "default": { "passed": true, "failed": true, "skipped": true, "pending": true, "other": true } }
181
322
  */
182
- reporters?: Reporter[];
323
+ reporters?: Reporters;
183
324
  }
184
325
  //# sourceMappingURL=wp-tester-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wp-tester-config.d.ts","sourceRoot":"","sources":["../src/wp-tester-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,KAAK,EAAE,KAAK,IAAI,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE;;;;;;;;;GASG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,aAAa,CAAC;AAG9C,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,sBAAsB,GAAG,MAAM,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,WAAW,KAAM,SAAQ,eAAe;IAC5C;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;A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,EAAE,KAAK,EAAE,CAAC;IAEjB;;;;OAIG;IACH,GAAG,CAAC,EAAE,oBAAoB,CAAC;IAE3B;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;;;;;;;;;OAaG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B;;;;;OAKG;IACH,YAAY,EAAE,WAAW,EAAE,CAAC;IAE5B;;OAEG;IACH,KAAK,EAAE,KAAK,CAAC;IAEb;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wp-tester/config",
3
- "version": "0.0.4",
3
+ "version": "0.1.0",
4
4
  "description": "Configuration management for wp-tester",
5
5
  "type": "module",
6
6
  "private": false,