@wp-tester/config 0.0.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/README.md +18 -0
- package/dist/auto-mount.d.ts +11 -0
- package/dist/auto-mount.d.ts.map +1 -0
- package/dist/auto-mount.js +31 -0
- package/dist/auto-mount.js.map +1 -0
- package/dist/config.d.ts +41 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +213 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/options/index.d.ts +38 -0
- package/dist/options/index.d.ts.map +1 -0
- package/dist/options/index.js +23 -0
- package/dist/options/index.js.map +1 -0
- package/dist/options/phpunit-detect.d.ts +43 -0
- package/dist/options/phpunit-detect.d.ts.map +1 -0
- package/dist/options/phpunit-detect.js +94 -0
- package/dist/options/phpunit-detect.js.map +1 -0
- package/dist/options/phpunit.d.ts +12 -0
- package/dist/options/phpunit.d.ts.map +1 -0
- package/dist/options/phpunit.js +307 -0
- package/dist/options/phpunit.js.map +1 -0
- package/dist/options/project-root.d.ts +4 -0
- package/dist/options/project-root.d.ts.map +1 -0
- package/dist/options/project-root.js +38 -0
- package/dist/options/project-root.js.map +1 -0
- package/dist/options/project-type-detect.d.ts +27 -0
- package/dist/options/project-type-detect.d.ts.map +1 -0
- package/dist/options/project-type-detect.js +71 -0
- package/dist/options/project-type-detect.js.map +1 -0
- package/dist/options/project-type.d.ts +7 -0
- package/dist/options/project-type.d.ts.map +1 -0
- package/dist/options/project-type.js +50 -0
- package/dist/options/project-type.js.map +1 -0
- package/dist/options/smoke-tests.d.ts +4 -0
- package/dist/options/smoke-tests.d.ts.map +1 -0
- package/dist/options/smoke-tests.js +80 -0
- package/dist/options/smoke-tests.js.map +1 -0
- package/dist/path-mappers.d.ts +26 -0
- package/dist/path-mappers.d.ts.map +1 -0
- package/dist/path-mappers.js +32 -0
- package/dist/path-mappers.js.map +1 -0
- package/dist/resolved-types.d.ts +69 -0
- package/dist/resolved-types.d.ts.map +1 -0
- package/dist/resolved-types.js +2 -0
- package/dist/resolved-types.js.map +1 -0
- package/dist/schema.json +3443 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/wp-tester-config.d.ts +171 -0
- package/dist/wp-tester-config.d.ts.map +1 -0
- package/dist/wp-tester-config.js +2 -0
- package/dist/wp-tester-config.js.map +1 -0
- package/package.json +40 -0
package/README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# @wp-tester/config
|
|
2
|
+
|
|
3
|
+
Configuration management for wp-tester.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Type-safe configuration definitions
|
|
8
|
+
- Config file read/write operations
|
|
9
|
+
- JSON schema generation and validation
|
|
10
|
+
- Configuration option handlers
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import { readConfigFile, WPTesterConfig } from '@wp-tester/config';
|
|
16
|
+
|
|
17
|
+
const config: WPTesterConfig = await readConfigFile();
|
|
18
|
+
```
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ProjectType } from "./options/project-type-detect.js";
|
|
2
|
+
import type { Mount } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Get the mount point path for a project based on its type
|
|
5
|
+
*
|
|
6
|
+
* @param projectDir - Absolute path to the project directory
|
|
7
|
+
* @param projectType - The project type
|
|
8
|
+
* @returns Mount configuration or null if type doesn't require mounting
|
|
9
|
+
*/
|
|
10
|
+
export declare function getProjectRootMount(projectDir: string, projectType: ProjectType): Mount | null;
|
|
11
|
+
//# sourceMappingURL=auto-mount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-mount.d.ts","sourceRoot":"","sources":["../src/auto-mount.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,WAAW,GACvB,KAAK,GAAG,IAAI,CAkBd"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// TODO: Replace with import from @wp-playground/cli/mounts
|
|
2
|
+
// once that package exports the /mounts subpath with runtime code.
|
|
3
|
+
// These functions are based on:
|
|
4
|
+
// https://github.com/WordPress/wordpress-playground/blob/trunk/packages/playground/cli/src/mounts.ts
|
|
5
|
+
import { basename } from "path";
|
|
6
|
+
/**
|
|
7
|
+
* Get the mount point path for a project based on its type
|
|
8
|
+
*
|
|
9
|
+
* @param projectDir - Absolute path to the project directory
|
|
10
|
+
* @param projectType - The project type
|
|
11
|
+
* @returns Mount configuration or null if type doesn't require mounting
|
|
12
|
+
*/
|
|
13
|
+
export function getProjectRootMount(projectDir, projectType) {
|
|
14
|
+
const dirName = basename(projectDir);
|
|
15
|
+
switch (projectType) {
|
|
16
|
+
case "plugin":
|
|
17
|
+
return {
|
|
18
|
+
hostPath: projectDir,
|
|
19
|
+
vfsPath: `/wordpress/wp-content/plugins/${dirName}`,
|
|
20
|
+
};
|
|
21
|
+
case "theme":
|
|
22
|
+
return {
|
|
23
|
+
hostPath: projectDir,
|
|
24
|
+
vfsPath: `/wordpress/wp-content/themes/${dirName}`,
|
|
25
|
+
};
|
|
26
|
+
default:
|
|
27
|
+
// For wp-content, wordpress-install, or unknown types, no mount
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=auto-mount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-mount.js","sourceRoot":"","sources":["../src/auto-mount.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,mEAAmE;AACnE,gCAAgC;AAChC,qGAAqG;AAErG,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAIhC;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CACjC,UAAkB,EAClB,WAAwB;IAExB,MAAM,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;IAErC,QAAQ,WAAW,EAAE,CAAC;QACpB,KAAK,QAAQ;YACX,OAAO;gBACL,QAAQ,EAAE,UAAU;gBACpB,OAAO,EAAE,iCAAiC,OAAO,EAAE;aACpD,CAAC;QACJ,KAAK,OAAO;YACV,OAAO;gBACL,QAAQ,EAAE,UAAU;gBACpB,OAAO,EAAE,gCAAgC,OAAO,EAAE;aACnD,CAAC;QACJ;YACE,gEAAgE;YAChE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { WPTesterConfig } from "./wp-tester-config.js";
|
|
2
|
+
import type { ResolvedWPTesterConfig } from "./resolved-types.js";
|
|
3
|
+
export type { WPTesterConfig } from "./wp-tester-config.js";
|
|
4
|
+
export declare function configPath(): string;
|
|
5
|
+
export declare function getSchemaPath(importMetaUrl?: string): string;
|
|
6
|
+
export declare function getDefaultConfig(): WPTesterConfig;
|
|
7
|
+
export declare function isConfigWritable(): Promise<boolean>;
|
|
8
|
+
export declare function readConfigFile(path?: string): Promise<WPTesterConfig>;
|
|
9
|
+
export declare function writeConfigFile(config: WPTesterConfig, path?: string): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Get the absolute config file path.
|
|
12
|
+
*
|
|
13
|
+
* @param config - Path to config file (relative or absolute)
|
|
14
|
+
* @returns Absolute path to the config file
|
|
15
|
+
*/
|
|
16
|
+
export declare function getConfigPath(config: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Get the config file directory path.
|
|
19
|
+
*
|
|
20
|
+
* @param configPath - Path to config file
|
|
21
|
+
* @returns Directory path where the config file is located
|
|
22
|
+
*/
|
|
23
|
+
export declare function getConfigDir(configPath: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Get the project root directory path.
|
|
26
|
+
*
|
|
27
|
+
* Returns config.projectHostPath if specified (resolved relative to config file or as absolute),
|
|
28
|
+
* otherwise returns the config file's directory.
|
|
29
|
+
*
|
|
30
|
+
* @param config - Config object
|
|
31
|
+
* @param configPath - Optional path to config file (needed to resolve relative projectHostPath)
|
|
32
|
+
* @returns Absolute path to the project root directory
|
|
33
|
+
*/
|
|
34
|
+
export declare function getProjectDir(config: WPTesterConfig, configPath?: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Resolve config from path or object and adjust relative paths to absolute paths
|
|
37
|
+
* @param config - Config file path or config object
|
|
38
|
+
* @returns Config with all paths resolved to absolute paths, blueprints loaded, and all required fields set
|
|
39
|
+
*/
|
|
40
|
+
export declare function resolveConfig(config: WPTesterConfig | string): Promise<ResolvedWPTesterConfig>;
|
|
41
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAuB,MAAM,kBAAkB,CAAC;AASpF,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAezD,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED,wBAAgB,aAAa,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CA+B5D;AAED,wBAAgB,gBAAgB,IAAI,cAAc,CAgBjD;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAOzD;AAED,wBAAsB,cAAc,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAM3E;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,cAAc,EACtB,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAKf;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,cAAc,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAWjF;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,cAAc,GAAG,MAAM,GAC9B,OAAO,CAAC,sBAAsB,CAAC,CA2FjC"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { readFile, writeFile, access, constants as fsConstants } from "fs/promises";
|
|
2
|
+
import { existsSync } from "fs";
|
|
3
|
+
import { join, dirname, resolve, isAbsolute } from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
import { getProjectRootMount } from "./auto-mount.js";
|
|
6
|
+
import { detectProjectType } from "./options/project-type-detect.js";
|
|
7
|
+
/**
|
|
8
|
+
* Resolve a path to an absolute path.
|
|
9
|
+
* If the path is already absolute, return it as-is.
|
|
10
|
+
* Otherwise, resolve it relative to the base directory.
|
|
11
|
+
*
|
|
12
|
+
* @param path - Path to resolve (relative or absolute)
|
|
13
|
+
* @param baseDir - Base directory to resolve relative paths from
|
|
14
|
+
* @returns Absolute path
|
|
15
|
+
*/
|
|
16
|
+
function resolveAbsolute(path, baseDir) {
|
|
17
|
+
return isAbsolute(path) ? path : resolve(baseDir, path);
|
|
18
|
+
}
|
|
19
|
+
export function configPath() {
|
|
20
|
+
return join(process.cwd(), "wp-tester.json");
|
|
21
|
+
}
|
|
22
|
+
export function getSchemaPath(importMetaUrl) {
|
|
23
|
+
// For ESM in production (built files)
|
|
24
|
+
if (importMetaUrl) {
|
|
25
|
+
const currentDir = dirname(fileURLToPath(importMetaUrl));
|
|
26
|
+
return join(currentDir, "schema.json");
|
|
27
|
+
}
|
|
28
|
+
// For CommonJS (built files)
|
|
29
|
+
if (typeof __dirname !== "undefined") {
|
|
30
|
+
return join(__dirname, "schema.json");
|
|
31
|
+
}
|
|
32
|
+
// For dev mode: try to find the config package
|
|
33
|
+
// Could be in monorepo (packages/config) or installed (node_modules)
|
|
34
|
+
const candidates = [
|
|
35
|
+
// Monorepo from root
|
|
36
|
+
join(process.cwd(), "packages/config/src/schema.json"),
|
|
37
|
+
// Monorepo from a package directory
|
|
38
|
+
join(process.cwd(), "../config/src/schema.json"),
|
|
39
|
+
// Installed package
|
|
40
|
+
join(process.cwd(), "node_modules/@wp-tester/config/dist/esm/schema.json"),
|
|
41
|
+
];
|
|
42
|
+
for (const candidate of candidates) {
|
|
43
|
+
if (existsSync(candidate)) {
|
|
44
|
+
return candidate;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// Last resort
|
|
48
|
+
return candidates[candidates.length - 1];
|
|
49
|
+
}
|
|
50
|
+
export function getDefaultConfig() {
|
|
51
|
+
return {
|
|
52
|
+
environments: [
|
|
53
|
+
{
|
|
54
|
+
name: "Latest WordPress and PHP",
|
|
55
|
+
blueprint: {
|
|
56
|
+
preferredVersions: {
|
|
57
|
+
php: "latest",
|
|
58
|
+
wp: "latest",
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
tests: {},
|
|
64
|
+
reporters: ["default"],
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export async function isConfigWritable() {
|
|
68
|
+
try {
|
|
69
|
+
await access(configPath(), fsConstants.F_OK);
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
export async function readConfigFile(path) {
|
|
77
|
+
if (!path) {
|
|
78
|
+
path = configPath();
|
|
79
|
+
}
|
|
80
|
+
const content = await readFile(path, "utf8");
|
|
81
|
+
return JSON.parse(content);
|
|
82
|
+
}
|
|
83
|
+
export async function writeConfigFile(config, path) {
|
|
84
|
+
if (!path) {
|
|
85
|
+
path = configPath();
|
|
86
|
+
}
|
|
87
|
+
await writeFile(path, JSON.stringify(config, null, 2), "utf8");
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Get the absolute config file path.
|
|
91
|
+
*
|
|
92
|
+
* @param config - Path to config file (relative or absolute)
|
|
93
|
+
* @returns Absolute path to the config file
|
|
94
|
+
*/
|
|
95
|
+
export function getConfigPath(config) {
|
|
96
|
+
return isAbsolute(config) ? config : resolve(process.cwd(), config);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Get the config file directory path.
|
|
100
|
+
*
|
|
101
|
+
* @param configPath - Path to config file
|
|
102
|
+
* @returns Directory path where the config file is located
|
|
103
|
+
*/
|
|
104
|
+
export function getConfigDir(configPath) {
|
|
105
|
+
return dirname(getConfigPath(configPath));
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Get the project root directory path.
|
|
109
|
+
*
|
|
110
|
+
* Returns config.projectHostPath if specified (resolved relative to config file or as absolute),
|
|
111
|
+
* otherwise returns the config file's directory.
|
|
112
|
+
*
|
|
113
|
+
* @param config - Config object
|
|
114
|
+
* @param configPath - Optional path to config file (needed to resolve relative projectHostPath)
|
|
115
|
+
* @returns Absolute path to the project root directory
|
|
116
|
+
*/
|
|
117
|
+
export function getProjectDir(config, configPath) {
|
|
118
|
+
// Get base directory: config file location or cwd
|
|
119
|
+
const baseDir = configPath ? getConfigDir(configPath) : process.cwd();
|
|
120
|
+
// If projectHostPath is specified, resolve it relative to base directory
|
|
121
|
+
if (config.projectHostPath) {
|
|
122
|
+
return resolveAbsolute(config.projectHostPath, baseDir);
|
|
123
|
+
}
|
|
124
|
+
// No projectHostPath specified, return base directory
|
|
125
|
+
return baseDir;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Resolve config from path or object and adjust relative paths to absolute paths
|
|
129
|
+
* @param config - Config file path or config object
|
|
130
|
+
* @returns Config with all paths resolved to absolute paths, blueprints loaded, and all required fields set
|
|
131
|
+
*/
|
|
132
|
+
export async function resolveConfig(config) {
|
|
133
|
+
let resolvedConfig;
|
|
134
|
+
let configPath;
|
|
135
|
+
if (typeof config === "string") {
|
|
136
|
+
configPath = getConfigPath(config);
|
|
137
|
+
const content = await readFile(configPath, "utf8");
|
|
138
|
+
resolvedConfig = JSON.parse(content);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
// Config object provided
|
|
142
|
+
resolvedConfig = config;
|
|
143
|
+
configPath = undefined;
|
|
144
|
+
}
|
|
145
|
+
// Get the project root directory (respects projectHostPath config option)
|
|
146
|
+
const projectDir = getProjectDir(resolvedConfig, configPath);
|
|
147
|
+
// Ensure projectType is set (detect if not provided)
|
|
148
|
+
const projectType = resolvedConfig.projectType || detectProjectType(projectDir);
|
|
149
|
+
// Ensure reporters is set
|
|
150
|
+
const reporters = resolvedConfig.reporters || ["default"];
|
|
151
|
+
// Resolve environments: convert Environment[] to ResolvedEnvironment[]
|
|
152
|
+
const resolvedEnvironments = await Promise.all(resolvedConfig.environments.map(async (env) => {
|
|
153
|
+
// Resolve blueprint from string to BlueprintV1Declaration if needed
|
|
154
|
+
let blueprint;
|
|
155
|
+
if (typeof env.blueprint === "string") {
|
|
156
|
+
const blueprintPath = resolveAbsolute(env.blueprint, projectDir);
|
|
157
|
+
const blueprintContent = await readFile(blueprintPath, "utf-8");
|
|
158
|
+
blueprint = JSON.parse(blueprintContent);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
blueprint = env.blueprint;
|
|
162
|
+
}
|
|
163
|
+
// Auto-detect and add mounts if needed
|
|
164
|
+
let mounts = env.mounts || [];
|
|
165
|
+
if (mounts.length === 0 && resolvedConfig.projectHostPath) {
|
|
166
|
+
const mount = getProjectRootMount(projectDir, projectType);
|
|
167
|
+
if (mount) {
|
|
168
|
+
mounts = [mount];
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// Resolve relative mount paths to absolute paths
|
|
172
|
+
const resolvedMounts = mounts.map((mount) => ({
|
|
173
|
+
...mount,
|
|
174
|
+
hostPath: resolveAbsolute(mount.hostPath, projectDir),
|
|
175
|
+
}));
|
|
176
|
+
return {
|
|
177
|
+
name: env.name,
|
|
178
|
+
blueprint,
|
|
179
|
+
mounts: resolvedMounts,
|
|
180
|
+
};
|
|
181
|
+
}));
|
|
182
|
+
// Resolve PHPUnit paths to absolute paths
|
|
183
|
+
let resolvedTests = resolvedConfig.tests;
|
|
184
|
+
if (resolvedTests.phpunit) {
|
|
185
|
+
resolvedTests = {
|
|
186
|
+
...resolvedTests,
|
|
187
|
+
phpunit: {
|
|
188
|
+
phpunitPath: resolveAbsolute(resolvedTests.phpunit.phpunitPath, projectDir),
|
|
189
|
+
configPath: resolveAbsolute(resolvedTests.phpunit.configPath, projectDir),
|
|
190
|
+
...(resolvedTests.phpunit.bootstrapPath && {
|
|
191
|
+
bootstrapPath: resolveAbsolute(resolvedTests.phpunit.bootstrapPath, projectDir),
|
|
192
|
+
}),
|
|
193
|
+
...(resolvedTests.phpunit.testMode && {
|
|
194
|
+
testMode: resolvedTests.phpunit.testMode,
|
|
195
|
+
}),
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
// Get project VFS path from the mount
|
|
200
|
+
const mount = getProjectRootMount(projectDir, projectType);
|
|
201
|
+
const projectVFSPath = mount?.vfsPath || projectDir;
|
|
202
|
+
// Return fully resolved config with all required fields
|
|
203
|
+
return {
|
|
204
|
+
...resolvedConfig,
|
|
205
|
+
projectHostPath: projectDir,
|
|
206
|
+
projectVFSPath,
|
|
207
|
+
projectType,
|
|
208
|
+
reporters,
|
|
209
|
+
environments: resolvedEnvironments,
|
|
210
|
+
tests: resolvedTests,
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAIlE;;;;;;;;GAQG;AACH,SAAS,eAAe,CAAC,IAAY,EAAE,OAAe;IACpD,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,gBAAgB,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,aAAsB;IAClD,sCAAsC;IACtC,IAAI,aAAa,EAAE,CAAC;QAClB,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC;QACzD,OAAO,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IACzC,CAAC;IAED,6BAA6B;IAC7B,IAAI,OAAO,SAAS,KAAK,WAAW,EAAE,CAAC;QACrC,OAAO,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;IACxC,CAAC;IAED,+CAA+C;I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,EAAE,OAAO,IAAI,UAAU,CAAC;IAEpD,wDAAwD;IACxD,OAAO;QACL,GAAG,cAAc;QACjB,eAAe,EAAE,UAAU;QAC3B,cAAc;QACd,WAAW;QACX,SAAS;QACT,YAAY,EAAE,oBAAoB;QAClC,KAAK,EAAE,aAAa;KACrB,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type { WPTesterConfig, Environment, Tests, PHPUnitConfig, TestType, Reporter, Mount, Blueprint, JsonReporterOptions, } from './types.js';
|
|
2
|
+
export type { ResolvedEnvironment, ResolvedWPTesterConfig, } from './resolved-types.js';
|
|
3
|
+
export { readConfigFile, writeConfigFile, configPath, getSchemaPath, getDefaultConfig, isConfigWritable, resolveConfig, getProjectDir, getConfigDir, getConfigPath, } from './config.js';
|
|
4
|
+
export { getProjectRootMount } from './auto-mount.js';
|
|
5
|
+
export { hostToVfs, vfsToHost } from './path-mappers.js';
|
|
6
|
+
export type { ProjectType } from './options/project-type-detect.js';
|
|
7
|
+
export { optionNames, optionMap, setupOptions, type OptionName, type ConfigOption, type ConfigOptionContext } from './options/index.js';
|
|
8
|
+
export { smokeTestsOption } from './options/smoke-tests.js';
|
|
9
|
+
export { phpunitOption } from './options/phpunit.js';
|
|
10
|
+
export { findPhpUnitConfig, findPhpUnitExecutable, findPhpUnitBootstrap, parseBootstrapPath, detectPhpUnitConfig, type DetectedPHPUnitConfig } from './options/phpunit-detect.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,cAAc,EACd,WAAW,EACX,KAAK,EACL,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,SAAS,EACT,mBAAmB,GACpB,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,cAAc,EACd,eAAe,EACf,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,YAAY,EACZ,aAAa,GACd,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACtD,YAAY,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAGjE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACrI,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,KAAK,qBAAqB,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Functions
|
|
2
|
+
export { readConfigFile, writeConfigFile, configPath, getSchemaPath, getDefaultConfig, isConfigWritable, resolveConfig, getProjectDir, getConfigDir, getConfigPath, } from './config.js';
|
|
3
|
+
export { getProjectRootMount } from './auto-mount.js';
|
|
4
|
+
export { hostToVfs, vfsToHost } from './path-mappers.js';
|
|
5
|
+
// Options
|
|
6
|
+
export { optionNames, optionMap, setupOptions } from './options/index.js';
|
|
7
|
+
export { smokeTestsOption } from './options/smoke-tests.js';
|
|
8
|
+
export { phpunitOption } from './options/phpunit.js';
|
|
9
|
+
export { findPhpUnitConfig, findPhpUnitExecutable, findPhpUnitBootstrap, parseBootstrapPath, detectPhpUnitConfig } from './options/phpunit-detect.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAmBA,YAAY;AACZ,OAAO,EACL,cAAc,EACd,eAAe,EACf,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,YAAY,EACZ,aAAa,GACd,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGtD,UAAU;AACV,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAgE,MAAM,iBAAiB,CAAC;AACrI,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,mBAAmB,EAA8B,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { WPTesterConfig } from '../types.js';
|
|
2
|
+
import { projectRootOption } from './project-root.js';
|
|
3
|
+
import { projectTypeOption } from './project-type.js';
|
|
4
|
+
import { smokeTestsOption } from './smoke-tests.js';
|
|
5
|
+
import { phpunitOption } from './phpunit.js';
|
|
6
|
+
export interface ConfigOptionContext {
|
|
7
|
+
configPath?: string;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
export type ConfigOption = (config: WPTesterConfig, context?: ConfigOptionContext) => Promise<WPTesterConfig>;
|
|
11
|
+
export interface ConfigOptionDefinition {
|
|
12
|
+
handler: ConfigOption;
|
|
13
|
+
getContext?: (configPath: string) => ConfigOptionContext;
|
|
14
|
+
}
|
|
15
|
+
declare const optionMapInternal: {
|
|
16
|
+
'project-root': {
|
|
17
|
+
handler: typeof projectRootOption;
|
|
18
|
+
};
|
|
19
|
+
'project-type': {
|
|
20
|
+
handler: typeof projectTypeOption;
|
|
21
|
+
};
|
|
22
|
+
'smoke-tests': {
|
|
23
|
+
handler: typeof smokeTestsOption;
|
|
24
|
+
};
|
|
25
|
+
phpunit: {
|
|
26
|
+
handler: typeof phpunitOption;
|
|
27
|
+
getContext: (configPath: string) => {
|
|
28
|
+
promptIfNotDetected: boolean;
|
|
29
|
+
configPath: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export declare const optionMap: Record<string, ConfigOptionDefinition>;
|
|
34
|
+
export type OptionName = keyof typeof optionMapInternal;
|
|
35
|
+
export declare const optionNames: Array<OptionName>;
|
|
36
|
+
export declare const setupOptions: ConfigOption[];
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/options/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,mBAAmB,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;AAE9G,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,YAAY,CAAC;IACtB,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,mBAAmB,CAAC;CAC1D;AAED,QAAA,MAAM,iBAAiB;;;;;;;;;;;;iCAYM,MAAM;;;;;CAEe,CAAC;AAEnD,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAqB,CAAC;AAEnF,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,iBAAiB,CAAC;AAExD,eAAO,MAAM,WAAW,EAAqC,KAAK,CAAC,UAAU,CAAC,CAAC;AAE/E,eAAO,MAAM,YAAY,gBAAmD,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { projectRootOption } from './project-root.js';
|
|
2
|
+
import { projectTypeOption } from './project-type.js';
|
|
3
|
+
import { smokeTestsOption } from './smoke-tests.js';
|
|
4
|
+
import { phpunitOption } from './phpunit.js';
|
|
5
|
+
const optionMapInternal = {
|
|
6
|
+
'project-root': {
|
|
7
|
+
handler: projectRootOption,
|
|
8
|
+
},
|
|
9
|
+
'project-type': {
|
|
10
|
+
handler: projectTypeOption,
|
|
11
|
+
},
|
|
12
|
+
'smoke-tests': {
|
|
13
|
+
handler: smokeTestsOption,
|
|
14
|
+
},
|
|
15
|
+
'phpunit': {
|
|
16
|
+
handler: phpunitOption,
|
|
17
|
+
getContext: (configPath) => ({ promptIfNotDetected: true, configPath }),
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export const optionMap = optionMapInternal;
|
|
21
|
+
export const optionNames = Object.keys(optionMapInternal);
|
|
22
|
+
export const setupOptions = Object.values(optionMap).map(opt => opt.handler);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/options/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAc1C,MAAM,iBAAiB,GAAG;IACxB,cAAc,EAAE;QACd,OAAO,EAAE,iBAAiB;KAC3B;IACD,cAAc,EAAE;QACd,OAAO,EAAE,iBAAiB;KAC3B;IACD,aAAa,EAAE;QACb,OAAO,EAAE,gBAAgB;KAC1B;IACD,SAAS,EAAE;QACT,OAAO,EAAE,aAAa;QACtB,UAAU,EAAE,CAAC,UAAkB,EAAE,EAAE,CAAC,CAAC,EAAE,mBAAmB,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;KAChF;CAC+C,CAAC;AAEnD,MAAM,CAAC,MAAM,SAAS,GAA2C,iBAAiB,CAAC;AAInF,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAsB,CAAC;AAE/E,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detected PHPUnit configuration
|
|
3
|
+
*/
|
|
4
|
+
export interface DetectedPHPUnitConfig {
|
|
5
|
+
/**
|
|
6
|
+
* Path to PHPUnit executable (relative to project root)
|
|
7
|
+
*/
|
|
8
|
+
phpunitPath: string;
|
|
9
|
+
/**
|
|
10
|
+
* Path to PHPUnit configuration file (relative to project root)
|
|
11
|
+
*/
|
|
12
|
+
configPath: string;
|
|
13
|
+
/**
|
|
14
|
+
* Path to PHPUnit bootstrap file (relative to project root)
|
|
15
|
+
* Optional - if not provided, only the custom wp-tester bootstrap will be used
|
|
16
|
+
*/
|
|
17
|
+
bootstrapPath?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Find the PHPUnit config file (phpunit.xml or phpunit.xml.dist)
|
|
21
|
+
*/
|
|
22
|
+
export declare function findPhpUnitConfig(basePath: string): Promise<string | null>;
|
|
23
|
+
/**
|
|
24
|
+
* Find the PHPUnit bootstrap file
|
|
25
|
+
* @param basePath
|
|
26
|
+
*/
|
|
27
|
+
export declare function findPhpUnitBootstrap(basePath: string): Promise<string | null>;
|
|
28
|
+
/**
|
|
29
|
+
* Find the PHPUnit executable path
|
|
30
|
+
* @param basePath
|
|
31
|
+
*/
|
|
32
|
+
export declare function findPhpUnitExecutable(basePath: string): Promise<string | null>;
|
|
33
|
+
/**
|
|
34
|
+
* Parse the bootstrap file path from PHPUnit config
|
|
35
|
+
* Returns the bootstrap path or null if not found
|
|
36
|
+
*/
|
|
37
|
+
export declare function parseBootstrapPath(configPath: string): Promise<string | null>;
|
|
38
|
+
/**
|
|
39
|
+
* Detect PHPUnit configuration from a project directory
|
|
40
|
+
* Returns a complete PHPUnit configuration or null if PHPUnit is not detected
|
|
41
|
+
*/
|
|
42
|
+
export declare function detectPhpUnitConfig(basePath: string): Promise<DetectedPHPUnitConfig | null>;
|
|
43
|
+
//# sourceMappingURL=phpunit-detect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phpunit-detect.d.ts","sourceRoot":"","sources":["../../src/options/phpunit-detect.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAchF;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAcnF;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAepF;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAgBnF;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAgBvC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { access, readFile } from 'fs/promises';
|
|
2
|
+
import { join, relative } from 'path';
|
|
3
|
+
/**
|
|
4
|
+
* Find the PHPUnit config file (phpunit.xml or phpunit.xml.dist)
|
|
5
|
+
*/
|
|
6
|
+
export async function findPhpUnitConfig(basePath) {
|
|
7
|
+
const configFiles = ['phpunit.xml', 'phpunit.xml.dist'];
|
|
8
|
+
for (const file of configFiles) {
|
|
9
|
+
const configPath = join(basePath, file);
|
|
10
|
+
try {
|
|
11
|
+
await access(configPath);
|
|
12
|
+
return configPath;
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
// File doesn't exist, continue checking
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Find the PHPUnit bootstrap file
|
|
22
|
+
* @param basePath
|
|
23
|
+
*/
|
|
24
|
+
export async function findPhpUnitBootstrap(basePath) {
|
|
25
|
+
const bootstrapFiles = ['tests/bootstrap.php'];
|
|
26
|
+
for (const file of bootstrapFiles) {
|
|
27
|
+
const bootstrapPath = join(basePath, file);
|
|
28
|
+
try {
|
|
29
|
+
await access(bootstrapPath);
|
|
30
|
+
return bootstrapPath;
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
// File doesn't exist, continue checking
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Find the PHPUnit executable path
|
|
40
|
+
* @param basePath
|
|
41
|
+
*/
|
|
42
|
+
export async function findPhpUnitExecutable(basePath) {
|
|
43
|
+
const possiblePaths = [
|
|
44
|
+
join(basePath, 'vendor', 'bin', 'phpunit'),
|
|
45
|
+
];
|
|
46
|
+
for (const execPath of possiblePaths) {
|
|
47
|
+
try {
|
|
48
|
+
await access(execPath);
|
|
49
|
+
return execPath;
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// File doesn't exist, continue checking
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Parse the bootstrap file path from PHPUnit config
|
|
59
|
+
* Returns the bootstrap path or null if not found
|
|
60
|
+
*/
|
|
61
|
+
export async function parseBootstrapPath(configPath) {
|
|
62
|
+
try {
|
|
63
|
+
const content = await readFile(configPath, 'utf-8');
|
|
64
|
+
// Simple XML parsing to find bootstrap attribute
|
|
65
|
+
// Look for bootstrap="path/to/bootstrap.php"
|
|
66
|
+
const bootstrapMatch = content.match(/bootstrap\s*=\s*["']([^"']+)["']/);
|
|
67
|
+
if (bootstrapMatch && bootstrapMatch[1]) {
|
|
68
|
+
return bootstrapMatch[1];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
// Failed to read or parse config
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Detect PHPUnit configuration from a project directory
|
|
78
|
+
* Returns a complete PHPUnit configuration or null if PHPUnit is not detected
|
|
79
|
+
*/
|
|
80
|
+
export async function detectPhpUnitConfig(basePath) {
|
|
81
|
+
const configPath = await findPhpUnitConfig(basePath);
|
|
82
|
+
const phpunitPath = await findPhpUnitExecutable(basePath);
|
|
83
|
+
// Bootstrap path is optional
|
|
84
|
+
if (!configPath || !phpunitPath) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
const bootstrapPath = await findPhpUnitBootstrap(basePath);
|
|
88
|
+
return {
|
|
89
|
+
phpunitPath: relative(basePath, phpunitPath),
|
|
90
|
+
configPath: relative(basePath, configPath),
|
|
91
|
+
...(bootstrapPath && { bootstrapPath: relative(basePath, bootstrapPath) }),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=phpunit-detect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phpunit-detect.js","sourceRoot":"","sources":["../../src/options/phpunit-detect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAuBtC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,QAAgB;IACtD,MAAM,WAAW,GAAG,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;IAExD,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;QAC/B,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC;YACzB,OAAO,UAAU,CAAC;QACpB,CAAC;QAAC,MAAM,CAAC;YACP,wCAAwC;QAC1C,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,QAAgB;IACzD,MAAM,cAAc,GAAG,CAAC,qBAAqB,CAAC,CAAC;IAE/C,KAAK,MAAM,IAAI,IAAI,cAAc,EAAE,CAAC;QAClC,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;YAC5B,OAAO,aAAa,CAAC;QACvB,C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O,IAAI,CAAC;IACd,CAAC;IAED,MAAM,aAAa,GAAG,MAAM,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAE3D,OAAO;QACL,WAAW,EAAE,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;QAC5C,UAAU,EAAE,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;QAC1C,GAAG,CAAC,aAAa,IAAI,EAAE,aAAa,EAAE,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,EAAE,CAAC;KAC3E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { WPTesterConfig } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* PHPUnit config option
|
|
4
|
+
* Detects PHPUnit tests and asks user if they want to run them
|
|
5
|
+
* @param config - Current configuration
|
|
6
|
+
* @param context - Optional context object with configPath and other options
|
|
7
|
+
*/
|
|
8
|
+
export declare function phpunitOption(config: WPTesterConfig, context?: {
|
|
9
|
+
configPath?: string;
|
|
10
|
+
promptIfNotDetected?: boolean;
|
|
11
|
+
}): Promise<WPTesterConfig>;
|
|
12
|
+
//# sourceMappingURL=phpunit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phpunit.d.ts","sourceRoot":"","sources":["../../src/options/phpunit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,UAAU,CAAC;AAqW9D;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,cAAc,EACtB,OAAO,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAAE,GAC/D,OAAO,CAAC,cAAc,CAAC,CAuBzB"}
|