jantimon/html-webpack-plugin

Upgrade from version 3 to 5 is breaking all my tests

simkessy opened this issue ยท 5 comments

Current behaviour ๐Ÿ’ฃ

I've upgraded from version 3 to 5 and it's breaking all my tests

image

image

 TypeError: Cannot read property 'Tag' of undefined

      at Object.<anonymous> (../../../node_modules/domhandler/lib/node.js:32:35)
      at Object.<anonymous> (../../../node_modules/domhandler/lib/index.js:15:14)
      at Object.<anonymous> (../../../node_modules/htmlparser2/lib/index.js:2:18)
      at Object.<anonymous> (../../../node_modules/cheerio/lib/parse.js:4:18)
      at Object.<anonymous> (../../../node_modules/cheerio/lib/cheerio.js:5:13)
      at Object.<anonymous> (../../../node_modules/cheerio/index.js:5:28)
      at Object.<anonymous> (../../../node_modules/enzyme/src/Utils.js:9:1)
      at Object.<anonymous> (../../../node_modules/enzyme/src/ShallowWrapper.js:5:1)
      at Object.<anonymous> (../../../node_modules/enzyme-to-json/utils.js:12:46)
      at Object.<anonymous> (../../../node_modules/enzyme-to-json/createSerializer.js:8:14)
      at Object.<anonymous> (../../../node_modules/enzyme-to-json/serializer.js:3:48)
          at Array.forEach (<anonymous>)

Expected behaviour โ˜€๏ธ

I haven't changed anything in my tests, I need this library for webpack to build my html pages but updating this library ends up breaking all my tests. Expected behaviour would be for it not to break everything

Environment ๐Ÿ–ฅ

Node.js v14.17.1
linux 5.4.0-1041-aws
6.14.13
@services/myApp@3.27.0 /home/ksimilien/code/pinboard/services/pq3/client
โ””โ”€โ”€ (empty)

(.venv) ~/code/pinboard/services/pq3/client$ npm ls html-webpack-plugin
@services/myApp@3.27.0 /home/ksimilien/code/pinboard/services/pq3/client
โ””โ”€โ”€ (empty)

"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"enzyme-to-json": "^3.4.4",

The code from 3 to 4 and 4 to 5 introduced breaking changes.

That's why the major version has increased.

@jantimon what packages or how do I fix it, I don't see how those breaking changes in this package interact with my Jest / Enzyme tests.

hard to say - depends on:

  • node version
  • webpack version
  • webpack config
  • other webpack plugins

@jantimon

Node.js v14.17.1
"webpack": "^5.69.0",
I don't use webpack config for running tests so I don't think it's relevant

Seems like others have had this issue https://stackoverflow.com/questions/68303360/cannot-read-property-tag-of-undefined-from-domhandler-in-react-js-app

sorry i have never had this problem before and would need to debug it by myself