File tree Expand file tree Collapse file tree 2 files changed +19
-9
lines changed
Expand file tree Collapse file tree 2 files changed +19
-9
lines changed Original file line number Diff line number Diff line change 11import { assert } from 'chai' ;
22import GitHubInfo from '../lib/src/GitHubInfo' ;
33
4+ const TOKEN = process . env . GREN_GITHUB_TOKEN ;
5+
6+ if ( ! TOKEN ) {
7+ console . log ( chalk . blue ( 'Token not present, skipping Gren tests.' ) ) ;
8+ describe = describe . skip ;
9+ }
10+
411describe ( 'GitHubInfo' , ( ) => {
512 let githubInfo ;
613
@@ -20,7 +27,7 @@ describe('GitHubInfo', () => {
2027 assert . deepEqual ( repo , 'github-release-notes' , 'Get the repository name from repo\'s folder' ) ;
2128 } ) ;
2229
23- if ( process . env . GREN_GITHUB_TOKEN ) {
30+ if ( TOKEN ) {
2431 githubInfo . token . then ( ( { token } ) => {
2532 assert . isOk ( token ) ;
2633 } ) ;
@@ -30,10 +37,9 @@ describe('GitHubInfo', () => {
3037 assert . isOk ( options [ 0 ] . repo ) ;
3138 assert . isOk ( options [ 0 ] . username ) ;
3239
33- if ( process . env . GREN_GITHUB_TOKEN ) {
40+ if ( TOKEN ) {
3441 assert . isOk ( options [ 1 ] . token ) ;
3542 }
3643 } ) ;
37-
3844 } ) ;
39- } )
45+ } ) ;
Original file line number Diff line number Diff line change @@ -12,11 +12,15 @@ if (!TOKEN) {
1212}
1313
1414describe ( 'Gren' , ( ) => {
15- const gren = new Gren ( {
16- token : TOKEN ,
17- username : 'github-tools' ,
18- repo : 'github-release-notes' ,
19- quiet : true
15+ let gren ;
16+
17+ before ( ( ) => {
18+ gren = new Gren ( {
19+ token : TOKEN ,
20+ username : 'github-tools' ,
21+ repo : 'github-release-notes' ,
22+ quiet : true
23+ } ) ;
2024 } ) ;
2125
2226 it ( 'Should throw an error' , ( ) => {
You can’t perform that action at this time.
0 commit comments