fix(build): remove unneccesary cli logs

This commit is contained in:
Sam Tolmay 2020-10-30 10:48:29 +02:00
parent 319b63ac7e
commit 1f27b7d5d2
10 changed files with 5 additions and 62 deletions

View File

@ -26,7 +26,6 @@ async function writeConnections({ components, context }) {
filePath: `connections/${connection.connectionId}.json`,
content: JSON.stringify(connection, null, 2),
});
await context.logger.info(`Updated connection "${connection.connectionId}".`);
});
return Promise.all(writePromises);
}

View File

@ -17,21 +17,15 @@
import writeConnections from './writeConnections';
import testContext from '../test/testContext';
const mockLogInfo = jest.fn();
const mockSet = jest.fn();
const logger = {
info: mockLogInfo,
};
const artifactSetter = {
set: mockSet,
};
const context = testContext({ logger, artifactSetter });
const context = testContext({ artifactSetter });
beforeEach(() => {
mockLogInfo.mockReset();
mockSet.mockReset();
});
@ -62,7 +56,6 @@ test('writeConnections write connection', async () => {
},
],
]);
expect(mockLogInfo.mock.calls).toEqual([['Updated connection connection1']]);
});
test('writeConnections multiple connection', async () => {
@ -99,10 +92,6 @@ test('writeConnections multiple connection', async () => {
},
],
]);
expect(mockLogInfo.mock.calls).toEqual([
['Updated connection connection1'],
['Updated connection connection2'],
]);
});
test('writeConnections no connections', async () => {
@ -111,14 +100,12 @@ test('writeConnections no connections', async () => {
};
await writeConnections({ components, context });
expect(mockSet.mock.calls).toEqual([]);
expect(mockLogInfo.mock.calls).toEqual([]);
});
test('writeConnections connections undefined', async () => {
const components = {};
await writeConnections({ components, context });
expect(mockSet.mock.calls).toEqual([]);
expect(mockLogInfo.mock.calls).toEqual([]);
});
test('writeConnections connections not an array', async () => {

View File

@ -27,7 +27,6 @@ async function writeGlobal({ components, context }) {
filePath: 'global.json',
content: JSON.stringify(components.global, null, 2),
});
await context.logger.info('Updated global.');
}
export default writeGlobal;

View File

@ -17,21 +17,15 @@
import writeGlobal from './writeGlobal';
import testContext from '../test/testContext';
const mockLogInfo = jest.fn();
const mockSet = jest.fn();
const logger = {
info: mockLogInfo,
};
const artifactSetter = {
set: mockSet,
};
const context = testContext({ logger, artifactSetter });
const context = testContext({ artifactSetter });
beforeEach(() => {
mockLogInfo.mockReset();
mockSet.mockReset();
});
@ -52,7 +46,6 @@ test('writeGlobal', async () => {
},
],
]);
expect(mockLogInfo.mock.calls).toEqual([['Updated global']]);
});
test('writeGlobal empty global', async () => {
@ -68,7 +61,6 @@ test('writeGlobal empty global', async () => {
},
],
]);
expect(mockLogInfo.mock.calls).toEqual([['Updated global']]);
});
test('writeGlobal global undefined', async () => {
@ -82,7 +74,6 @@ test('writeGlobal global undefined', async () => {
},
],
]);
expect(mockLogInfo.mock.calls).toEqual([['Updated global']]);
});
test('writeGlobal global not an object', async () => {

View File

@ -24,7 +24,6 @@ async function writeMenus({ components, context }) {
filePath: 'menus.json',
content: JSON.stringify(components.menus, null, 2),
});
await context.logger.info('Updated menus.');
}
export default writeMenus;

View File

@ -17,21 +17,15 @@
import writeMenus from './writeMenus';
import testContext from '../test/testContext';
const mockLogInfo = jest.fn();
const mockSet = jest.fn();
const logger = {
info: mockLogInfo,
};
const artifactSetter = {
set: mockSet,
};
const context = testContext({ logger, artifactSetter });
const context = testContext({ artifactSetter });
beforeEach(() => {
mockLogInfo.mockReset();
mockSet.mockReset();
});
@ -60,7 +54,6 @@ test('writeMenus', async () => {
},
],
]);
expect(mockLogInfo.mock.calls).toEqual([['Updated menus']]);
});
test('writeMenus empty menus', async () => {
@ -76,7 +69,6 @@ test('writeMenus empty menus', async () => {
},
],
]);
expect(mockLogInfo.mock.calls).toEqual([['Updated menus']]);
});
test('writeMenus menus undefined', async () => {

View File

@ -24,7 +24,6 @@ async function writePage({ page, context }) {
filePath: `pages/${page.pageId}/${page.pageId}.json`,
content: JSON.stringify(page, null, 2),
});
await context.logger.info(`Updated page "${page.pageId}".`);
}
async function writePages({ components, context }) {

View File

@ -17,21 +17,15 @@
import writePages from './writePages';
import testContext from '../test/testContext';
const mockLogInfo = jest.fn();
const mockSet = jest.fn();
const logger = {
info: mockLogInfo,
};
const artifactSetter = {
set: mockSet,
};
const context = testContext({ logger, artifactSetter });
const context = testContext({ artifactSetter });
beforeEach(() => {
mockLogInfo.mockReset();
mockSet.mockReset();
});
@ -62,7 +56,6 @@ test('writePages write page', async () => {
},
],
]);
expect(mockLogInfo.mock.calls).toEqual([['Updated page page1']]);
});
test('writePages multiple pages', async () => {
@ -111,7 +104,6 @@ test('writePages multiple pages', async () => {
},
],
]);
expect(mockLogInfo.mock.calls).toEqual([['Updated page page1'], ['Updated page page2']]);
});
test('writePages no pages', async () => {
@ -120,14 +112,12 @@ test('writePages no pages', async () => {
};
await writePages({ components, context });
expect(mockSet.mock.calls).toEqual([]);
expect(mockLogInfo.mock.calls).toEqual([]);
});
test('writePages pages undefined', async () => {
const components = {};
await writePages({ components, context });
expect(mockSet.mock.calls).toEqual([]);
expect(mockLogInfo.mock.calls).toEqual([]);
});
test('writePages pages not an array', async () => {

View File

@ -65,7 +65,6 @@ async function updateRequestsOnPage({ page, context }) {
filePath: `pages/${page.pageId}/requests/${request.requestId}.json`,
content: JSON.stringify(request, null, 2),
});
await context.logger.info(`Updated request "${request.requestId}" on page "${page.pageId}".`);
});
const writeMutationPromises = mutations.map(async (mutation) => {
await context.artifactSetter.set({

View File

@ -17,21 +17,15 @@
import writeRequests from './writeRequests';
import testContext from '../test/testContext';
const mockLogInfo = jest.fn();
const mockSet = jest.fn();
const logger = {
info: mockLogInfo,
};
const artifactSetter = {
set: mockSet,
};
const context = testContext({ logger, artifactSetter });
const context = testContext({ artifactSetter });
beforeEach(() => {
mockLogInfo.mockReset();
mockSet.mockReset();
});
@ -69,7 +63,6 @@ test('writeRequests write request', async () => {
},
],
]);
expect(mockLogInfo.mock.calls).toEqual([['Updated request request1 on page page1']]);
});
test('writeRequests write nested request', async () => {
@ -116,7 +109,6 @@ test('writeRequests write nested request', async () => {
},
],
]);
expect(mockLogInfo.mock.calls).toEqual([['Updated request request1 on page page1']]);
});
test('writeRequests add mutation', async () => {
@ -153,7 +145,6 @@ test('writeRequests add mutation', async () => {
},
],
]);
expect(mockLogInfo.mock.calls).toEqual([['Updated mutation mutation1 on page page1']]);
});
test('writeRequests add nested mutation', async () => {
@ -199,7 +190,6 @@ test('writeRequests add nested mutation', async () => {
},
],
]);
expect(mockLogInfo.mock.calls).toEqual([['Updated mutation mutation1 on page page1']]);
});
test('writeRequests requests is not an array', async () => {
@ -238,14 +228,12 @@ test('writeRequests empty pages array', async () => {
};
await writeRequests({ components, context });
expect(mockSet.mock.calls).toEqual([]);
expect(mockLogInfo.mock.calls).toEqual([]);
});
test('writeRequests no pages array', async () => {
const components = {};
await writeRequests({ components, context });
expect(mockSet.mock.calls).toEqual([]);
expect(mockLogInfo.mock.calls).toEqual([]);
});
test('writeRequests pages not an array', async () => {