@nx/playwright 20.3.2 → 20.4.0-beta.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/playwright",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.4.0-beta.1",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"homepage": "https://nx.dev",
|
|
6
6
|
"private": false,
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
38
|
-
"@nx/devkit": "20.
|
|
39
|
-
"@nx/eslint": "20.
|
|
40
|
-
"@nx/webpack": "20.
|
|
41
|
-
"@nx/vite": "20.
|
|
42
|
-
"@nx/js": "20.
|
|
38
|
+
"@nx/devkit": "20.4.0-beta.1",
|
|
39
|
+
"@nx/eslint": "20.4.0-beta.1",
|
|
40
|
+
"@nx/webpack": "20.4.0-beta.1",
|
|
41
|
+
"@nx/vite": "20.4.0-beta.1",
|
|
42
|
+
"@nx/js": "20.4.0-beta.1",
|
|
43
43
|
"tslib": "^2.3.0",
|
|
44
44
|
"minimatch": "9.0.3"
|
|
45
45
|
},
|
|
@@ -4,6 +4,7 @@ exports.configurationGenerator = configurationGenerator;
|
|
|
4
4
|
exports.configurationGeneratorInternal = configurationGeneratorInternal;
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
7
|
+
const prompt_1 = require("@nx/devkit/src/generators/prompt");
|
|
7
8
|
const js_1 = require("@nx/js");
|
|
8
9
|
const generator_prompts_1 = require("@nx/js/src/utils/generator-prompts");
|
|
9
10
|
const package_manager_workspaces_1 = require("@nx/js/src/utils/package-manager-workspaces");
|
|
@@ -36,7 +37,36 @@ async function configurationGeneratorInternal(tree, rawOptions) {
|
|
|
36
37
|
});
|
|
37
38
|
const isTsSolutionSetup = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree);
|
|
38
39
|
const tsconfigPath = (0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.json');
|
|
39
|
-
if (
|
|
40
|
+
if (tree.exists(tsconfigPath)) {
|
|
41
|
+
if (isTsSolutionSetup) {
|
|
42
|
+
const tsconfig = {
|
|
43
|
+
extends: (0, js_1.getRelativePathToRootTsConfig)(tree, projectConfig.root),
|
|
44
|
+
compilerOptions: {
|
|
45
|
+
allowJs: true,
|
|
46
|
+
outDir: 'out-tsc/playwright',
|
|
47
|
+
sourceMap: false,
|
|
48
|
+
},
|
|
49
|
+
include: [
|
|
50
|
+
(0, devkit_1.joinPathFragments)(options.directory, '**/*.ts'),
|
|
51
|
+
(0, devkit_1.joinPathFragments)(options.directory, '**/*.js'),
|
|
52
|
+
'playwright.config.ts',
|
|
53
|
+
],
|
|
54
|
+
exclude: ['out-tsc', 'test-output'],
|
|
55
|
+
};
|
|
56
|
+
// skip eslint from typechecking since it extends from root file that is outside rootDir
|
|
57
|
+
if (options.linter === 'eslint') {
|
|
58
|
+
tsconfig.exclude.push('eslint.config.js', 'eslint.config.mjs', 'eslint.config.cjs');
|
|
59
|
+
}
|
|
60
|
+
(0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.e2e.json'), tsconfig);
|
|
61
|
+
(0, devkit_1.updateJson)(tree, tsconfigPath, (json) => {
|
|
62
|
+
// add the project tsconfig to the workspace root tsconfig.json references
|
|
63
|
+
json.references ??= [];
|
|
64
|
+
json.references.push({ path: './tsconfig.e2e.json' });
|
|
65
|
+
return json;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
40
70
|
const tsconfig = {
|
|
41
71
|
extends: (0, js_1.getRelativePathToRootTsConfig)(tree, projectConfig.root),
|
|
42
72
|
compilerOptions: {
|
|
@@ -141,6 +171,11 @@ async function normalizeOptions(tree, options) {
|
|
|
141
171
|
(process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
142
172
|
nxJson.useInferencePlugins !== false);
|
|
143
173
|
const linter = await (0, generator_prompts_1.normalizeLinterOption)(tree, options.linter);
|
|
174
|
+
if (!options.webServerCommand || !options.webServerAddress) {
|
|
175
|
+
const { webServerCommand, webServerAddress } = await promptForMissingServeData(options.project);
|
|
176
|
+
options.webServerCommand = webServerCommand;
|
|
177
|
+
options.webServerAddress = webServerAddress;
|
|
178
|
+
}
|
|
144
179
|
return {
|
|
145
180
|
...options,
|
|
146
181
|
addPlugin,
|
|
@@ -148,6 +183,29 @@ async function normalizeOptions(tree, options) {
|
|
|
148
183
|
directory: options.directory ?? 'e2e',
|
|
149
184
|
};
|
|
150
185
|
}
|
|
186
|
+
async function promptForMissingServeData(projectName) {
|
|
187
|
+
const { command, port } = await (0, prompt_1.promptWhenInteractive)([
|
|
188
|
+
{
|
|
189
|
+
type: 'input',
|
|
190
|
+
name: 'command',
|
|
191
|
+
message: 'What command should be run to serve the application locally?',
|
|
192
|
+
initial: `npx nx serve ${projectName}`,
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
type: 'numeral',
|
|
196
|
+
name: 'port',
|
|
197
|
+
message: 'What port will the application be served on?',
|
|
198
|
+
initial: 3000,
|
|
199
|
+
},
|
|
200
|
+
], {
|
|
201
|
+
command: `npx nx serve ${projectName}`,
|
|
202
|
+
port: 3000,
|
|
203
|
+
});
|
|
204
|
+
return {
|
|
205
|
+
webServerCommand: command,
|
|
206
|
+
webServerAddress: `http://localhost:${port}`,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
151
209
|
function getBrowsersInstallTask() {
|
|
152
210
|
return () => {
|
|
153
211
|
devkit_1.output.log({
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { defineConfig, devices } from '@playwright/test';
|
|
2
2
|
import { nxE2EPreset } from '@nx/playwright/preset';
|
|
3
|
-
<% if(
|
|
4
|
-
import { workspaceRoot } from '@nx/devkit';
|
|
3
|
+
<% if (webServerCommand && webServerAddress) { %>import { workspaceRoot } from '@nx/devkit';<% } %>
|
|
5
4
|
|
|
6
5
|
// For CI, you may want to set BASE_URL to the deployed application.
|
|
7
6
|
const baseURL = process.env['BASE_URL'] || '<% if(webServerAddress) {%><%= webServerAddress %><% } else {%>http://localhost:3000<% } %>';
|