Skip to content

Commit

Permalink
fix: pulling some snapshots that have color in them as they're causin…
Browse files Browse the repository at this point in the history
…g flaky tests
  • Loading branch information
erunion committed Jan 11, 2022
1 parent 7b123cd commit e2c10be
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 35 deletions.
5 changes: 0 additions & 5 deletions __tests__/cmds/__snapshots__/login.test.js.snap

This file was deleted.

23 changes: 0 additions & 23 deletions __tests__/cmds/__snapshots__/versions.test.js.snap

This file was deleted.

10 changes: 8 additions & 2 deletions __tests__/cmds/login.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ describe('rdme login', () => {

const mock = nock(config.get('host')).post('/api/v1/login', { email, password, project }).reply(200, { apiKey });

await expect(cmd.run({ email, password, project })).resolves.toMatchSnapshot();
const output = await cmd.run({ email, password, project });
expect(output).toContain('[email protected]');
expect(output).toContain('subdomain');

mock.done();

expect(configStore.get('apiKey')).toBe(apiKey);
Expand Down Expand Up @@ -78,7 +81,10 @@ describe('rdme login', () => {
.post('/api/v1/login', { email, password, project, token })
.reply(200, { apiKey: '123' });

await expect(cmd.run({ email, password, project, token })).resolves.toMatchSnapshot();
const output = await cmd.run({ email, password, project, token });
expect(output).toContain('[email protected]');
expect(output).toContain('subdomain');

mock.done();
});

Expand Down
8 changes: 6 additions & 2 deletions __tests__/cmds/versions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ describe('rdme versions*', () => {
.basicAuth({ user: key })
.reply(200, [versionPayload, version2Payload]);

await expect(versions.run({ key })).resolves.toMatchSnapshot();
const table = await versions.run({ key });
expect(table).toContain(version);
expect(table).toContain(version2);
mockRequest.done();
});

Expand All @@ -75,7 +77,9 @@ describe('rdme versions*', () => {
.basicAuth({ user: key })
.reply(200, versionPayload);

await expect(versions.run({ key, version })).resolves.toMatchSnapshot();
const table = await versions.run({ key, version });
expect(table).toContain(version);
expect(table).not.toContain(version2);
mockRequest.done();
});

Expand Down
3 changes: 0 additions & 3 deletions __tests__/set-node-env.js
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
// Chalk has trouble with Jest sometimes in test snapshots so we're disabling colorization here for all tests.
process.env.FORCE_COLOR = 0;

process.env.NODE_ENV = 'testing';

0 comments on commit e2c10be

Please sign in to comment.