semantic-release-vsce 5.7.4 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -10
- package/index.js +13 -21
- package/lib/prepare.js +8 -7
- package/lib/publish.js +14 -8
- package/lib/utils.js +17 -13
- package/lib/verify-ovsx-auth.js +5 -4
- package/lib/verify-pkg.js +7 -8
- package/lib/verify-target.js +6 -5
- package/lib/verify-vsce-auth.js +25 -10
- package/lib/verify.js +10 -10
- package/package.json +27 -25
- package/.eslintrc +0 -14
- package/.github/FUNDING.yml +0 -1
- package/.github/dependabot.yml +0 -14
- package/.github/workflows/ci.yaml +0 -44
- package/.github/workflows/dependabot-auto-merge.yaml +0 -22
- package/.github/workflows/validate-pr-title.yaml +0 -16
- package/.husky/pre-commit +0 -4
- package/.prettierrc +0 -3
- package/release.config.js +0 -66
- package/test/index.test.js +0 -261
- package/test/prepare.test.js +0 -189
- package/test/publish.test.js +0 -253
- package/test/verify-ovsx-auth.test.js +0 -60
- package/test/verify-pkg.test.js +0 -119
- package/test/verify-target.test.js +0 -65
- package/test/verify-vsce-auth.test.js +0 -74
- package/test/verify.test.js +0 -171
package/test/publish.test.js
DELETED
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
// Run tests serially to avoid env pollution
|
|
2
|
-
const test = require('ava').serial;
|
|
3
|
-
const sinon = require('sinon');
|
|
4
|
-
const proxyquire = require('proxyquire');
|
|
5
|
-
|
|
6
|
-
const logger = {
|
|
7
|
-
log: sinon.fake(),
|
|
8
|
-
};
|
|
9
|
-
const cwd = process.cwd();
|
|
10
|
-
|
|
11
|
-
test.beforeEach((t) => {
|
|
12
|
-
t.context.stubs = {
|
|
13
|
-
execaStub: sinon.stub(),
|
|
14
|
-
};
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
test.afterEach((t) => {
|
|
18
|
-
t.context.stubs.execaStub.resetHistory();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test('publish', async (t) => {
|
|
22
|
-
const { execaStub } = t.context.stubs;
|
|
23
|
-
const publisher = 'semantic-release-vsce';
|
|
24
|
-
const name = 'Semantice Release VSCE';
|
|
25
|
-
const publish = proxyquire('../lib/publish', {
|
|
26
|
-
execa: execaStub,
|
|
27
|
-
'fs-extra': {
|
|
28
|
-
readJson: sinon.stub().returns({
|
|
29
|
-
publisher,
|
|
30
|
-
name,
|
|
31
|
-
}),
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const version = '1.0.0';
|
|
36
|
-
const token = 'abc123';
|
|
37
|
-
sinon.stub(process, 'env').value({
|
|
38
|
-
VSCE_PAT: token,
|
|
39
|
-
});
|
|
40
|
-
const result = await publish(version, undefined, logger, cwd);
|
|
41
|
-
|
|
42
|
-
t.deepEqual(result, {
|
|
43
|
-
name: 'Visual Studio Marketplace',
|
|
44
|
-
url: `https://marketplace.visualstudio.com/items?itemName=${publisher}.${name}`,
|
|
45
|
-
});
|
|
46
|
-
t.deepEqual(execaStub.getCall(0).args, [
|
|
47
|
-
'vsce',
|
|
48
|
-
['publish', version, '--no-git-tag-version'],
|
|
49
|
-
{ stdio: 'inherit', preferLocal: true, cwd },
|
|
50
|
-
]);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
test('publish with packagePath', async (t) => {
|
|
54
|
-
const { execaStub } = t.context.stubs;
|
|
55
|
-
const publisher = 'semantic-release-vsce';
|
|
56
|
-
const name = 'Semantice Release VSCE';
|
|
57
|
-
const publish = proxyquire('../lib/publish', {
|
|
58
|
-
execa: execaStub,
|
|
59
|
-
'fs-extra': {
|
|
60
|
-
readJson: sinon.stub().returns({
|
|
61
|
-
publisher,
|
|
62
|
-
name,
|
|
63
|
-
}),
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
const version = '1.0.0';
|
|
68
|
-
const packagePath = 'test.vsix';
|
|
69
|
-
const token = 'abc123';
|
|
70
|
-
sinon.stub(process, 'env').value({
|
|
71
|
-
VSCE_PAT: token,
|
|
72
|
-
});
|
|
73
|
-
const result = await publish(version, packagePath, logger, cwd);
|
|
74
|
-
|
|
75
|
-
t.deepEqual(result, {
|
|
76
|
-
name: 'Visual Studio Marketplace',
|
|
77
|
-
url: `https://marketplace.visualstudio.com/items?itemName=${publisher}.${name}`,
|
|
78
|
-
});
|
|
79
|
-
t.deepEqual(execaStub.getCall(0).args, [
|
|
80
|
-
'vsce',
|
|
81
|
-
['publish', '--packagePath', packagePath],
|
|
82
|
-
{ stdio: 'inherit', preferLocal: true, cwd },
|
|
83
|
-
]);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
test('publish with multiple packagePath', async (t) => {
|
|
87
|
-
const { execaStub } = t.context.stubs;
|
|
88
|
-
const publisher = 'semantic-release-vsce';
|
|
89
|
-
const name = 'Semantice Release VSCE';
|
|
90
|
-
const publish = proxyquire('../lib/publish', {
|
|
91
|
-
execa: execaStub,
|
|
92
|
-
'fs-extra': {
|
|
93
|
-
readJson: sinon.stub().returns({
|
|
94
|
-
publisher,
|
|
95
|
-
name,
|
|
96
|
-
}),
|
|
97
|
-
},
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
const version = '1.0.0';
|
|
101
|
-
const packagePath = ['test.vsix', 'test2.vsix'];
|
|
102
|
-
const token = 'abc123';
|
|
103
|
-
sinon.stub(process, 'env').value({
|
|
104
|
-
VSCE_PAT: token,
|
|
105
|
-
});
|
|
106
|
-
const result = await publish(version, packagePath, logger, cwd);
|
|
107
|
-
|
|
108
|
-
t.deepEqual(result, {
|
|
109
|
-
name: 'Visual Studio Marketplace',
|
|
110
|
-
url: `https://marketplace.visualstudio.com/items?itemName=${publisher}.${name}`,
|
|
111
|
-
});
|
|
112
|
-
t.deepEqual(execaStub.getCall(0).args, [
|
|
113
|
-
'vsce',
|
|
114
|
-
['publish', '--packagePath', ...packagePath],
|
|
115
|
-
{ stdio: 'inherit', preferLocal: true, cwd },
|
|
116
|
-
]);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
test('publish with target', async (t) => {
|
|
120
|
-
const { execaStub } = t.context.stubs;
|
|
121
|
-
const publisher = 'semantic-release-vsce';
|
|
122
|
-
const name = 'Semantice Release VSCE';
|
|
123
|
-
const publish = proxyquire('../lib/publish', {
|
|
124
|
-
execa: execaStub,
|
|
125
|
-
'fs-extra': {
|
|
126
|
-
readJson: sinon.stub().returns({
|
|
127
|
-
publisher,
|
|
128
|
-
name,
|
|
129
|
-
}),
|
|
130
|
-
},
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
const version = '1.0.0';
|
|
134
|
-
const token = 'abc123';
|
|
135
|
-
const target = 'linux-x64';
|
|
136
|
-
sinon.stub(process, 'env').value({
|
|
137
|
-
VSCE_PAT: token,
|
|
138
|
-
VSCE_TARGET: target,
|
|
139
|
-
});
|
|
140
|
-
const result = await publish(version, undefined, logger, cwd);
|
|
141
|
-
|
|
142
|
-
t.deepEqual(result, {
|
|
143
|
-
name: 'Visual Studio Marketplace',
|
|
144
|
-
url: `https://marketplace.visualstudio.com/items?itemName=${publisher}.${name}`,
|
|
145
|
-
});
|
|
146
|
-
t.deepEqual(execaStub.getCall(0).args, [
|
|
147
|
-
'vsce',
|
|
148
|
-
['publish', version, '--no-git-tag-version', '--target', target],
|
|
149
|
-
{ stdio: 'inherit', preferLocal: true, cwd },
|
|
150
|
-
]);
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
test('publish to OpenVSX', async (t) => {
|
|
154
|
-
const { execaStub } = t.context.stubs;
|
|
155
|
-
const publisher = 'semantic-release-vsce';
|
|
156
|
-
const name = 'Semantice Release VSCE';
|
|
157
|
-
const publish = proxyquire('../lib/publish', {
|
|
158
|
-
execa: execaStub,
|
|
159
|
-
'fs-extra': {
|
|
160
|
-
readJson: sinon.stub().returns({
|
|
161
|
-
publisher,
|
|
162
|
-
name,
|
|
163
|
-
}),
|
|
164
|
-
},
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
const version = '1.0.0';
|
|
168
|
-
const packagePath = 'test.vsix';
|
|
169
|
-
const token = 'abc123';
|
|
170
|
-
sinon.stub(process, 'env').value({
|
|
171
|
-
OVSX_PAT: token,
|
|
172
|
-
VSCE_PAT: token,
|
|
173
|
-
});
|
|
174
|
-
const result = await publish(version, packagePath, logger, cwd);
|
|
175
|
-
|
|
176
|
-
t.deepEqual(result, {
|
|
177
|
-
name: 'Visual Studio Marketplace',
|
|
178
|
-
url: `https://marketplace.visualstudio.com/items?itemName=${publisher}.${name}`,
|
|
179
|
-
});
|
|
180
|
-
t.deepEqual(execaStub.getCall(0).args, [
|
|
181
|
-
'vsce',
|
|
182
|
-
['publish', '--packagePath', packagePath],
|
|
183
|
-
{ stdio: 'inherit', preferLocal: true, cwd },
|
|
184
|
-
]);
|
|
185
|
-
|
|
186
|
-
// t.deepEqual(result[1], {
|
|
187
|
-
// name: 'Open VSX Registry',
|
|
188
|
-
// url: `https://open-vsx.org/extension/${publisher}/${name}/${version}`
|
|
189
|
-
// });
|
|
190
|
-
t.deepEqual(execaStub.getCall(1).args, [
|
|
191
|
-
'ovsx',
|
|
192
|
-
['publish', '--packagePath', packagePath],
|
|
193
|
-
{ stdio: 'inherit', preferLocal: true, cwd },
|
|
194
|
-
]);
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
test('publish to OpenVSX only', async (t) => {
|
|
198
|
-
const { execaStub } = t.context.stubs;
|
|
199
|
-
const publisher = 'semantic-release-vsce';
|
|
200
|
-
const name = 'Semantice Release VSCE';
|
|
201
|
-
const publish = proxyquire('../lib/publish', {
|
|
202
|
-
execa: execaStub,
|
|
203
|
-
'fs-extra': {
|
|
204
|
-
readJson: sinon.stub().returns({
|
|
205
|
-
publisher,
|
|
206
|
-
name,
|
|
207
|
-
}),
|
|
208
|
-
},
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
const version = '1.0.0';
|
|
212
|
-
const packagePath = 'test.vsix';
|
|
213
|
-
const token = 'abc123';
|
|
214
|
-
sinon.stub(process, 'env').value({
|
|
215
|
-
OVSX_PAT: token,
|
|
216
|
-
});
|
|
217
|
-
const result = await publish(version, packagePath, logger, cwd);
|
|
218
|
-
|
|
219
|
-
t.deepEqual(result, {
|
|
220
|
-
name: 'Open VSX Registry',
|
|
221
|
-
url: `https://open-vsx.org/extension/${publisher}/${name}/${version}`,
|
|
222
|
-
});
|
|
223
|
-
t.true(execaStub.calledOnce);
|
|
224
|
-
t.deepEqual(execaStub.getCall(0).args, [
|
|
225
|
-
'ovsx',
|
|
226
|
-
['publish', '--packagePath', packagePath],
|
|
227
|
-
{ stdio: 'inherit', preferLocal: true, cwd },
|
|
228
|
-
]);
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
test('should not publish when neither vsce nor ovsx personal access token is configured', async (t) => {
|
|
232
|
-
const { execaStub } = t.context.stubs;
|
|
233
|
-
const publisher = 'semantic-release-vsce';
|
|
234
|
-
const name = 'Semantice Release VSCE';
|
|
235
|
-
const publish = proxyquire('../lib/publish', {
|
|
236
|
-
execa: execaStub,
|
|
237
|
-
'fs-extra': {
|
|
238
|
-
readJson: sinon.stub().returns({
|
|
239
|
-
publisher,
|
|
240
|
-
name,
|
|
241
|
-
}),
|
|
242
|
-
},
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
const version = '1.0.0';
|
|
246
|
-
const packagePath = 'test.vsix';
|
|
247
|
-
sinon.stub(process, 'env').value({});
|
|
248
|
-
|
|
249
|
-
const result = await publish(version, packagePath, logger, cwd);
|
|
250
|
-
|
|
251
|
-
t.falsy(result);
|
|
252
|
-
t.true(execaStub.notCalled);
|
|
253
|
-
});
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
const test = require('ava').serial;
|
|
2
|
-
const sinon = require('sinon');
|
|
3
|
-
const proxyquire = require('proxyquire');
|
|
4
|
-
const SemanticReleaseError = require('@semantic-release/error');
|
|
5
|
-
|
|
6
|
-
const cwd = process.cwd();
|
|
7
|
-
|
|
8
|
-
test('OVSX_PAT is set', async (t) => {
|
|
9
|
-
const logger = {
|
|
10
|
-
log: sinon.fake(),
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
sinon.stub(process, 'env').value({
|
|
14
|
-
OVSX_PAT: 'abc123',
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const verifyOvsxAuth = proxyquire('../lib/verify-ovsx-auth', {
|
|
18
|
-
execa: sinon
|
|
19
|
-
.stub()
|
|
20
|
-
.withArgs('ovsx', ['verify-pat'], { preferLocal: true, cwd })
|
|
21
|
-
.resolves(),
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
await t.notThrowsAsync(() => verifyOvsxAuth(logger));
|
|
25
|
-
t.true(logger.log.calledOnce);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
test('OVSX_PAT is invalid', async (t) => {
|
|
29
|
-
const logger = {
|
|
30
|
-
log: sinon.fake(),
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
sinon.stub(process, 'env').value({
|
|
34
|
-
OVSX_PAT: '',
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const verifyOvsxAuth = require('../lib/verify-ovsx-auth');
|
|
38
|
-
|
|
39
|
-
await t.throwsAsync(() => verifyOvsxAuth(logger), {
|
|
40
|
-
instanceOf: SemanticReleaseError,
|
|
41
|
-
code: 'EEMPTYOVSXPAT',
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
test('OVSX_PAT is invalid but not empty', async (t) => {
|
|
46
|
-
const logger = {
|
|
47
|
-
log: sinon.fake(),
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
sinon.stub(process, 'env').value({
|
|
51
|
-
OVSX_PAT: 'abc123',
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
const verifyOvsxAuth = require('../lib/verify-ovsx-auth');
|
|
55
|
-
|
|
56
|
-
await t.throwsAsync(() => verifyOvsxAuth(logger), {
|
|
57
|
-
instanceOf: SemanticReleaseError,
|
|
58
|
-
code: 'EINVALIDOVSXPAT',
|
|
59
|
-
});
|
|
60
|
-
});
|
package/test/verify-pkg.test.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
const sinon = require('sinon');
|
|
2
|
-
const test = require('ava');
|
|
3
|
-
const proxyquire = require('proxyquire');
|
|
4
|
-
const SemanticReleaseError = require('@semantic-release/error');
|
|
5
|
-
|
|
6
|
-
const cwd = process.cwd();
|
|
7
|
-
|
|
8
|
-
test('package.json is found', async (t) => {
|
|
9
|
-
const name = 'test';
|
|
10
|
-
const publisher = 'tester';
|
|
11
|
-
|
|
12
|
-
const verifyPkg = proxyquire('../lib/verify-pkg', {
|
|
13
|
-
fs: {
|
|
14
|
-
existsSync: sinon.stub().returns(true),
|
|
15
|
-
},
|
|
16
|
-
'fs-extra': {
|
|
17
|
-
readJson: sinon.stub().returns({
|
|
18
|
-
name,
|
|
19
|
-
publisher,
|
|
20
|
-
}),
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
await t.notThrowsAsync(() => verifyPkg(cwd));
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
test('package.json is not found', async (t) => {
|
|
28
|
-
const name = 'test';
|
|
29
|
-
const publisher = 'tester';
|
|
30
|
-
|
|
31
|
-
const verifyPkg = proxyquire('../lib/verify-pkg', {
|
|
32
|
-
fs: {
|
|
33
|
-
existsSync: sinon.stub().returns(false),
|
|
34
|
-
},
|
|
35
|
-
'fs-extra': {
|
|
36
|
-
readJson: sinon.stub().returns({
|
|
37
|
-
name,
|
|
38
|
-
publisher,
|
|
39
|
-
}),
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
await t.throwsAsync(() => verifyPkg(cwd), {
|
|
44
|
-
instanceOf: SemanticReleaseError,
|
|
45
|
-
code: 'ENOPKG',
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
test('package is valid', async (t) => {
|
|
50
|
-
const name = 'test';
|
|
51
|
-
const publisher = 'tester';
|
|
52
|
-
const verifyPkg = proxyquire('../lib/verify-pkg', {
|
|
53
|
-
fs: {
|
|
54
|
-
existsSync: sinon.stub().returns(true),
|
|
55
|
-
},
|
|
56
|
-
'fs-extra': {
|
|
57
|
-
readJson: sinon.stub().returns({
|
|
58
|
-
publisher,
|
|
59
|
-
name,
|
|
60
|
-
}),
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
await t.notThrowsAsync(() => verifyPkg(cwd));
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
test('package is invalid', async (t) => {
|
|
68
|
-
const verifyPkg = proxyquire('../lib/verify-pkg', {
|
|
69
|
-
fs: {
|
|
70
|
-
existsSync: sinon.stub().returns(true),
|
|
71
|
-
},
|
|
72
|
-
'fs-extra': {
|
|
73
|
-
readJson: sinon.stub().rejects(),
|
|
74
|
-
},
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
await t.throwsAsync(() => verifyPkg(cwd), {
|
|
78
|
-
instanceOf: SemanticReleaseError,
|
|
79
|
-
code: 'EINVALIDPKG',
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
test('package is missing name', async (t) => {
|
|
84
|
-
const publisher = 'tester';
|
|
85
|
-
const verifyPkg = proxyquire('../lib/verify-pkg', {
|
|
86
|
-
fs: {
|
|
87
|
-
existsSync: sinon.stub().returns(true),
|
|
88
|
-
},
|
|
89
|
-
'fs-extra': {
|
|
90
|
-
readJson: sinon.stub().returns({
|
|
91
|
-
publisher,
|
|
92
|
-
}),
|
|
93
|
-
},
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
await t.throwsAsync(() => verifyPkg(cwd), {
|
|
97
|
-
instanceOf: SemanticReleaseError,
|
|
98
|
-
code: 'ENOPKGNAME',
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
test('package is missing publisher', async (t) => {
|
|
103
|
-
const name = 'test';
|
|
104
|
-
const verifyPkg = proxyquire('../lib/verify-pkg', {
|
|
105
|
-
fs: {
|
|
106
|
-
existsSync: sinon.stub().returns(true),
|
|
107
|
-
},
|
|
108
|
-
'fs-extra': {
|
|
109
|
-
readJson: sinon.stub().returns({
|
|
110
|
-
name,
|
|
111
|
-
}),
|
|
112
|
-
},
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
await t.throwsAsync(() => verifyPkg(cwd), {
|
|
116
|
-
instanceOf: SemanticReleaseError,
|
|
117
|
-
code: 'ENOPUBLISHER',
|
|
118
|
-
});
|
|
119
|
-
});
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
const sinon = require('sinon');
|
|
2
|
-
const test = require('ava');
|
|
3
|
-
const proxyquire = require('proxyquire');
|
|
4
|
-
const SemanticReleaseError = require('@semantic-release/error');
|
|
5
|
-
|
|
6
|
-
test('VSCE_TARGET is not set', async (t) => {
|
|
7
|
-
const vscePackage = sinon.stub().returns({
|
|
8
|
-
Targets: new Map(),
|
|
9
|
-
});
|
|
10
|
-
const verifyTarget = proxyquire('../lib/verify-target', {
|
|
11
|
-
'vsce/out/package': vscePackage,
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
await t.notThrowsAsync(() => verifyTarget());
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
test('VSCE_TARGET is valid', async (t) => {
|
|
18
|
-
sinon.stub(process, 'env').value({
|
|
19
|
-
VSCE_TARGET: 'linux-x64',
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const verifyTarget = require('../lib/verify-target');
|
|
23
|
-
|
|
24
|
-
await t.notThrowsAsync(() => verifyTarget());
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
test('VSCE_TARGET is empty', async (t) => {
|
|
28
|
-
const vscePackage = sinon.stub().returns({
|
|
29
|
-
Targets: new Map(),
|
|
30
|
-
});
|
|
31
|
-
const verifyTarget = proxyquire('../lib/verify-target', {
|
|
32
|
-
'vsce/out/package': vscePackage,
|
|
33
|
-
});
|
|
34
|
-
sinon.stub(process, 'env').value({
|
|
35
|
-
VSCE_TARGET: '',
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
await t.throwsAsync(() => verifyTarget(), {
|
|
39
|
-
instanceOf: SemanticReleaseError,
|
|
40
|
-
code: 'EINVALIDVSCETARGET',
|
|
41
|
-
});
|
|
42
|
-
t.false(vscePackage.called);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
test('VSCE_TARGET is unsupported', async (t) => {
|
|
46
|
-
sinon.stub(process, 'env').value({
|
|
47
|
-
VSCE_TARGET: 'whatever-x64',
|
|
48
|
-
});
|
|
49
|
-
const verifyTarget = require('../lib/verify-target');
|
|
50
|
-
|
|
51
|
-
await t.throwsAsync(() => verifyTarget(), {
|
|
52
|
-
instanceOf: SemanticReleaseError,
|
|
53
|
-
code: 'EUNSUPPORTEDVSCETARGET',
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
test('VSCE_TARGET is universal', async (t) => {
|
|
58
|
-
sinon.stub(process, 'env').value({
|
|
59
|
-
VSCE_TARGET: 'universal',
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
const verifyTarget = require('../lib/verify-target');
|
|
63
|
-
|
|
64
|
-
await t.notThrowsAsync(() => verifyTarget());
|
|
65
|
-
});
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
const test = require('ava').serial;
|
|
2
|
-
const sinon = require('sinon');
|
|
3
|
-
const proxyquire = require('proxyquire');
|
|
4
|
-
const SemanticReleaseError = require('@semantic-release/error');
|
|
5
|
-
|
|
6
|
-
const logger = {
|
|
7
|
-
log: sinon.fake(),
|
|
8
|
-
};
|
|
9
|
-
const cwd = process.cwd();
|
|
10
|
-
|
|
11
|
-
test('VSCE_PAT is set', async (t) => {
|
|
12
|
-
sinon.stub(process, 'env').value({
|
|
13
|
-
VSCE_PAT: 'abc123',
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
const verifyVsceAuth = proxyquire('../lib/verify-vsce-auth', {
|
|
17
|
-
execa: sinon
|
|
18
|
-
.stub()
|
|
19
|
-
.withArgs('vsce', ['verify-pat'], { preferLocal: true, cwd })
|
|
20
|
-
.resolves(),
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
await t.notThrowsAsync(() => verifyVsceAuth(logger));
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
test('VSCE_PAT is valid', async (t) => {
|
|
27
|
-
sinon.stub(process, 'env').value({
|
|
28
|
-
VSCE_PAT: 'abc123',
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
const verifyVsceAuth = proxyquire('../lib/verify-vsce-auth', {
|
|
32
|
-
execa: sinon
|
|
33
|
-
.stub()
|
|
34
|
-
.withArgs('vsce', ['verify-pat'], { preferLocal: true, cwd })
|
|
35
|
-
.resolves(),
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
await t.notThrowsAsync(() => verifyVsceAuth(logger));
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
test('VSCE_PAT is invalid', async (t) => {
|
|
42
|
-
const logger = {
|
|
43
|
-
log: sinon.fake(),
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
sinon.stub(process, 'env').value({
|
|
47
|
-
VSCE_PAT: '',
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
const verifyOvsxAuth = require('../lib/verify-vsce-auth');
|
|
51
|
-
|
|
52
|
-
await t.throwsAsync(() => verifyOvsxAuth(logger), {
|
|
53
|
-
instanceOf: SemanticReleaseError,
|
|
54
|
-
code: 'EEMPTYVSCEPAT',
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
test('VSCE_PAT is invalid but not empty', async (t) => {
|
|
59
|
-
sinon.stub(process, 'env').value({
|
|
60
|
-
VSCE_PAT: 'abc123',
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
const verifyVsceAuth = proxyquire('../lib/verify-vsce-auth', {
|
|
64
|
-
execa: sinon
|
|
65
|
-
.stub()
|
|
66
|
-
.withArgs('vsce', ['verify-pat'], { preferLocal: true, cwd })
|
|
67
|
-
.rejects(),
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
await t.throwsAsync(() => verifyVsceAuth(logger), {
|
|
71
|
-
instanceOf: SemanticReleaseError,
|
|
72
|
-
code: 'EINVALIDVSCEPAT',
|
|
73
|
-
});
|
|
74
|
-
});
|