File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ var Client = function Client(dsn, options) {
41
41
this . root = options . root || process . cwd ( ) ;
42
42
this . transport = options . transport || transports [ this . dsn . protocol ] ;
43
43
this . release = options . release || process . env . SENTRY_RELEASE || '' ;
44
+ this . environment = options . environment || process . env . SENTRY_ENVIRONMENT || '' ;
44
45
45
46
this . loggerName = options . logger || '' ;
46
47
this . dataCallback = options . dataCallback ;
Original file line number Diff line number Diff line change @@ -127,6 +127,20 @@ describe('raven.Client', function() {
127
127
delete process . env . SENTRY_RELEASE ;
128
128
} ) ;
129
129
130
+ it ( 'should pull environment from options if present' , function ( ) {
131
+ var client = new raven . Client ( dsn , {
132
+ environment : 'staging'
133
+ } ) ;
134
+ client . environment . should . eql ( 'staging' ) ;
135
+ } ) ;
136
+
137
+ it ( 'should pull SENTRY_ENVIRONMENT from environment' , function ( ) {
138
+ process . env . SENTRY_ENVIRONMENT = 'staging' ;
139
+ var client = new raven . Client ( dsn ) ;
140
+ client . environment . should . eql ( 'staging' ) ;
141
+ delete process . env . SENTRY_ENVIRONMENT ;
142
+ } ) ;
143
+
130
144
describe ( '#getIdent()' , function ( ) {
131
145
it ( 'should match' , function ( ) {
132
146
var result = {
You can’t perform that action at this time.
0 commit comments