meinaart / cypress-plugin-snapshots

Plugin for snapshot tests in Cypress.io
MIT License
498 stars 117 forks source link

Base64 library is missing #126

Closed henryruhs closed 4 years ago

henryruhs commented 4 years ago

There are multiple factors coming together here. It seems that js-base64 is missing their minified versions since a couple of releases and that you are using this instead of the original file that btw. is way better for tree shaking.

Code

module.exports = {
  PATH_BASE64_JS: 'js-base64/base64.min.js',
  PATH_CSS: './assets/styles.css',
  PATH_DIFF_CSS: 'diff2html/dist/diff2html.css',
  PATH_DIFF_JS: 'diff2html/dist/diff2html.js',
  PATH_JS: './assets/script.js',
  PATH_SOCKET_JS: 'socket.io-client/dist/socket.io.js',
};

Fix

A proper fix would be to get rid of this anti-pattern and use require('js-base64') instead. Same for the other libraries... you are doing it wrong :-)

module.exports = {
  PATH_BASE64_JS: 'js-base64/base64.js',
  ...
};

Error

Monday builds are broken as of that error... friday builds that have been okay before the weekend are broken on re-run aswell:

"before all" hook for "Setup":
CypressError: `cy.task('cypress-plugin-snapshot:getFile')` failed with the following error:

> Cannot find module 'js-base64/base64.min.js'
Require stack:
- /home/.../node_modules/cypress-plugin-snapshots/src/tasks/getFile.js
- /home/.../node_modules/cypress-plugin-snapshots/src/tasks/index.js
- /home/.../node_modules/cypress-plugin-snapshots/plugin.js

Environment

canakg commented 4 years ago

+1 Any known workarounds we can apply?

henryruhs commented 4 years ago

Set "js-base64": "2.5.2" in your local package.json like mentioned in the pull request https://github.com/meinaart/cypress-plugin-snapshots/pull/125

brndto commented 4 years ago

Seems like it's trying to find js-base64 instead of base64-js

What fixed it: >npm install js-base64@2.5.1 -S

daviddekanter commented 4 years ago

@brndto i tried your suggestion, the error is gone, but no image snapshots taken. anyone else has the same problem?