Skip to content

Commit

Permalink
Gettings tests passing for IE9
Browse files Browse the repository at this point in the history
  • Loading branch information
mzabriskie committed Mar 9, 2016
1 parent dcbb352 commit 4d2f9c2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
9 changes: 8 additions & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Karma configuration
// Generated on Fri Aug 15 2014 23:11:13 GMT-0500 (CDT)

var webpack = require('webpack');

function createCustomLauncher(browser, version, platform) {
return {
base: 'SauceLabs',
Expand Down Expand Up @@ -70,7 +72,7 @@ module.exports = function(config) {
if (runAll || process.env.SAUCE_IE) {
// TODO These need to be fixed
// customLaunchers.SL_IE8 = createCustomLauncher('internet explorer', 8, 'Windows 7');
// customLaunchers.SL_IE9 = createCustomLauncher('internet explorer', 9, 'Windows 2008');
customLaunchers.SL_IE9 = createCustomLauncher('internet explorer', 9, 'Windows 2008');
customLaunchers.SL_IE10 = createCustomLauncher('internet explorer', 10, 'Windows 2012');
customLaunchers.SL_IE11 = createCustomLauncher('internet explorer', 11, 'Windows 8.1');
}
Expand Down Expand Up @@ -183,6 +185,11 @@ module.exports = function(config) {
{
'./adapters/http': 'var undefined'
}
],
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('test')
})
]
},

Expand Down
3 changes: 2 additions & 1 deletion lib/adapters/xhr.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ module.exports = function xhrAdapter(resolve, reject, config) {

// For IE 8/9 CORS support
// Only supports POST and GET calls and doesn't returns the response headers.
if (window.XDomainRequest && !('withCredentials' in request) && !isURLSameOrigin(config.url)) {
// DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest.
if (process.env.NODE_ENV !== 'test' && window.XDomainRequest && !('withCredentials' in request) && !isURLSameOrigin(config.url)) {
request = new window.XDomainRequest();
loadEvent = 'onload';
xDomain = true;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Promise based HTTP client for the browser and node.js",
"main": "index.js",
"scripts": {
"build": "./node_modules/.bin/grunt build",
"build": "NODE_ENV=production ./node_modules/.bin/grunt build",
"test": "./node_modules/.bin/grunt test",
"start": "node ./sandbox/server.js",
"examples": "node ./examples/server.js",
Expand Down
10 changes: 8 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,21 @@ function generateConfig(name) {
],
devtool: 'source-map'
};

config.plugins = [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
})
];

if (uglify) {
config.plugins = [
config.plugins.push(
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false
}
})
];
);
}

return config;
Expand Down

0 comments on commit 4d2f9c2

Please sign in to comment.