web-stories-wp icon indicating copy to clipboard operation
web-stories-wp copied to clipboard

Improve stack traces in Karma tests

Open swissspidy opened this issue 2 years ago • 2 comments

Context

The useless stack traces in Karma have always annoyed me. And now I have finally found a very simple solution, purely by accident.

Summary

Disable splitChunks for Karma tests.

Here's the result:

Before:

	Error: <spyOn> : createElement is not declared writable or has no setter
	Usage: spyOn(<object>, <methodName>)
	    at <Jasmine>
	    at new Fixture (/var/folders/df/jtrbhjnd509cwxs8yb_2vw6000lhhc/T/_karma_webpack_64821/commons.js:27319:5)
	    at UserContext.<anonymous> (/var/folders/df/jtrbhjnd509cwxs8yb_2vw6000lhhc/T/_karma_webpack_64821/commons.js:16664:15)
	    at <Jasmine>
	TypeError: Cannot read properties of undefined (reading 'restore')
	    at UserContext.<anonymous> (/var/folders/df/jtrbhjnd509cwxs8yb_2vw6000lhhc/T/_karma_webpack_64821/commons.js:16669:13)
	    at <Jasmine>

After:

	Error: <spyOn> : createElement is not declared writable or has no setter
	Usage: spyOn(<object>, <methodName>)
	    at <Jasmine>
	    at new Fixture (webpack://web-stories-wp/packages/dashboard/src/karma/fixture.js:117:5 <- config.karma.1840615296.js:25651:5)
	    at UserContext.<anonymous> (webpack://web-stories-wp/packages/dashboard/src/karma/integrationLayerTesting/config.karma.js:54:15 <- config.karma.1840615296.js:25984:15)
	    at <Jasmine>
	TypeError: Cannot read properties of undefined (reading 'restore')
	    at UserContext.<anonymous> (webpack://web-stories-wp/packages/dashboard/src/karma/integrationLayerTesting/config.karma.js:39:13 <- config.karma.1840615296.js:25967:13)
	    at <Jasmine>

Relevant Technical Choices

To-do

User-facing changes

Testing Instructions

  • [ ] This is a non-user-facing change and requires no QA

This PR can be tested by following these steps:

Reviews

Does this PR have a security-related impact?

Does this PR change what data or activity we track or use?

Does this PR have a legal-related impact?

Checklist

  • [ ] This PR addresses an existing issue and I have linked this PR to it in ZenHub
  • [ ] I have tested this code to the best of my abilities
  • [ ] I have verified accessibility to the best of my abilities (docs)
  • [ ] I have verified i18n and l10n (translation, right-to-left layout) to the best of my abilities
  • [ ] This code is covered by automated tests (unit, integration, and/or e2e) to verify it works as intended (docs)
  • [ ] I have added documentation where necessary
  • [ ] I have added a matching Type: XYZ label to the PR

Fixes #

swissspidy avatar Aug 12 '22 10:08 swissspidy

Plugin builds for 83ae599820c61067fc4fee820af3e948a64d566c are ready :bellhop_bell:!

googleforcreators-bot avatar Aug 12 '22 10:08 googleforcreators-bot

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Whoops...

swissspidy avatar Aug 12 '22 12:08 swissspidy

Couldn't get this to work unfortunately. Will have to wait for a proper solution I guess unless someone has an idea.

swissspidy avatar Aug 18 '22 09:08 swissspidy