localvoid / chai-karma-snapshot

Chai Plugin for Snapshot Testing with Karma
MIT License
4 stars 8 forks source link

Remove undefined prettyFormat.plugins.HTMLElement #5

Closed harjis closed 6 years ago

harjis commented 6 years ago

Hi,

it seems that HTMLElement plugin has been removed. When I tried to use this library for snapshotting the tests failed with message:

    TypeError: Cannot read property 'test' of undefined
        at findPlugin (test/karma.entry.js:377764:22)
        at prettyFormat (test/karma.entry.js:377890:20)
        at serialize (test/karma.entry.js:373744:10)
        at Proxy.aMethodForExpect (test/karma.entry.js:373773:15)
        at Proxy.methodWrapper (test/karma.entry.js:365735:25)
        at Context.<anonymous> (test/karma.entry.js:364254:43)
        at Test.Runnable.run (node_modules/karma-mocha-snapshot/lib/adapter.js:15:17)

Do you know if just removing prettyFormat.plugins.HTMLElement is the correct action? It at least makes my tests not fail.

localvoid commented 6 years ago

It seems that they've renamed HTMLElement to DOMElement. I've used the same list of plugins that were used in jest library and now it is slightly different https://github.com/facebook/jest/blob/39423619602bd5952cc8ff55dc6b6b3f341cccf9/packages/jest-snapshot/src/plugins.js#L15-L21

harjis commented 6 years ago

Ah yes. I can fix this later to night and update the PR

harjis commented 6 years ago

I think this change is not actually needed. I think the reason why it failed in my tests was that I had pretty-format@22.2.1 as devDependency. After that I had installed this package as devDependency. What happened is that this required wrong version of pretty-format. I'm closing this PR as not needed.