Plugin e2e tests bug
See original GitHub issueCurrent Behavior
E2e tests fails
Expected Behavior
E2e tests should work properly
Steps to Reproduce
- npx create-nx-plugin plugin-e2e --pluginName my-plugin
- Add plugin to nx.json under tmp/nx-e2e/proj
it('should create my-plugin', async () => {
const plugin = uniq('my-plugin');
ensureNxProject('@plugin-e2e/my-plugin', 'dist/packages/my-plugin');
let nxJson = readJson('nx.json');
nxJson.plugins = ['@plugin-e2e/my-plugin'];
updateFile('nx.json', JSON.stringify(nxJson));
await runNxCommandAsync(
`generate @plugin-e2e/my-plugin:my-plugin ${plugin}`
);
const result = await runNxCommandAsync(`build ${plugin}`);
expect(result.stdout).toContain('Executor ran');
}, 120000);
- Run e2e tests
nx e2e my-plugin-e2e --skip-nx-cache
the error is in this fuction
function findPluginPackageJson(path, plugin) {
while (true) {
if (!path.startsWith(app_root_1.appRootPath)) {
throw new Error("Couldn't find a package.json for Nx plugin:" + plugin);
}
if ((0, fs_1.existsSync)((0, path_1.join)(path, 'package.json'))) {
return (0, path_1.join)(path, 'package.json');
}
path = (0, path_1.dirname)(path);
}
}
this condition if (!path.startsWith(app_root_1.appRootPath))
not work in this case because the plugin is not inside the e2e workspace but inside dist folder of the root workspace
Failure Logs
[NX Daemon Server] - 2022-02-28T10:56:43.512Z - Error detected when creating a project graph: Couldn't find a package.json for Nx plugin:@plugin-e2e/my-plugin
[NX Daemon Server] - 2022-02-28T10:56:43.512Z - [REQUEST]: Responding to the client with an error. Error when preparing serialized project graph. Couldn't find a package.json for Nx plugin:@plugin-e2e/my-plugin
Error: Couldn't find a package.json for Nx plugin:@plugin-e2e/my-plugin
at findPluginPackageJson (D:\Workspace\Projects\plugin-e2e\tmp\nx-e2e\proj\node_modules\@nrwl\tao\src\shared\nx-plugin.js:12:19)
at D:\Workspace\Projects\plugin-e2e\tmp\nx-e2e\proj\node_modules\@nrwl\tao\src\shared\nx-plugin.js:28:64
at Array.map (<anonymous>)
at loadNxPlugins (D:\Workspace\Projects\plugin-e2e\tmp\nx-e2e\proj\node_modules\@nrwl\tao\src\shared\nx-plugin.js:24:38)
at D:\Workspace\Projects\plugin-e2e\tmp\nx-e2e\proj\node_modules\@nrwl\workspace\src\core\project-graph\build-nodes\workspace-projects.js:17:119
at Array.forEach (<anonymous>)
at buildWorkspaceProjectNodes (D:\Workspace\Projects\plugin-e2e\tmp\nx-e2e\proj\node_modules\@nrwl\workspace\src\core\project-graph\build-nodes\workspace-projects.js:11:41)
at D:\Workspace\Projects\plugin-e2e\tmp\nx-e2e\proj\node_modules\@nrwl\workspace\src\core\project-graph\build-project-graph.js:73:54
at Generator.next (<anonymous>)
at D:\Workspace\Projects\plugin-e2e\tmp\nx-e2e\proj\node_modules\tslib\tslib.js:117:75
Environment
nx report
NX Report complete - copy this into the issue template
Node : 16.14.0 OS : win32 x64 npm : 8.3.1
nx : 13.8.3 @nrwl/angular : undefined @nrwl/cli : 13.8.3 @nrwl/cypress : undefined @nrwl/detox : undefined @nrwl/devkit : 13.8.3 @nrwl/eslint-plugin-nx : 13.8.3 @nrwl/express : undefined @nrwl/jest : 13.8.3 @nrwl/js : undefined @nrwl/linter : 13.8.3 @nrwl/nest : undefined @nrwl/next : undefined @nrwl/node : 13.8.3 @nrwl/nx-cloud : undefined @nrwl/react : undefined @nrwl/react-native : undefined @nrwl/schematics : undefined @nrwl/storybook : undefined @nrwl/tao : 13.8.3 @nrwl/web : undefined @nrwl/workspace : 13.8.3 typescript : 4.5.5 rxjs : 6.6.7
Community plugins: @nrwl/nx-plugin: 13.8.3
(node:25856) [DEP0148] DeprecationWarning: Use of deprecated folder mapping “./” in the “exports” field module resolution of the package at D:\Workspace\Projects\plugin-e2e\node_modules\tslib\package.json.
Update this package.json to use a subpath pattern like “./*”.
(Use node --trace-deprecation ...
to show where the warning was created)
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
wordpress/e2e-tests | Block Editor Handbook
Note that there's currently an ongoing project to migrate E2E tests to ... This package is deprecated and will only accept bug fixes...
Read more >@wordpress/e2e-test-utils - npm
Note that there's currently an ongoing project to migrate E2E tests to Playwright instead. This package is deprecated and will only accept bug...
Read more >Adding End 2 End Tests to WordPress plugins using wp-env ...
I recently published a video walking through how End to End tests are set up for WPGraphQL, but I thought it would be...
Read more >@vue/cli-plugin-e2e-cypress | Yarn - Package Manager
This adds E2E testing support using Cypress. Cypress offers a rich interactive interface for running E2E tests in Firefox and Chromium based browsers ......
Read more >Writing and Organizing Tests - Cypress Documentation
Test files are located in cypress/e2e by default, but can be configured to ... While the Cypress tests execute in the browser, the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
They local plugins stuff is available in
nx@next
, can you test it out and see if it still fails?Hey @khalilou88! I think this will be fixed by the changes in #9116.