ampproject / ampproject/amphtml
Do not stub private method in integration test
- Dominant language
- JavaScript
- Stars
- 14.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
@estherkim and I found that some integration tests are failing when running with compiled code.
This is caused by stubbing private method in those integration tests, where the private method name will be minimized during compilation.
Two test files are affected. Please fix the affected tests and unskip them
- [ ] [test-visibility-states.js](https://github.com/ampproject/amphtml/blob/master/test/integration/test-visibility-states.js#L129)
- [ ] [test-amp-script.js](https://github.com/ampproject/amphtml/blob/master/extensions/amp-script/0.1/test/integration/test-amp-script.js#L67)
Thanks to @jridgewell who found more affected tests with the new lint rule.
- [ ] test/integration/test-amp-carousel.js
- [ ] test/integration/test-video-manager.js
- [ ] test/integration/test-video-players-helper.js
- [ ] extensions/amp-bind/0.1/test/integration/test-bind-impl.js
- [ ] extensions/amp-date-picker/0.1/test/integration/test-integration-maximum-nights.js
- [ ] extensions/amp-form/0.1/test/integration/test-integration-form.js
- [ ] extensions/amp-sidebar/0.1/test/integration/test-amp-sidebar.js
- [ ] extensions/amp-viewer-integration/0.1/test/integration/test-amp-viewer-integration.js
The failure are not caught earlier because we run `gulp integration` and `gulp integration --compiled --saucelab`. But both test has `skipWindows()` which basically skip saucelab.
@estherkim is working on improving the `skipWindows()` method. Meanwhile, I think it's worth exploring adding presubmit check to forbid stubbing private method (or even forbid stubbing anything) in integration tests, or always run `gulp integration` with the `--compiled` flag.
Contributor guide
Assessment
This issue has not been assessed yet.