Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: slight refactor to support rollup #5601

Merged
merged 2 commits into from
Aug 30, 2019
Merged

Conversation

brandonocasey
Copy link
Contributor

@brandonocasey brandonocasey commented Nov 16, 2018

In order to start building our tests with rollup we have to make various changes, mostly due to the fact that rollup cannot override imports. See the comments below for more information.

Includes changes from #5621

* @return {boolean}
* Whether it is a cross domain request or not.
*/
export const isCrossOrigin = function(url) {
const winLoc = window.location;
export const isCrossOrigin = function(url, winLoc = window.location) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests for this were overriding global/window using proxyquireify which is no longer possible. The only thing I could think to do was add a second argument that defaults to the previous value

@@ -252,24 +245,7 @@ QUnit.test('should expose DOM functions', function(assert) {
methods.forEach(name => {
assert.strictEqual(typeof videojs[name], 'function', `function videojs.${name}`);
assert.strictEqual(typeof Dom[name], 'function', `Dom.${name} function exists`);

const oldMethod = Dom[name];
Copy link
Contributor Author

@brandonocasey brandonocasey Nov 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test would have required another override method simliar to the browser module, but it seemed unnecessary. I don't think we needed to check if dom methods were called via deprecated videojs properties. I think its enough just to check that they exist.

@brandonocasey brandonocasey force-pushed the refactor/tests-for-rollup branch 2 times, most recently from 62b4b41 to 546a42b Compare November 28, 2018 21:57
@brandonocasey brandonocasey changed the title Refactor: tests for rollup Refactor: tests to be mostly build tool agnostic Nov 29, 2018
@brandonocasey
Copy link
Contributor Author

Now contains changes from #5621

@brandonocasey brandonocasey changed the title Refactor: tests to be mostly build tool agnostic tests: slight refactor to support rollup Nov 30, 2018
@brandonocasey brandonocasey force-pushed the refactor/tests-for-rollup branch 2 times, most recently from 8e7fea2 to 50cd7b4 Compare December 5, 2018 21:34
@gkatsev gkatsev added patch This PR can be added to a patch release. chore labels Dec 10, 2018
@brandonocasey brandonocasey force-pushed the refactor/tests-for-rollup branch 2 times, most recently from cbe748f to 1cb0d19 Compare December 11, 2018 21:58
@brandonocasey brandonocasey force-pushed the refactor/tests-for-rollup branch 2 times, most recently from c5081ee to e5b151c Compare January 8, 2019 17:53
@stale
Copy link

stale bot commented Mar 9, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the outdated Things closed automatically by stalebot label Mar 9, 2019
@gkatsev gkatsev removed the outdated Things closed automatically by stalebot label Mar 12, 2019
@brandonocasey brandonocasey force-pushed the refactor/tests-for-rollup branch 4 times, most recently from c4e3453 to 8a4b75b Compare March 20, 2019 15:37
@brandonocasey brandonocasey force-pushed the refactor/tests-for-rollup branch 2 times, most recently from 80d1eca to 8518638 Compare March 22, 2019 15:19
import TestHelpers from './test-helpers.js';
import document from 'global/document';

QUnit.module('PosterImage', {
beforeEach() {
// Store the original background support so we can test different vals
this.origVal = browser.BACKGROUND_SIZE_SUPPORTED;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't used anymore.

@brandonocasey brandonocasey force-pushed the refactor/tests-for-rollup branch 2 times, most recently from 8792903 to 5df3d2f Compare August 30, 2019 17:15
test/unit/tech/html5.test.js Show resolved Hide resolved
this.oldXMLHttpRequest = XHR.XMLHttpRequest;
this.oldXDomainRequest = XHR.XDomainRequest;
this.xhr = sinon.useFakeXMLHttpRequest();
XHR.XMLHttpRequest = this.xhr;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this not too late to override XHR? That's why previously, we were doing it in the global-shims.js file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tests are broken because the rebase didn't notice a conflict between '@videojs/xhr' and 'xhr' in the import at the top. I think it should be fixed now.

@gkatsev gkatsev changed the title tests: slight refactor to support rollup test: slight refactor to support rollup Aug 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore patch This PR can be added to a patch release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants