build: use connect web server instead of SimpleHTTPServer

Several flakes on CI have been tied to long running SimpleHTTPServer that was
put in place temporarily after the package splitup.
This commit is contained in:
Igor Minar 2016-05-24 12:33:14 -07:00
parent 16dfe3c63f
commit 2bcdec5aaf
5 changed files with 1610 additions and 1611 deletions

File diff suppressed because it is too large Load Diff

1583
gulpfile.js.old Normal file

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,7 @@ exports.config = {
], ],
capabilities: process.env.TRAVIS ? BROWSER_OPTIONS.ChromeOnTravis : BROWSER_OPTIONS.LocalChrome, capabilities: process.env.TRAVIS ? BROWSER_OPTIONS.ChromeOnTravis : BROWSER_OPTIONS.LocalChrome,
directConnect: true, directConnect: true,
baseUrl: 'http://localhost:7777/', baseUrl: 'http://localhost:8000/',
framework: 'jasmine2', framework: 'jasmine2',
jasmineNodeOpts: { jasmineNodeOpts: {
showColors: true, showColors: true,

View File

@ -24,7 +24,7 @@ echo 'travis_fold:end:test.buildPackages'
echo 'travis_fold:start:test.e2e.localChrome' echo 'travis_fold:start:test.e2e.localChrome'
cd dist/ cd dist/
python -m SimpleHTTPServer 7777 & $(npm bin)/gulp serve &
cd .. cd ..
if [[ ${TRAVIS} ]]; then if [[ ${TRAVIS} ]]; then
sh -e /etc/init.d/xvfb start sh -e /etc/init.d/xvfb start

View File

@ -1,42 +0,0 @@
var onHeaders = require('on-headers');
var proxy = require('proxy-middleware');
var cors = require('cors');
var url = require('url');
module.exports = function(gulp, plugins, config) {
return function() {
plugins.connect.server({
root: [__dirname + '/../../' + config.path],
port: config.port,
livereload: false,
open: false,
middleware: function(connect, opt) {
config.proxies = config.proxies || [];
var middlewares =
config.proxies.map(function(entry) { return makeProxy(entry.route, entry.url); });
middlewares.push(connect.favicon());
middlewares.push(cors());
// pub serve can't give the right content-type header for jsonp requests
// so we must turn off Chromium strict MIME type checking
// see https://github.com/angular/angular/issues/3030#issuecomment-123453168
middlewares.unshift(stripHeader('x-content-type-options'));
return middlewares;
}
});
};
};
function makeProxy(route, urlParam) {
var options = url.parse(urlParam);
options.route = route;
return proxy(options);
}
function stripHeader(toStrip) {
return function(req, res, next) {
onHeaders(res, function onHeaders() {
res.removeHeader(toStrip);
});
next();
};
}