Skip to content

Commit 4f568c1

Browse files
add no pretty flag date format case + add tests (#277)
1 parent 97b3c74 commit 4f568c1

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

lib/output/types/table.output.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,16 @@ function output(data, argv) {
8282
}
8383

8484

85-
// TODO: this formatter do sort by date, we can`t change output because customers can grep it
86-
// // if no pretty flag and no dateFormat - force apply specific entity date format
87-
// if (!pretty && (!dateFormat || dateFormat === 'default')) {
88-
// const formatter = FormatterRegistry.get(entities[0].constructor.name);
89-
// _.keys(info).forEach((key) => {
90-
// const prop = info[key];
91-
// if (prop instanceof Date) {
92-
// info[key] = formatter.applyStyles(key, prop);
93-
// }
94-
// });
95-
// }
85+
// if no pretty flag and no dateFormat - force apply specific entity date format
86+
if (!pretty && (!dateFormat || dateFormat === 'default')) {
87+
const formatter = FormatterRegistry.get(entities[0].constructor.name);
88+
_.keys(info).forEach((key) => {
89+
const prop = info[key];
90+
if (prop instanceof Date) {
91+
info[key] = formatter.applyStyles(key, prop);
92+
}
93+
});
94+
}
9695

9796
if (pretty) {
9897
const formatter = FormatterRegistry.get(entities[0].constructor.name);

lib/output/types/table.output.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class TestEntity extends Entity {
3939

4040

4141
// todo: add other tests on coverage
42-
describe.skip('table output', () => {
42+
describe('table output', () => {
4343
describe('date format', () => {
4444
it('should apply default entity date format when no pretty flag and no date format are passed', () => {
4545
const argv = {}; // no pretty flag

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codefresh",
3-
"version": "0.11.0",
3+
"version": "0.11.1",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)