@@ -3,6 +3,7 @@ const { withConsoleStubs } = require('../../test/lib/mocha-utils');
3
3
const settings = require ( '../../settings' ) ;
4
4
const ApiClient = require ( '../lib/api-client' ) ;
5
5
const WhoAmICommands = require ( './whoami' ) ;
6
+ const stripAnsi = require ( 'strip-ansi' ) ;
6
7
7
8
8
9
describe ( 'Whoami Commands' , ( ) => {
@@ -25,8 +26,7 @@ describe('Whoami Commands', () => {
25
26
sandbox . restore ( ) ;
26
27
} ) ;
27
28
28
- // We don't need to monitor stdout here, but the stub also sets TTY to false forcing color consistency locally and in CI
29
- it ( 'fails when user is signed-out' , withConsoleStubs ( sandbox , ( ) => {
29
+ it ( 'fails when user is signed-out' , ( ) => {
30
30
sandbox . stub ( ApiClient . prototype , '_access_token' ) . get ( ( ) => null ) ;
31
31
const whoAmI = whoAmICommands ( ) ;
32
32
@@ -35,9 +35,9 @@ describe('Whoami Commands', () => {
35
35
throw new Error ( 'expected promise to be rejected' ) ;
36
36
} )
37
37
. catch ( error => {
38
- expect ( error ) . to . have . property ( 'message' , ' You\'re not logged in. Please login using [1m[36mparticle cloud login[39m[22m before using this command') ;
38
+ expect ( stripAnsi ( error . message ) ) . to . eql ( ' You\'re not logged in. Please login using particle cloud login before using this command') ;
39
39
} ) ;
40
- } ) ) ;
40
+ } ) ;
41
41
42
42
it ( 'fails when token is invalid' , ( ) => {
43
43
sandbox . stub ( ApiClient . prototype , 'getUser' ) . throws ( ) ;
0 commit comments