-
-
Notifications
You must be signed in to change notification settings - Fork 78
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
config file cypress.config.ts invalid after update to 5.0.1 #243
Comments
Hi @kolorfilm, it looks to me that it is not recognizing the Ts file, maybe it is because of a special TS config. If that doesn't work, then if you can provide a workspace with the code maybe I can take a look at it |
I'm running into an identical issue on today's cypress v13.9.0. Version 5.0.1 is broken, but 5.0.0 seems to be working. |
Hi there 🙋♂️, strangely nothing has changed a while for the tsconfig.ts. Running a monorepo and have more tsconfig files for different folders, but as I said, it worked before. The tsconfig in the parent folder of the app: app/ts.config.json
the in the subfolder where the config folder with the actual cypress plugin is running as well: app/packages/web/ts.config.json
and finally within the cypress folder itself where the teste are located: app/packages/web/cypress/
I also tried to use ![]() |
I have exactly the same error. Downgrading to version 5.0.0 of the plugin fixes the issue, but this weird error appears with 5.0.1. |
I think one problem is the mismatching definitions in the package.json of this project:
Types are for the command but the entry point is set to plugin |
Oh no the problem is that this projects defines |
Similiar issue here after updating cypress-visual-regression from version 5.0.0 to 5.0.1 with cypress version 13.9.0. cypress.config.ts
|
@susnux Looks like you're on to something with that, I narrowed it down to this PR:
I'm not sure this is the solution - I'm guessing probably the solution will be to actually publish ESM in the JS files. |
WorkaroundUse
diff --git a/node_modules/cypress-visual-regression/dist/command.js b/node_modules/cypress-visual-regression/dist/command.js
index b0458a3..f54c3ed 100644
--- a/node_modules/cypress-visual-regression/dist/command.js
+++ b/node_modules/cypress-visual-regression/dist/command.js
@@ -22,8 +22,8 @@ var command_exports = {};
__export(command_exports, {
addCompareSnapshotCommand: () => addCompareSnapshotCommand
});
-module.exports = __toCommonJS(command_exports);
-function addCompareSnapshotCommand(screenshotOptions) {
+// module.exports = __toCommonJS(command_exports);
+export function addCompareSnapshotCommand(screenshotOptions) {
Cypress.Commands.add(
"compareSnapshot",
// @ts-expect-error todo: fix this
diff --git a/node_modules/cypress-visual-regression/dist/plugin.js b/node_modules/cypress-visual-regression/dist/plugin.js
index 22827b4..322be67 100644
--- a/node_modules/cypress-visual-regression/dist/plugin.js
+++ b/node_modules/cypress-visual-regression/dist/plugin.js
@@ -1,4 +1,8 @@
"use strict";
+
+import { createRequire } from 'module';
+import import_chalk from 'chalk';
+
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -35,7 +39,8 @@ __export(plugin_exports, {
generateImage: () => generateImage,
updateSnapshot: () => updateSnapshot
});
-module.exports = __toCommonJS(plugin_exports);
+// module.exports = __toCommonJS(plugin_exports);
+const require = createRequire(import.meta.url);
var import_fs2 = require("fs");
var path = __toESM(require("path"), 1);
var import_pixelmatch = __toESM(require("pixelmatch"), 1);
@@ -47,7 +52,7 @@ var import_fs = require("fs");
var import_pngjs = require("pngjs");
// src/utils/logger.ts
-var import_chalk = __toESM(require("chalk"), 1);
+// var import_chalk = __toESM(require("chalk"), 1);
var import_util = require("util");
var logLevelKeys = {
debug: 3,
@@ -257,7 +262,7 @@ async function generateImage(diffPNG, imagePath) {
});
});
}
-var configureVisualRegression = (on) => {
+export var configureVisualRegression = (on) => {
on("task", {
compareSnapshots,
updateSnapshot
|
Hi there, any update when it will be fixed? thank you! 🙏🏻 |
Same thing here. v.5.0.0 works fine for me, but updating to v5.0.1 throws an error (both locally and in my project github actions CI):
Maybe something changed in the way you are exporting the types on the package? |
I just started using this plugin today and I was wondering how to make it work, glad to know I'm not alone. |
No you have to pin to |
I'm in the process of publishing a new release which aims to fix issues like these. Before the official release I've created and published an alpha release (as mentioned here). I'd like to ask here as well somebody to verify if problems are really solved with the alpha release before I go on and publish it. |
I tested it with this alpha version and it works for me, so it seems to be fixed. 🏁 🚀 |
Thank you! I tested the alpha and got an issue with TypeScript:
On this line:
Which used to compile without complaints from TypeScript when using 5.0.0. I did not change anything except for the library version, and then ran my tests. It also seems that the "actual" folder configuration handling has changed, as I kept the same Cypress config file as before but my "actual" screenshots are now generated in a weird nested path:
|
Hi @cfecherolle , about the new output directory , it is intended because previously to that we had some issues when using the same name of a cy in different folders , please reffer to this PR to see the reason for. |
The issue should be fixed with |
I just updated to the latest version and get an error with my config when starting cypress together with the cypress-visual-regression plugin.
my
cypress.config.ts
:Stack trace locally:
Using the latest version of cypress 13.8.1 as well.
It worked before like a charm.
ℹ️ I found out that when I comment out the initialization of the plugin
configureVisualRegression(on);
within thesetupNodeEvents()
function in the cypress config it works. So it seems to have something do to with the changes you did in the latest 5.0.1 version.Any ideas?
Thank you!
The text was updated successfully, but these errors were encountered: