kriskowal / asap

High-priority task queue for Node.js and browsers
MIT License
608 stars 46 forks source link

Local in-browser testing #46

Closed rkatic closed 10 years ago

rkatic commented 10 years ago

Since I don't have the credentials.json file, I was unable to publish to S3 for testing. So I tried to test in my browser. I browserify-ed asap-test.js, linked it in a HTML file, and opened the page. There are 6 failing tests. Also, at the end I have this error: Uncaught SyntaxError: Failed to execute 'postMessage' on 'Window': Invalid target origin '' in a call to 'postMessage'. ("scafold.js" at line 39)

Didn't have more time to investigate. Am I doing something wrong?

rkatic commented 10 years ago

It's seems the problem is https://github.com/substack/node-browserify/issues/775. Would like if we make testing in local browsers easier. It's essential for testing during developing.

kriskowal commented 10 years ago

The origin probably should be "*". As for Browserify, we’re using on of my other projects Mr, so you can use <script src="../node_modules/mr/boot.js" data-package=".." data-module="test/asap-test"></script> to load during development, or ./node_modules/.bin/mrs test/asap-test.js to generate a bundle.

kriskowal commented 10 years ago

Though it occurs to me that we’re not directly invoking postMessage ever, which is curious. I’m seeing this issue myself after merging #45 locally even when using Mr, and seeing errors across many browsers on Sauce.

Note that this build matrix will probably be out of date if I run the tests on sauce again, which I’ll wait for your acknowledgement before doing.

https://saucelabs.com/u/kriskowal-asap

kriskowal commented 10 years ago

Oh, right. I call it in scaffold to report worker test results. I’ll patch that and rerun.

kriskowal commented 10 years ago

@rkatic I’ve documented the testing procedures https://github.com/kriskowal/asap/blob/master/CONTRIBUTING.md

Note also the existence of test/index.html which will run without a build step in a browser.

rkatic commented 10 years ago

:+1: