Skip to content
This repository was archived by the owner on Oct 15, 2019. It is now read-only.

Commit c9c0a41

Browse files
Release 2.5.0
1 parent 773a442 commit c9c0a41

File tree

4 files changed

+37
-4
lines changed

4 files changed

+37
-4
lines changed

HISTORY.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2.5.0 / 2017-04-11
2+
==================
3+
4+
* Add customVersionProperty option
5+
16
2.4.0 / 2017-03-27
27
==================
38

lib/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ var Sentry = module.exports = integration('Sentry')
2323
.option('includePaths', [])
2424
.option('maxMessageLength', null)
2525
.option('logger', null)
26+
.option('customVersionProperty', null)
2627
.tag('<script src="https://cdn.ravenjs.com/3.12.1/raven.min.js" crossorigin="anonymous">');
2728

2829
/**
@@ -35,16 +36,18 @@ var Sentry = module.exports = integration('Sentry')
3536

3637
Sentry.prototype.initialize = function() {
3738
var dsnPublic = this.options.config;
39+
var customRelease = this.options.customVersionProperty ? window[this.options.customVersionProperty] : null;
3840
var options = {
3941
logger: this.options.logger,
40-
release: this.options.release,
42+
release: customRelease || this.options.release,
4143
serverName: this.options.serverName,
4244
whitelistUrls: this.options.whitelistUrls,
4345
ignoreErrors: this.options.ignoreErrors,
4446
ignoreUrls: this.options.ignoreUrls,
4547
includePaths: this.options.includePaths,
4648
maxMessageLength: this.options.maxMessageLength
4749
};
50+
4851
window.RavenConfig = {
4952
dsn: dsnPublic,
5053
config: reject(options)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@segment/analytics.js-integration-sentry",
33
"description": "The Sentry analytics.js integration.",
4-
"version": "2.4.0",
4+
"version": "2.5.0",
55
"keywords": [
66
"analytics.js",
77
"analytics.js-integration",

test/index.test.js

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ describe('Sentry', function() {
1818
ignoreErrors: ['fb_xd_fragment'],
1919
ignoreUrls: ['/graph\.facebook\.com/', 'http://example.com/script2.js'],
2020
includePaths: ['/https?:\/\/getsentry\.com/', '/https?:\/\/cdn\.getsentry\.com/'],
21-
maxMessageLength: 50
21+
maxMessageLength: 50,
22+
customVersionProperty: null
2223
};
2324

2425
beforeEach(function() {
@@ -48,7 +49,8 @@ describe('Sentry', function() {
4849
.option('whitelistUrls', [])
4950
.option('includePaths', [])
5051
.option('maxMessageLength', null)
51-
.option('logger', null));
52+
.option('logger', null)
53+
.option('customVersionProperty', null));
5254
});
5355

5456
describe('before loading', function() {
@@ -80,6 +82,29 @@ describe('Sentry', function() {
8082
analytics.assert.deepEqual(window.RavenConfig.config, config);
8183
});
8284

85+
it('should allow and set custom versions', function() {
86+
var config = {
87+
logger: options.logger,
88+
serverName: options.serverName,
89+
whitelistUrls: options.whitelistUrls,
90+
ignoreErrors: options.ignoreErrors,
91+
ignoreUrls: options.ignoreUrls,
92+
includePaths: options.includePaths,
93+
maxMessageLength: options.maxMessageLength,
94+
release: '2.4.0'
95+
};
96+
97+
sentry.options.customVersionProperty = 'my_custom_version_property';
98+
window.my_custom_version_property = '2.4.0';
99+
analytics.initialize();
100+
101+
// Need to delete before asserts to prevent leaking effects in case of failure.
102+
delete window.my_custom_version_property;
103+
104+
analytics.assert(window.RavenConfig.dsn === options.config);
105+
analytics.assert.deepEqual(window.RavenConfig.config, config);
106+
});
107+
83108
it('should reject null settings', function() {
84109
sentry.options.release = null;
85110
analytics.initialize();

0 commit comments

Comments
 (0)