Skip to content

Commit dff849a

Browse files
committed
feat: include arch in the collected json
1 parent c10fca3 commit dff849a

File tree

4 files changed

+102
-111
lines changed

4 files changed

+102
-111
lines changed
Lines changed: 67 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,114 @@
1-
exports['commit-message-install getCommand removes --file and its argument 1'] = {
2-
"args": [
3-
"--file",
4-
"file.txt",
5-
"echo",
6-
"foo",
7-
"bar"
8-
],
9-
"command": "echo foo bar"
1+
exports[
2+
'commit-message-install getCommand removes --file and its argument 1'
3+
] = {
4+
args: ['--file', 'file.txt', 'echo', 'foo', 'bar'],
5+
command: 'echo foo bar'
106
}
117

128
exports['commit-message-install getCommand removes -f and its argument 1'] = {
13-
"args": [
14-
"-f",
15-
"file.txt",
16-
"echo",
17-
"foo",
18-
"bar"
19-
],
20-
"command": "echo foo bar"
9+
args: ['-f', 'file.txt', 'echo', 'foo', 'bar'],
10+
command: 'echo foo bar'
2111
}
2212

23-
exports['commit-message-install getCommand returns original command from array 1'] = {
24-
"args": [
25-
"echo",
26-
"foo",
27-
"bar"
28-
],
29-
"command": "echo foo bar"
13+
exports[
14+
'commit-message-install getCommand returns original command from array 1'
15+
] = {
16+
args: ['echo', 'foo', 'bar'],
17+
command: 'echo foo bar'
3018
}
3119

3220
exports['commit-message-install getJsonBlock finds single json block 1'] = {
33-
"foo": "bar"
21+
foo: 'bar'
3422
}
3523

36-
exports['commit-message-install getJsonBlock finds single json block at start 1'] = {
37-
"foo": "bar"
24+
exports[
25+
'commit-message-install getJsonBlock finds single json block at start 1'
26+
] = {
27+
foo: 'bar'
3828
}
3929

40-
exports['commit-message-install getJsonBlock returns first found json block 1'] = {
41-
"foo": "bar"
30+
exports[
31+
'commit-message-install getJsonBlock returns first found json block 1'
32+
] = {
33+
foo: 'bar'
4234
}
4335

4436
exports['commit-message-install getJsonBlock returns json with branch 1'] = {
45-
"foo": "bar",
46-
"branch": "test-branch"
37+
foo: 'bar',
38+
branch: 'test-branch'
4739
}
4840

49-
exports['commit-message-install getJsonFromGit extracts the json from git message 1'] = {
50-
"platform": "win32",
51-
"branch": "some-branch"
41+
exports[
42+
'commit-message-install getJsonFromGit extracts the json from git message 1'
43+
] = {
44+
platform: 'win32',
45+
branch: 'some-branch'
5246
}
5347

54-
exports['commit-message-install gets commit message for specific commit returns just the body of specific commit 1'] = `
48+
exports[
49+
'commit-message-install gets commit message for specific commit returns just the body of specific commit 1'
50+
] = `
5551
message body
5652
`
5753

58-
exports['commit-message-install gets last commit message returns just the body of the commit message 1'] = `
54+
exports[
55+
'commit-message-install gets last commit message returns just the body of the commit message 1'
56+
] = `
5957
message body
6058
`
6159

62-
exports['commit-message-install isPlatformAllowed compares platforms isPlatformAllowed 1'] = {
63-
"name": "isPlatformAllowed",
64-
"behavior": [
60+
exports[
61+
'commit-message-install isPlatformAllowed compares platforms isPlatformAllowed 1'
62+
] = {
63+
name: 'isPlatformAllowed',
64+
behavior: [
6565
{
66-
"given": [
67-
"win32",
68-
"win32"
69-
],
70-
"expect": true
66+
given: ['win32', 'win32'],
67+
expect: true
7168
},
7269
{
73-
"given": [
74-
"win32",
75-
"linux"
76-
],
77-
"expect": false
70+
given: ['win32', 'linux'],
71+
expect: false
7872
},
7973
{
80-
"given": [
81-
"*",
82-
"linux"
83-
],
84-
"expect": true
74+
given: ['*', 'linux'],
75+
expect: true
8576
},
8677
{
87-
"given": [
88-
"win32,linux",
89-
"linux"
90-
],
91-
"expect": true
78+
given: ['win32,linux', 'linux'],
79+
expect: true
9280
},
9381
{
94-
"given": [
95-
"win32|linux",
96-
"linux"
97-
],
98-
"expect": true
82+
given: ['win32|linux', 'linux'],
83+
expect: true
9984
},
10085
{
101-
"given": [
102-
"win32, linux",
103-
"linux"
104-
],
105-
"expect": true
86+
given: ['win32, linux', 'linux'],
87+
expect: true
10688
}
10789
]
10890
}
10991

11092
exports['formed json object'] = {
111-
"platform": "linux",
112-
"env": {},
113-
"packages": "debug chalk",
114-
"status": {
115-
"owner": "foo",
116-
"repo": "bar",
117-
"sha": "2d8687c143165218c6b52a76018b76cf99137e48"
93+
platform: 'linux',
94+
arch: 'x64',
95+
env: {},
96+
packages: 'debug chalk',
97+
status: {
98+
owner: 'foo',
99+
repo: 'bar',
100+
sha: '2d8687c143165218c6b52a76018b76cf99137e48'
118101
}
119102
}
120103

121104
exports['parsed back message'] = {
122-
"platform": "linux",
123-
"env": {},
124-
"packages": "debug chalk",
125-
"status": {
126-
"owner": "foo",
127-
"repo": "bar",
128-
"sha": "2d8687c143165218c6b52a76018b76cf99137e48"
105+
platform: 'linux',
106+
arch: 'x64',
107+
env: {},
108+
packages: 'debug chalk',
109+
status: {
110+
owner: 'foo',
111+
repo: 'bar',
112+
sha: '2d8687c143165218c6b52a76018b76cf99137e48'
129113
}
130114
}
Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,52 @@
11
exports['getInstallJson sets branch 1'] = {
2-
"platform": "linux",
3-
"env": {},
4-
"packages": "debug chalk",
5-
"branch": "test-branch"
2+
platform: 'linux',
3+
arch: 'x64',
4+
env: {},
5+
packages: 'debug chalk',
6+
branch: 'test-branch'
67
}
78

89
exports['getInstallJson sets commit 1'] = {
9-
"platform": "linux",
10-
"env": {},
11-
"packages": "debug chalk",
12-
"commit": "b7ccfd8"
10+
platform: 'linux',
11+
arch: 'x64',
12+
env: {},
13+
packages: 'debug chalk',
14+
commit: 'b7ccfd8'
1315
}
1416

1517
exports['getInstallJson sets given platform 1'] = {
16-
"platform": "linux",
17-
"env": {
18-
"foo": 42
18+
platform: 'linux',
19+
arch: 'x64',
20+
env: {
21+
foo: 42
1922
},
20-
"packages": "debug"
23+
packages: 'debug'
2124
}
2225

2326
exports['getInstallJson sets properties and all platforms 1'] = {
24-
"platform": "*",
25-
"env": {
26-
"foo": 42
27+
platform: '*',
28+
arch: 'x64',
29+
env: {
30+
foo: 42
2731
},
28-
"packages": "debug"
32+
packages: 'debug'
2933
}
3034

3135
exports['getInstallJson sets several modules 1'] = {
32-
"platform": "linux",
33-
"env": {},
34-
"packages": "debug chalk"
36+
platform: 'linux',
37+
arch: 'x64',
38+
env: {},
39+
packages: 'debug chalk'
3540
}
3641

3742
exports['getInstallJson sets status object 1'] = {
38-
"platform": "linux",
39-
"env": {},
40-
"packages": "debug chalk",
41-
"status": {
42-
"owner": "foo",
43-
"repo": "bar",
44-
"sha": "2d8687c143165218c6b52a76018b76cf99137e48"
43+
platform: 'linux',
44+
arch: 'x64',
45+
env: {},
46+
packages: 'debug chalk',
47+
status: {
48+
owner: 'foo',
49+
repo: 'bar',
50+
sha: '2d8687c143165218c6b52a76018b76cf99137e48'
4551
}
4652
}

src/commit-message-install-spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ describe('commit-message-install', () => {
8383
const message = `some text\n\n` + json
8484

8585
stubSpawnShellOnce(getMessageGitCommand, 0, message, '')
86-
return getJsonFromGit().then(json => {
87-
snapshot('parsed back message', json)
86+
return getJsonFromGit().then(extracted => {
87+
snapshot('parsed back message', extracted)
8888
})
8989
})
9090

src/get-install-json.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ function getInstallJson ({
4343

4444
const json = {
4545
platform,
46+
arch,
4647
env,
4748
packages
4849
}

0 commit comments

Comments
 (0)