Skip to content

Commit 10dcf6f

Browse files
Add stripAnsi usage for failing stdout color test
1 parent 329c24c commit 10dcf6f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/cmd/whoami.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const { withConsoleStubs } = require('../../test/lib/mocha-utils');
33
const settings = require('../../settings');
44
const ApiClient = require('../lib/api-client');
55
const WhoAmICommands = require('./whoami');
6+
const stripAnsi = require('strip-ansi');
67

78

89
describe('Whoami Commands', () => {
@@ -25,8 +26,7 @@ describe('Whoami Commands', () => {
2526
sandbox.restore();
2627
});
2728

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', () => {
3030
sandbox.stub(ApiClient.prototype, '_access_token').get(() => null);
3131
const whoAmI = whoAmICommands();
3232

@@ -35,9 +35,9 @@ describe('Whoami Commands', () => {
3535
throw new Error('expected promise to be rejected');
3636
})
3737
.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');
3939
});
40-
}));
40+
});
4141

4242
it('fails when token is invalid', () => {
4343
sandbox.stub(ApiClient.prototype, 'getUser').throws();

0 commit comments

Comments
 (0)