@@ -10,16 +10,29 @@ import { executeCommand, deleteFile, SAMPLE_TOKEN } from "./test-utils";
1010jest . mock ( "inquirer" ) ;
1111const { prompt, expectPrompts } = require ( "inquirer" ) ;
1212
13- beforeEach ( async ( ) => {
14- // delete our testing config file before starting
15- deleteFile ( store . path ) ;
16- } ) ;
13+ function setup ( ) {
14+ beforeEach ( ( ) => {
15+ // delete our testing config file before starting
16+ deleteFile ( store . path ) ;
17+ // suppress logs
18+ global . console = {
19+ log : jest . fn ( ) ,
20+ } ;
21+ } ) ;
22+ afterEach ( ( ) => {
23+ global . console = {
24+ log : console . log ,
25+ } ;
26+ } ) ;
27+ }
1728
1829test ( "ensure we're using a temp store folder" , ( ) => {
19- expect ( store . path ) . toMatch ( / @ c o d i g a \/ c l i - t e s t i n g / ) ;
30+ expect ( store . path ) . toMatch ( / c l i - t e s t i n g / ) ;
2031} ) ;
2132
2233describe ( "codiga token-add" , ( ) => {
34+ setup ( ) ;
35+
2336 test ( "first notice shows" , async ( ) => {
2437 // run the command
2538 await executeCommand ( [ ACTION_TOKEN_ADD ] ) . catch ( ( { stdout } ) => {
@@ -101,6 +114,8 @@ describe("codiga token-add", () => {
101114} ) ;
102115
103116describe ( "codiga token-check" , ( ) => {
117+ setup ( ) ;
118+
104119 test ( "no token" , async ( ) => {
105120 // run the command
106121 await executeCommand ( [ ACTION_TOKEN_CHECK ] ) . catch ( ( { stdout } ) => {
@@ -130,6 +145,8 @@ describe("codiga token-check", () => {
130145} ) ;
131146
132147describe ( "codiga token-delete" , ( ) => {
148+ setup ( ) ;
149+
133150 test ( "no token found" , async ( ) => {
134151 // run the command
135152 await executeCommand ( [ ACTION_TOKEN_DELETE ] ) . catch ( ( { stdout } ) => {
0 commit comments