Skip to content

Commit

Permalink
Randomize pbjs global name when testing (prebid#1787)
Browse files Browse the repository at this point in the history
* Fix test that hard-coded pbjs global.

* Randomize pbjs global name when testing.

Causes tests that hard-code global name to break.
  • Loading branch information
mattpr authored and jsnellbaker committed Nov 28, 2017
1 parent a48b697 commit f9cb0dd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion karma.conf.maker.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This configures Karma, describing how to run the tests and where to output code coverage reports.
//
// For more information, see http://karma-runner.github.io/1.0/config/configuration-file.html

process.env.test = true;
var _ = require('lodash');
var webpackConf = require('./webpack.conf');
var path = require('path')
Expand Down
4 changes: 3 additions & 1 deletion webpack.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ var neverBundle = [
'AnalyticsAdapter.js'
];

var prebidGlobalName = process.env.test ? 'pbjs_' + Math.floor(Math.random() * 10000) : prebid.globalVarName;

module.exports = {
devtool: 'source-map',
resolve: {
Expand Down Expand Up @@ -77,7 +79,7 @@ module.exports = {
{
pattern: /\$\$PREBID_GLOBAL\$\$/g,
replacement: function (match, p1, offset, string) {
return prebid.globalVarName;
return prebidGlobalName;
}
}
]
Expand Down

0 comments on commit f9cb0dd

Please sign in to comment.