If you are testing any js that has </script> within it the script tag where the bundled js gets added will be closed early, resulting in failing tests.
A potential solution to this is to not put the bundle between script tags and instead serve it as a script via a dummy url.