-
Notifications
You must be signed in to change notification settings - Fork 83
Crubin/remove request promise #55
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
Conversation
package.json
Outdated
@@ -21,15 +21,17 @@ | |||
"homepage": "https://github.com/optimizely/javascript-sdk#readme", | |||
"dependencies": { | |||
"es6-promise": "^3.3.1", | |||
"optimizely-server-sdk": "^1.3.0" | |||
"optimizely-server-sdk": "^1.3.0", | |||
"xmlhttprequest": "^1.8.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still needed? If it's for tests, please move it to devDependencies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's used in event_dispatcher/index.js in the toQueryString method -- should I just copy that over?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see this library xmlhttprequest
used in the toQueryString
method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
O sorry I thought you meant optimizely-server-sdk -- still getting used to reading these git diffs -- you're right I removed it
package.json
Outdated
@@ -21,15 +21,17 @@ | |||
"homepage": "https://github.com/optimizely/javascript-sdk#readme", | |||
"dependencies": { | |||
"es6-promise": "^3.3.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can get rid of this dependency now
@@ -0,0 +1,92 @@ | |||
/** | |||
* Copyright 2016-2017, Optimizely |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should just say 2017
package.json
Outdated
}, | ||
"devDependencies": { | ||
"chai": "^3.5.0", | ||
"eslint": "^2.9.0", | ||
"json-loader": "^0.5.4", | ||
"mocha": "^2.5.3", | ||
"sinon": "^1.17.4", | ||
"webpack": "^1.13.1" | ||
"webpack": "^1.13.1", | ||
"lodash": "4.13.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please alphabetize these
tests/test_data.js
Outdated
@@ -0,0 +1,266 @@ | |||
/** | |||
* Copyright 2016-2017, Optimizely |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should just say 2017
var callback = sinon.spy(); | ||
eventDispatcher.dispatchEvent(eventObj, callback); | ||
requests[ 0 ].respond([ 200 , {}, '{"url":"https://cdn.com/event","body":{"id":123},"httpVerb":"POST","params":{"testParam":"testParamValue"}}' ]); | ||
done(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once you call done()
the funciton will exit, meaning the assertion you are making below won't get executed.
var callback = sinon.spy(); | ||
eventDispatcher.dispatchEvent(eventObj, callback); | ||
requests[ 0 ].respond([ 200 , {}, '{"url":"https://cdn.com/event","httpVerb":"GET"' ]); | ||
done(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
.travis.yml
Outdated
@@ -9,3 +9,8 @@ branches: | |||
install: "npm install" | |||
script: | |||
- "npm test" | |||
addons: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't include these in the repo, can you revert this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be added to the repo's config settings. We shouldn't check this in!
CHANGELOG
Outdated
* Bump optimizely-server-sdk to version 1.3.1, which includes: | ||
- Minor performance improvements. | ||
------------------------------------------------------------------------------- | ||
------------------------------------------------------------------------------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave an empty line between these
CHANGELOG
Outdated
@@ -1,4 +1,11 @@ | |||
------------------------------------------------------------------------------- | |||
1.4.1 | |||
------------------------------------------------------------------------------- | |||
* Switched to karma for testing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're also getting rid of es6-promise
@@ -0,0 +1,78 @@ | |||
// Karma configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should be .gitignored
, I think, since it is generated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason this file is still showing up
@@ -0,0 +1,16 @@ | |||
module.exports = function (grunt) { | |||
grunt.initConfig({ | |||
karma: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we configure it to run on chrome by default, instead of Phantom
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please have it run on chrome
by default instead of Phantom
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2016-2017, Optimizely | |||
* Copyright 2017, Optimizely |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should say 2016-2017 because the file was created in 2016, and was modified again in 2017.
@@ -24,40 +23,36 @@ module.exports = { | |||
* Sample event dispatcher implementation for tracking impression and conversions | |||
* Users of the SDK can provide their own implementation | |||
* @param {Object} eventObj | |||
* @return {Promise<Object>} | |||
* @param {function} callback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{Function}
webpack.config.js
Outdated
@@ -1,4 +1,5 @@ | |||
var webpack = require('webpack'); | |||
var path = require('path'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed anymore
webpack.config.js
Outdated
@@ -16,4 +17,12 @@ module.exports = { | |||
library: 'optimizelyClient', | |||
libraryTarget: 'umd' | |||
}, | |||
module: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this after upgrading to webpack 2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there, just a few small changes left.
@@ -0,0 +1,78 @@ | |||
// Karma configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason this file is still showing up
req.setRequestHeader('Content-Type', 'application/json'); | ||
req.onreadystatechange = function() { | ||
if (req.readyState === 4 && callback && typeof callback === 'function') { | ||
callback(JSON.stringify(params)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to stringify the params here.
req.open(POST_METHOD, url, true); | ||
req.setRequestHeader('Content-Type', 'application/json'); | ||
req.onreadystatechange = function() { | ||
if (req.readyState === 4 && callback && typeof callback === 'function') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: Can you make 4
a constant and use the constance instead
tests.js
Outdated
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2016-2017, Optimizely | |||
* Copyright 2017, Optimizely |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should still say 2016-2017
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should still say 2016-2018
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops 2016-2017
@@ -0,0 +1,16 @@ | |||
module.exports = function (grunt) { | |||
grunt.initConfig({ | |||
karma: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please have it run on chrome
by default instead of Phantom
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. We should move the travis credentials out of the source
.travis.yml
Outdated
@@ -9,3 +9,8 @@ branches: | |||
install: "npm install" | |||
script: | |||
- "npm test" | |||
addons: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be added to the repo's config settings. We shouldn't check this in!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, is great to see all the cross browser tests running!
Just a few small things and we are all set!
tests.js
Outdated
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2016-2017, Optimizely | |||
* Copyright 2017, Optimizely |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should still say 2016-2018
tests.js
Outdated
@@ -1,5 +1,5 @@ | |||
/** | |||
* Copyright 2016-2017, Optimizely | |||
* Copyright 2017, Optimizely |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops 2016-2017
.travis.yml
Outdated
@@ -1,11 +1,14 @@ | |||
language: node_js | |||
node_js: | |||
- "5" | |||
- "0.10" | |||
- "node" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What version is node
, does that point to latest node? If so please also add node 6 here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep node is "the latest stable Node.js release" -- I can add 6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Changes Unknown when pulling b461c35 on crubin/removeRequestPromise into ** on master**. |
2 similar comments
Changes Unknown when pulling b461c35 on crubin/removeRequestPromise into ** on master**. |
Changes Unknown when pulling b461c35 on crubin/removeRequestPromise into ** on master**. |
karma.bs.conf.js
Outdated
|
||
// Continuous Integration mode | ||
// if true, Karma captures browsers, runs the tests and exits | ||
singleRun: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be true since we are running on the cloud
karma.bs.conf.js
Outdated
|
||
|
||
// enable / disable watching file and executing tests whenever any file changes | ||
autoWatch: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be false as we don't need watching in BS tests
Changes Unknown when pulling 24b1c8b on crubin/removeRequestPromise into ** on master**. |
Changes Unknown when pulling 7c2df7f on crubin/removeRequestPromise into ** on master**. |
No description provided.