Skip to content

Commit 774dd31

Browse files
Merge pull request #5 from prebid/master
updating master
2 parents f31582b + 0de00fe commit 774dd31

File tree

803 files changed

+42401
-31728
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

803 files changed

+42401
-31728
lines changed

.eslintrc.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ module.exports = {
1515
},
1616
"extends": "standard",
1717
"plugins": [
18-
"prebid"
18+
"prebid",
19+
"import"
1920
],
2021
"globals": {
2122
"$$PREBID_GLOBAL$$": false
@@ -27,6 +28,7 @@ module.exports = {
2728
"comma-dangle": "off",
2829
"semi": "off",
2930
"space-before-function-paren": "off",
31+
"import/extensions": ["error", "ignorePackages"],
3032

3133
// Exceptions below this line are temporary, so that eslint can be added into the CI process.
3234
// Violations of these styles should be fixed, and the exceptions removed over time.
@@ -35,8 +37,9 @@ module.exports = {
3537
"eqeqeq": "off",
3638
"no-return-assign": "off",
3739
"no-throw-literal": "off",
38-
"no-undef": "off",
40+
"no-undef": 2,
3941
"no-useless-escape": "off",
42+
"no-console": "error"
4043
},
4144
"overrides": Object.keys(allowedModules).map((key) => ({
4245
"files": key + "/**/*.js",

CONTRIBUTING.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ When you are adding code to Prebid.js, or modifying code that isn't covered by a
4848
- _Assert_: check that the expected results have occurred
4949
- e.g., use Chai assertions to check that the expected output is equal to the actual output
5050
- Test the public interface, not the internal implementation
51-
- If you need to check `adloader.loadScript` in a test, use a `stub` rather than a `spy`. `spy`s trigger a network call which can result in a `script error` and cause unrelated unit tests to fail. `stub`s will let you gather information about the `adloader.loadScript` call without affecting external resources
51+
- If you need to check `adloader.loadExternalScript` in a test, use a `stub` rather than a `spy`. `spy`s trigger a network call which can result in a `script error` and cause unrelated unit tests to fail. `stub`s will let you gather information about the `adloader.loadExternalScript` call without affecting external resources
52+
- If your test makes ajax requests, use the global xhr stub in `test/mocks/xhr`. Do not use your own `sinon.useFakeXMLHttpRequest()` or `sinon.createFakeServer()`.
5253
- When writing tests you may use ES2015 syntax if desired
54+
- If your test relies on `Window` or `global` object, do not mutate that object directly. Instead, create a separate copy of that object and perform operations on that new copy.
5355

5456
### Test Examples
5557
Prebid.js already has many tests. Read them to see how Prebid.js is tested, and for inspiration:

PR_REVIEW.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ For modules and core platform updates, the initial reviewer should request an ad
1616
- If the change results in needing updates to docs (such as public API change, module interface etc), add a label for "needs docs" and inform the submitter they must submit a docs PR to update the appropriate area of Prebid.org **before the PR can merge**. Help them with finding where the docs are located on prebid.org if needed.
1717
- Below are some examples of bidder specific updates that should require docs update (in their dev-docs/bidders/bidder.md file):
1818
- Add support for GDPR consentManagement module > add `gdpr_supported: true`
19+
- Add support for US Privacy consentManagement module > add `usp_supported: true`
1920
- Add support for userId module > add `userId: pubCommon, digitrust, newProviderHere`
2021
- Add support for video and/or native mediaTypes > add `media_types: video, native`
2122
- Add support for COPPA > add `coppa_supported: true`
23+
- Add support for SChain > add `schain_supported: true`
2224
- If all above is good, add a `LGTM` comment and request 1 additional core member to review.
2325
- Once there is 2 `LGTM` on the PR, merge to master
2426
- Ask the submitter to add a PR for documentation if applicable.
@@ -29,7 +31,7 @@ For modules and core platform updates, the initial reviewer should request an ad
2931
- Follow steps above for general review process. In addition, please verify the following:
3032
- Verify that bidder has submitted valid bid params and that bids are being received.
3133
- Verify that bidder is not manipulating the prebid.js auction in any way or doing things that go against the principles of the project. If unsure check with the Tech Lead.
32-
- Verify that the bidder is being as efficient as possible, ideally not loading an external library, however if they do load a library it should be cached.
34+
- Verify that the bidder is being as efficient as possible, ideally not loading an external library, however if they do load a library it should be cached.
3335
- Verify that code re-use is being done properly and that changes introduced by a bidder don't impact other bidders.
3436
- If the adapter being submitted is an alias type, check with the bidder contact that is being aliased to make sure it's allowed.
3537
- If the adapter is triggering any user syncs make sure they are using the user sync module in the Prebid.js core.

allowedModules.js

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const sharedWhiteList = [
1111
module.exports = {
1212
'modules': [
1313
...sharedWhiteList,
14+
'criteo-direct-rsa-validate',
1415
'jsencrypt',
1516
'crypto-js'
1617
],

browsers.json

+13-13
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
"device": null,
88
"os": "Windows"
99
},
10-
"bs_edge_16_windows_10": {
10+
"bs_edge_18_windows_10": {
1111
"base": "BrowserStack",
1212
"os_version": "10",
1313
"browser": "edge",
14-
"browser_version": "16.0",
14+
"browser_version": "18.0",
1515
"device": null,
1616
"os": "Windows"
1717
},
@@ -23,43 +23,43 @@
2323
"device": null,
2424
"os": "Windows"
2525
},
26-
"bs_chrome_74_windows_10": {
26+
"bs_chrome_80_windows_10": {
2727
"base": "BrowserStack",
2828
"os_version": "10",
2929
"browser": "chrome",
30-
"browser_version": "74.0",
30+
"browser_version": "80.0",
3131
"device": null,
3232
"os": "Windows"
3333
},
34-
"bs_chrome_75_windows_10": {
34+
"bs_chrome_79_windows_10": {
3535
"base": "BrowserStack",
3636
"os_version": "10",
3737
"browser": "chrome",
38-
"browser_version": "75.0",
38+
"browser_version": "79.0",
3939
"device": null,
4040
"os": "Windows"
4141
},
42-
"bs_firefox_66_windows_10": {
42+
"bs_firefox_73_windows_10": {
4343
"base": "BrowserStack",
4444
"os_version": "10",
4545
"browser": "firefox",
46-
"browser_version": "66.0",
46+
"browser_version": "73.0",
4747
"device": null,
4848
"os": "Windows"
4949
},
50-
"bs_firefox_67_windows_10": {
50+
"bs_firefox_72_windows_10": {
5151
"base": "BrowserStack",
5252
"os_version": "10",
5353
"browser": "firefox",
54-
"browser_version": "67.0",
54+
"browser_version": "72.0",
5555
"device": null,
5656
"os": "Windows"
5757
},
58-
"bs_safari_11_mac_high_sierra": {
58+
"bs_safari_11_mac_catalina": {
5959
"base": "BrowserStack",
60-
"os_version": "High Sierra",
60+
"os_version": "Catalina",
6161
"browser": "safari",
62-
"browser_version": "11.1",
62+
"browser_version": "13.0",
6363
"device": null,
6464
"os": "OS X"
6565
},

gulpHelpers.js

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ module.exports = {
5959
});
6060
}
6161

62+
// we need to forcefuly include the parentModule if the subModule is present in modules list and parentModule is not present in modules list
6263
Object.keys(submodules).forEach(parentModule => {
6364
if (
6465
!modules.includes(parentModule) &&

gulpfile.js

+32-9
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ var prebid = require('./package.json');
3232
var dateString = 'Updated : ' + (new Date()).toISOString().substring(0, 10);
3333
var banner = '/* <%= prebid.name %> v<%= prebid.version %>\n' + dateString + ' */\n';
3434
var port = 9999;
35+
const mockServerPort = 4444;
36+
const host = argv.host ? argv.host : 'localhost';
37+
const { spawn } = require('child_process');
3538

3639
// these modules must be explicitly listed in --modules to be included in the build, won't be part of "all" modules
3740
var explicitModules = [
@@ -64,11 +67,11 @@ function lint(done) {
6467
if (argv.nolint) {
6568
return done();
6669
}
67-
const isFixed = function(file) {
70+
const isFixed = function (file) {
6871
return file.eslint != null && file.eslint.fixed;
6972
}
70-
return gulp.src(['src/**/*.js', 'modules/**/*.js', 'test/**/*.js'], {base: './'})
71-
.pipe(gulpif(argv.nolintfix, eslint(), eslint({fix: true})))
73+
return gulp.src(['src/**/*.js', 'modules/**/*.js', 'test/**/*.js'], { base: './' })
74+
.pipe(gulpif(argv.nolintfix, eslint(), eslint({ fix: true })))
7275
.pipe(eslint.format('stylish'))
7376
.pipe(eslint.failAfterError())
7477
.pipe(gulpif(isFixed, gulp.dest('./')));
@@ -81,7 +84,7 @@ function viewCoverage(done) {
8184

8285
connect.server({
8386
port: coveragePort,
84-
root: 'build/coverage/karma_html',
87+
root: 'build/coverage/lcov-report',
8588
livereload: false
8689
});
8790
opens('http://' + mylocalhost + ':' + coveragePort);
@@ -157,7 +160,7 @@ function nodeBundle(modules) {
157160
.on('error', (err) => {
158161
reject(err);
159162
})
160-
.pipe(through.obj(function(file, enc, done) {
163+
.pipe(through.obj(function (file, enc, done) {
161164
resolve(file.contents.toString(enc));
162165
done();
163166
}));
@@ -196,7 +199,7 @@ function bundle(dev, moduleArr) {
196199
return gulp.src(
197200
entries
198201
)
199-
.pipe(gulpif(dev, sourcemaps.init({loadMaps: true})))
202+
.pipe(gulpif(dev, sourcemaps.init({ loadMaps: true })))
200203
.pipe(concat(outputFileName))
201204
.pipe(gulpif(!argv.manualEnable, footer('\n<%= global %>.processQueue();', {
202205
global: prebid.globalVarName
@@ -234,12 +237,26 @@ function test(done) {
234237
wdioConf
235238
];
236239
}
240+
241+
//run mock-server
242+
const mockServer = spawn('node', ['./test/mock-server/index.js', '--port=' + mockServerPort]);
243+
mockServer.stdout.on('data', (data) => {
244+
console.log(`stdout: ${data}`);
245+
});
246+
mockServer.stderr.on('data', (data) => {
247+
console.log(`stderr: ${data}`);
248+
});
249+
237250
execa(wdioCmd, wdioOpts, { stdio: 'inherit' })
238251
.then(stdout => {
252+
//kill mock server
253+
mockServer.kill('SIGINT');
239254
done();
240255
process.exit(0);
241256
})
242257
.catch(err => {
258+
//kill mock server
259+
mockServer.kill('SIGINT');
243260
done(new Error(`Tests failed with error: ${err}`));
244261
process.exit(1);
245262
});
@@ -256,7 +273,7 @@ function test(done) {
256273
}
257274

258275
function newKarmaCallback(done) {
259-
return function(exitCode) {
276+
return function (exitCode) {
260277
if (exitCode) {
261278
done(new Error('Karma tests failed with exit code ' + exitCode));
262279
if (argv.browserstack) {
@@ -279,7 +296,7 @@ function testCoverage(done) {
279296
function coveralls() { // 2nd arg is a dependency: 'test' must be finished
280297
// first send results of istanbul's test coverage to coveralls.io.
281298
return gulp.src('gulpfile.js', { read: false }) // You have to give it a file, but you don't
282-
// have to read it.
299+
// have to read it.
283300
.pipe(shell('cat build/coverage/lcov.info | node_modules/coveralls/bin/coveralls.js'));
284301
}
285302

@@ -309,6 +326,12 @@ function setupE2e(done) {
309326
done();
310327
}
311328

329+
gulp.task('updatepath', function () {
330+
return gulp.src(['build/dist/*.js'])
331+
.pipe(replace('https://ib.adnxs.com/ut/v3/prebid', 'http://' + host + ':' + mockServerPort + '/'))
332+
.pipe(gulp.dest('build/dist'));
333+
});
334+
312335
// support tasks
313336
gulp.task(lint);
314337
gulp.task(watch);
@@ -334,7 +357,7 @@ gulp.task('build-postbid', gulp.series(escapePostbidConfig, buildPostbid));
334357
gulp.task('serve', gulp.series(clean, lint, gulp.parallel('build-bundle-dev', watch, test)));
335358
gulp.task('default', gulp.series(clean, makeWebpackPkg));
336359

337-
gulp.task('e2e-test', gulp.series(clean, setupE2e, gulp.parallel('build-bundle-prod', watch), test))
360+
gulp.task('e2e-test', gulp.series(clean, setupE2e, gulp.parallel('build-bundle-prod', watch), 'updatepath', test));
338361
// other tasks
339362
gulp.task(bundleToStdout);
340363
gulp.task('bundle', gulpBundle.bind(null, false)); // used for just concatenating pre-built files with no build step

0 commit comments

Comments
 (0)