-
-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[solution] Cypress & with Yarn PnP #108
Comments
Cleaner version: const path = require("node:path");
/* ref: https://yarnpkg.com/advanced/pnpapi */
require(path.join(process.cwd(), ".pnp.cjs")).setup();
const REPORTER = "cypress-mochawesome-reporter";
const resolve = () => {
const cwd = process.cwd() + "/";
try {
const { createRequire, findPnpApi } = require(`module`);
const targetPnp = findPnpApi(cwd);
const targetRequire = createRequire(cwd);
const resolved = targetPnp.resolveRequest(REPORTER, cwd);
return targetRequire(resolved);
} catch (error) {
console.error(REPORTER + ".js: error =", error);
throw error;
}
};
module.exports = resolve(); |
This breaks with new yarn4 PNP api |
if you can open a PR and a test for that, it would be great. |
I have a question. I’m working in a monorepo environment using Yarn Berry 3.x.x with PnP. Thanks to the code you provided, I successfully generated the report by using the appropriate paths. (Thank you!) However, when I added import "cypress-mochawesome-reporter/register"; to e2e.ts, Webpack fails to resolve the register path. How did you resolve the issue with the register? error code on cli
|
Is your feature request related to a problem? Please describe.
The cause:
Describe the solution you'd like
Step #1: Add
mocha
a required yarn package, so yarn PnP can resolve it for Cypress.Step #2: create in the root of the project file
cypress-mochawesome-reporter.js
with content:Follow the original configuration steps.
Describe alternatives you've considered
Refs:
Additional context
Cypress reporter executed in "isolated" node instance that does not have enabled P'n'P logic.
The text was updated successfully, but these errors were encountered: