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

Production tests are failing #2778

Closed
phillipskevin opened this issue Nov 21, 2016 · 5 comments · Fixed by canjs/can-fixture#88
Closed

Production tests are failing #2778

phillipskevin opened this issue Nov 21, 2016 · 5 comments · Fixed by canjs/can-fixture#88
Assignees

Comments

@phillipskevin
Copy link
Collaborator

Running npm run test-production is currently not working.

This request is failing (copied from Firefox's network panel):

curl 'http://localhost:3996/socket.io/?EIO=3&transport=polling&t=LY7dlWy' -H 'Host: localhost:3996' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:48.0) Gecko/20100101 Firefox/48.0' -H 'Accept: */*' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Content-Type: text/plain;charset=UTF-8' -H 'Referer: http://localhost:3996/test/production.html?__token=70fnr5' -H 'Content-Length: 3' -H 'Cookie: io=PRPsKPt8YVMu-q83AAAX' -H 'Connection: keep-alive'

with this response:

{"code":2,"message":"Bad handshake method"}
@phillipskevin phillipskevin self-assigned this Nov 21, 2016
@phillipskevin
Copy link
Collaborator Author

This is needed to create new releases.

@phillipskevin
Copy link
Collaborator Author

This is caused by can-fixture's xhr.js overwriting XMLHttpRequest. I attempted to fix this by using getters/setters to make sure the properties of our mock XHR match that of the real XHR (code can be found here), but this did not solve the problem.

There must still be something that our XHR is not doing correctly, but I don't have an idea what it is.

I've also determined that this only happens in the production tests because in dev mode socket.io loads before we overwrite XMLHttpRequest. If I delay xhr.js from loading then the issue goes away in production mode also.

A workaround for this issue is to try to make xhr.js load after socket.io, even in the built version of the tests. To do this, perhaps can-fixture can be separated into its own bundle or socket.io can be set as a dependency of can-fixture/xhr.

@matthewp
Copy link
Contributor

Overwriting globals has proven to be more of a headache than its worth in my opinion.

@phillipskevin
Copy link
Collaborator Author

Keeping open until released.

@phillipskevin phillipskevin reopened this Nov 29, 2016
@phillipskevin
Copy link
Collaborator Author

Closed by #2805.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants