Skip to content

Commit 89ec207

Browse files
olegz-codefreshdenis-codefreshyaroslav-codefresh
authored
Feture/olegz/saas 4815 up yargs version (#383)
* SAAS-4815 #time 0h 30m Change yargs version, cheked the tests * SAAS-4815 #time 0h 20m Bump version, checked the operability of commands * rebuild * SAAS-4815 #time 1h 40m Fixed test * Update package.json * SAAS-4815 #time 0h 30m Changed nodejs version * Update package.json Co-authored-by: Denis Melnik <58072595+denis-codefresh@users.noreply.github.com> Co-authored-by: yaroslav-codefresh <45195052+yaroslav-codefresh@users.noreply.github.com>
1 parent a5b15d4 commit 89ec207

File tree

5 files changed

+192
-57
lines changed

5 files changed

+192
-57
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM golang:alpine as go
33
RUN apk add --update ca-certificates git
44
RUN go get github.com/github/hub
55

6-
FROM node:9.10.0-alpine
6+
FROM node:10.15.3-alpine
77

88
RUN apk add --update ca-certificates git curl jq py-pip bash && pip install yq
99
COPY --from=go /go/bin/hub /usr/local/bin/hub

lib/interface/cli/completion/completion.spec.js

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,39 +8,37 @@ function getCompletion(args) {
88
return new Promise(resolve => completions.getCompletion(args, resolve));
99
}
1010

11-
jest.mock('./tree', () => {
12-
return {
13-
codefresh: {
14-
get: {
15-
pipelines: {
16-
__positionalHandler: './pipelines/get.completion',
17-
},
18-
pip: {
19-
alias: 'pipelines',
20-
},
21-
__optionHandlers: ['./pipelines/get.completion'],
11+
jest.mock('./tree', () => ({
12+
codefresh: {
13+
get: {
14+
pipelines: {
15+
__positionalHandler: './pipelines/get.completion',
2216
},
23-
generate: {},
24-
create: {
25-
context: {
26-
git: {},
27-
config: {},
28-
__optionHandlers: ['./context/create.completion', './root/create.completion'],
29-
},
30-
repository: {},
31-
__optionHandlers: ['./root/create.completion', './root/another.completion'],
17+
pip: {
18+
alias: 'pipelines',
3219
},
33-
crt: {
34-
alias: 'create',
35-
context: {
36-
git_of_alias: {}, // typically should be equal to create.context, just for test
37-
config: {},
38-
},
39-
repository: {},
20+
__optionHandlers: ['./pipelines/get.completion'],
21+
},
22+
generate: {},
23+
create: {
24+
context: {
25+
git: {},
26+
config: {},
27+
__optionHandlers: ['./context/create.completion', './root/create.completion'],
4028
},
29+
repository: {},
30+
__optionHandlers: ['./root/create.completion', './root/another.completion'],
4131
},
42-
};
43-
}, { virtual: true });
32+
crt: {
33+
alias: 'create',
34+
context: {
35+
git_of_alias: {}, // typically should be equal to create.context, just for test
36+
config: {},
37+
},
38+
repository: {},
39+
},
40+
},
41+
}), { virtual: true });
4442

4543
jest.mock('./pipelines/get.completion', () => { // eslint-disable-line
4644
return {
@@ -111,6 +109,12 @@ jest.mock('fs', () => {
111109
isDirectory: () => isDir,
112110
};
113111
};
112+
113+
const stat = (p, options = { bigint: false }, callback) => {
114+
const result = lstatSync(p);
115+
return callback(null, result);
116+
};
117+
114118
const readdirSync = (p) => {
115119
if (p.startsWith(`${process.cwd()}/`)) {
116120
p = p.replace(`${process.cwd()}/`, '');
@@ -129,6 +133,9 @@ jest.mock('fs', () => {
129133
}
130134
};
131135
return {
136+
lstat: (p, options, callback) => callback(null, lstatSync(p)),
137+
stat: (p, options, callback) => callback(null, lstatSync(p)),
138+
access: (path, c) => c(null, true),
132139
readdirSync,
133140
existsSync,
134141
lstatSync,
@@ -236,7 +243,6 @@ describe('codefresh completions', () => {
236243
});
237244

238245
describe('filedir', () => {
239-
240246
it('should return "__files_completion__" literal to shell without --impl-file-dir', async () => {
241247
process.argv = ['codefresh', 'get', '-f', ''];
242248
const result = await getCompletion(process.argv);

lib/logic/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ const sdk = require('./sdk');
33
module.exports = {
44
sdk,
55
};
6-
6+
7+

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codefresh",
3-
"version": "0.39.5",
3+
"version": "0.39.6",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,
@@ -67,7 +67,7 @@
6767
"rimraf": "^2.6.2",
6868
"semver": "^5.6.0",
6969
"uuid": "^3.1.0",
70-
"yargs": "^10.0.3",
70+
"yargs": "^15.0.2",
7171
"yargs-parser": "^13.0.0"
7272
},
7373
"devDependencies": {

0 commit comments

Comments
 (0)