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

E2e mock server #4456

Merged
merged 13 commits into from
Dec 11, 2019
18 changes: 17 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ var prebid = require('./package.json');
var dateString = 'Updated : ' + (new Date()).toISOString().substring(0, 10);
var banner = '/* <%= prebid.name %> v<%= prebid.version %>\n' + dateString + ' */\n';
var port = 9999;
const prebidLocation = './src/prebid.js';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the use for this const ?

const mockServerPort = 3000;
const host = argv.host ? argv.host : 'localhost';

// these modules must be explicitly listed in --modules to be included in the build, won't be part of "all" modules
var explicitModules = [
Expand Down Expand Up @@ -309,6 +312,12 @@ function setupE2e(done) {
done();
}

gulp.task('updatepath', function(){
return gulp.src(['build/dev/*.js'])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test pages defined in e2e are using dist path. On running e2e-test, it will still hit the ut/v3 endpoint

.pipe(replace('ib.adnxs.com/ut/v3/prebid', host + ':' + mockServerPort + '/'))
.pipe(gulp.dest('build/dev'));
});

// support tasks
gulp.task(lint);
gulp.task(watch);
Expand All @@ -331,10 +340,17 @@ gulp.task('coveralls', gulp.series('test-coverage', coveralls));
gulp.task('build', gulp.series(clean, 'build-bundle-prod'));
gulp.task('build-postbid', gulp.series(escapePostbidConfig, buildPostbid));

gulp.task('mockserver', function() {
return gulp.src(prebidLocation)
.pipe(shell('node ./test/mock-server/index.js --port='+mockServerPort, function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
}))
});
gulp.task('serve', gulp.series(clean, lint, gulp.parallel('build-bundle-dev', watch, test)));
gulp.task('default', gulp.series(clean, makeWebpackPkg));

gulp.task('e2e-test', gulp.series(clean, setupE2e, gulp.parallel('build-bundle-prod', watch), test))
gulp.task('e2e-test', gulp.series(clean, setupE2e, 'build-bundle-dev', 'updatepath', gulp.parallel('mockserver', watch, test)));
// other tasks
gulp.task(bundleToStdout);
gulp.task('bundle', gulpBundle.bind(null, false)); // used for just concatenating pre-built files with no build step
Expand Down
Loading