amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

Adding test causes unrelated tests in different file to fail

Open glevitzky opened this issue 8 years ago • 2 comments

Adding a simple test to extensions/amp-ad-network-adsense-impl/0.1/test/test-amp-ad-network-adsense-impl.js causes tests in extensions/amp-analytics/0.1/test/test-amp-analytics.js to fail.

To reproduce:

  1. Make a copy of https://github.com/ampproject/amphtml/pull/16540
  2. Observe that tests in test-amp-analytics.js fail on Travis.
  3. Comment out the test in test-amp-ad-network-adsense-impl.js, and re-run all tests.
  4. Observe that tests in test-amp-analytics.js now pass.

(Note: The above PR changed global sandbox references to env.sandbox. The above steps work with and without doing this.)

glevitzky avatar Jul 06 '18 13:07 glevitzky

After a closer look at the test code, I'm pretty sure the problem is pollution of the global window.

dreamofabear avatar Jul 06 '18 19:07 dreamofabear

#16592. Globals considered harmful.

dreamofabear avatar Jul 06 '18 20:07 dreamofabear