@nx/playwright 18.3.0-beta.0 → 18.3.0-beta.1
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +4 -4
- package/src/plugins/plugin.js +26 -7
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/playwright",
|
3
|
-
"version": "18.3.0-beta.
|
3
|
+
"version": "18.3.0-beta.1",
|
4
4
|
"type": "commonjs",
|
5
5
|
"homepage": "https://nx.dev",
|
6
6
|
"private": false,
|
@@ -33,9 +33,9 @@
|
|
33
33
|
},
|
34
34
|
"dependencies": {
|
35
35
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
36
|
-
"@nx/devkit": "18.3.0-beta.
|
37
|
-
"@nx/eslint": "18.3.0-beta.
|
38
|
-
"@nx/js": "18.3.0-beta.
|
36
|
+
"@nx/devkit": "18.3.0-beta.1",
|
37
|
+
"@nx/eslint": "18.3.0-beta.1",
|
38
|
+
"@nx/js": "18.3.0-beta.1",
|
39
39
|
"tslib": "^2.3.0",
|
40
40
|
"minimatch": "9.0.3"
|
41
41
|
},
|
package/src/plugins/plugin.js
CHANGED
@@ -39,14 +39,15 @@ exports.createNodes = [
|
|
39
39
|
const hash = (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [
|
40
40
|
(0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot)),
|
41
41
|
]);
|
42
|
-
const targets = targetsCache[hash] ??
|
42
|
+
const { targets, metadata } = targetsCache[hash] ??
|
43
43
|
(await buildPlaywrightTargets(configFilePath, projectRoot, normalizedOptions, context));
|
44
|
-
calculatedTargets[hash] = targets;
|
44
|
+
calculatedTargets[hash] = { targets, metadata };
|
45
45
|
return {
|
46
46
|
projects: {
|
47
47
|
[projectRoot]: {
|
48
48
|
root: projectRoot,
|
49
49
|
targets,
|
50
|
+
metadata,
|
50
51
|
},
|
51
52
|
},
|
52
53
|
};
|
@@ -60,11 +61,16 @@ async function buildPlaywrightTargets(configFilePath, projectRoot, options, cont
|
|
60
61
|
const playwrightConfig = await (0, config_utils_1.loadConfigFile)((0, path_1.join)(context.workspaceRoot, configFilePath));
|
61
62
|
const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
|
62
63
|
const targets = {};
|
64
|
+
let metadata;
|
63
65
|
const baseTargetConfig = {
|
64
66
|
command: 'playwright test',
|
65
67
|
options: {
|
66
68
|
cwd: '{projectRoot}',
|
67
69
|
},
|
70
|
+
metadata: {
|
71
|
+
technologies: ['playwright'],
|
72
|
+
description: 'Runs Playwright Tests',
|
73
|
+
},
|
68
74
|
};
|
69
75
|
targets[options.targetName] = {
|
70
76
|
...baseTargetConfig,
|
@@ -83,6 +89,9 @@ async function buildPlaywrightTargets(configFilePath, projectRoot, options, cont
|
|
83
89
|
: ['default', '^default'],
|
84
90
|
outputs: getOutputs(projectRoot, playwrightConfig),
|
85
91
|
};
|
92
|
+
const groupName = 'E2E (CI)';
|
93
|
+
metadata = { targetGroups: { [groupName]: [] } };
|
94
|
+
const ciTargetGroup = metadata.targetGroups[groupName];
|
86
95
|
const testDir = playwrightConfig.testDir
|
87
96
|
? (0, devkit_1.joinPathFragments)(projectRoot, playwrightConfig.testDir)
|
88
97
|
: projectRoot;
|
@@ -90,11 +99,16 @@ async function buildPlaywrightTargets(configFilePath, projectRoot, options, cont
|
|
90
99
|
playwrightConfig.testMatch ??= '**/*.@(spec|test).?(c|m)[jt]s?(x)';
|
91
100
|
const dependsOn = [];
|
92
101
|
forEachTestFile((testFile) => {
|
93
|
-
const
|
94
|
-
const targetName = `${options.ciTargetName}--${
|
102
|
+
const relativeSpecFilePath = (0, devkit_1.normalizePath)((0, path_1.relative)(projectRoot, testFile));
|
103
|
+
const targetName = `${options.ciTargetName}--${relativeSpecFilePath}`;
|
104
|
+
ciTargetGroup.push(targetName);
|
95
105
|
targets[targetName] = {
|
96
106
|
...ciBaseTargetConfig,
|
97
|
-
command: `${baseTargetConfig.command} ${
|
107
|
+
command: `${baseTargetConfig.command} ${relativeSpecFilePath}`,
|
108
|
+
metadata: {
|
109
|
+
technologies: ['playwright'],
|
110
|
+
description: `Runs Playwright Tests in ${relativeSpecFilePath} in CI`,
|
111
|
+
},
|
98
112
|
};
|
99
113
|
dependsOn.push({
|
100
114
|
target: targetName,
|
@@ -113,11 +127,16 @@ async function buildPlaywrightTargets(configFilePath, projectRoot, options, cont
|
|
113
127
|
inputs: ciBaseTargetConfig.inputs,
|
114
128
|
outputs: ciBaseTargetConfig.outputs,
|
115
129
|
dependsOn,
|
130
|
+
metadata: {
|
131
|
+
technologies: ['playwright'],
|
132
|
+
description: 'Runs Playwright Tests in CI',
|
133
|
+
},
|
116
134
|
};
|
135
|
+
ciTargetGroup.push(options.ciTargetName);
|
117
136
|
}
|
118
|
-
return targets;
|
137
|
+
return { targets, metadata };
|
119
138
|
}
|
120
|
-
|
139
|
+
function forEachTestFile(cb, opts) {
|
121
140
|
const files = (0, workspace_context_1.getFilesInDirectoryUsingContext)(opts.context.workspaceRoot, opts.path);
|
122
141
|
const matcher = createMatcher(opts.config.testMatch);
|
123
142
|
const ignoredMatcher = opts.config.testIgnore
|