File tree Expand file tree Collapse file tree 2 files changed +24
-5
lines changed
Expand file tree Collapse file tree 2 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -20,14 +20,19 @@ describe('GitHubInfo', () => {
2020 assert . deepEqual ( repo , 'github-release-notes' , 'Get the repository name from repo\'s folder' ) ;
2121 } ) ;
2222
23- githubInfo . token . then ( ( { token } ) => {
24- assert . isOk ( token ) ;
25- } ) ;
23+ if ( process . env . GREN_GITHUB_TOKEN ) {
24+ githubInfo . token . then ( ( { token } ) => {
25+ assert . isOk ( token ) ;
26+ } ) ;
27+ }
2628
2729 githubInfo . options . then ( options => {
2830 assert . isOk ( options [ 0 ] . repo ) ;
2931 assert . isOk ( options [ 0 ] . username ) ;
30- assert . isOk ( options [ 1 ] . token ) ;
32+
33+ if ( process . env . GREN_GITHUB_TOKEN ) {
34+ assert . isOk ( options [ 1 ] . token ) ;
35+ }
3136 } ) ;
3237
3338 } ) ;
Original file line number Diff line number Diff line change @@ -4,13 +4,27 @@ import fs from 'fs';
44import Gren from '../lib/src/Gren.js' ;
55import { requireConfig } from '../lib/src/_utils.js' ;
66
7+ const TOKEN = process . env . GREN_GITHUB_TOKEN ;
8+
9+ if ( ! TOKEN ) {
10+ console . log ( chalk . blue ( 'Token not present, skipping Gren tests.' ) )
11+ describe = describe . skip
12+ }
13+
714describe ( 'Gren' , ( ) => {
815 const gren = new Gren ( {
9- token : process . env . GREN_GITHUB_TOKEN ,
16+ token : TOKEN ,
1017 username : 'github-tools' ,
1118 repo : 'github-release-notes'
1219 } ) ;
1320
21+ it ( 'Should throw an error' , ( ) => {
22+ process . env . GREN_GITHUB_TOKEN = null ;
23+
24+ const gren = ( ) => new Gren ( ) ;
25+ assert . throws ( gren , chalk . red ( 'You must provide the TOKEN' ) , 'No token passed' ) ;
26+ } ) ;
27+
1428 it ( 'Should generate the options' , ( ) => {
1529 assert . isOk ( gren . options , 'The options exist' ) ;
1630 } ) ;
You can’t perform that action at this time.
0 commit comments