semantic-release-vsce 6.0.0 → 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/package.json +4 -1
- package/.github/FUNDING.yml +0 -1
- package/.github/dependabot.yml +0 -14
- package/.github/workflows/ci.yaml +0 -53
- 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/eslint.config.js +0 -7
- package/release.config.js +0 -74
- package/test/index.test.js +0 -320
- package/test/prepare.test.js +0 -208
- package/test/publish.test.js +0 -367
- package/test/verify-ovsx-auth.test.js +0 -64
- package/test/verify-pkg.test.js +0 -110
- package/test/verify-target.test.js +0 -68
- package/test/verify-vsce-auth.test.js +0 -168
- package/test/verify.test.js +0 -243
package/test/verify-pkg.test.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import avaTest from 'ava';
|
|
2
|
-
import SemanticReleaseError from '@semantic-release/error';
|
|
3
|
-
import { stub } from 'sinon';
|
|
4
|
-
import esmock from 'esmock';
|
|
5
|
-
|
|
6
|
-
// Run tests serially to avoid env pollution
|
|
7
|
-
const test = avaTest.serial;
|
|
8
|
-
|
|
9
|
-
const cwd = process.cwd();
|
|
10
|
-
|
|
11
|
-
test('package.json is found', async (t) => {
|
|
12
|
-
const name = 'test';
|
|
13
|
-
const publisher = 'tester';
|
|
14
|
-
|
|
15
|
-
const { verifyPkg } = await esmock('../lib/verify-pkg.js', {
|
|
16
|
-
'fs-extra/esm': {
|
|
17
|
-
pathExists: stub().resolves(true),
|
|
18
|
-
readJson: stub().resolves({
|
|
19
|
-
name,
|
|
20
|
-
publisher,
|
|
21
|
-
}),
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
await t.notThrowsAsync(() => verifyPkg(cwd));
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
test('package.json is not found', async (t) => {
|
|
29
|
-
const name = 'test';
|
|
30
|
-
const publisher = 'tester';
|
|
31
|
-
|
|
32
|
-
const { verifyPkg } = await esmock('../lib/verify-pkg.js', {
|
|
33
|
-
'fs-extra/esm': {
|
|
34
|
-
pathExists: stub().resolves(false),
|
|
35
|
-
readJson: stub().resolves({
|
|
36
|
-
name,
|
|
37
|
-
publisher,
|
|
38
|
-
}),
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
await t.throwsAsync(() => verifyPkg(cwd), {
|
|
43
|
-
instanceOf: SemanticReleaseError,
|
|
44
|
-
code: 'ENOPKG',
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
test('package is valid', async (t) => {
|
|
49
|
-
const name = 'test';
|
|
50
|
-
const publisher = 'tester';
|
|
51
|
-
const { verifyPkg } = await esmock('../lib/verify-pkg.js', {
|
|
52
|
-
'fs-extra/esm': {
|
|
53
|
-
pathExists: stub().resolves(true),
|
|
54
|
-
readJson: stub().resolves({
|
|
55
|
-
name,
|
|
56
|
-
publisher,
|
|
57
|
-
}),
|
|
58
|
-
},
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
await t.notThrowsAsync(() => verifyPkg(cwd));
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
test('package is invalid', async (t) => {
|
|
65
|
-
const { verifyPkg } = await esmock('../lib/verify-pkg.js', {
|
|
66
|
-
'fs-extra/esm': {
|
|
67
|
-
pathExists: stub().resolves(true),
|
|
68
|
-
readJson: stub().rejects(),
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
await t.throwsAsync(() => verifyPkg(cwd), {
|
|
73
|
-
instanceOf: SemanticReleaseError,
|
|
74
|
-
code: 'EINVALIDPKG',
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
test('package is missing name', async (t) => {
|
|
79
|
-
const publisher = 'tester';
|
|
80
|
-
const { verifyPkg } = await esmock('../lib/verify-pkg.js', {
|
|
81
|
-
'fs-extra/esm': {
|
|
82
|
-
pathExists: stub().resolves(true),
|
|
83
|
-
readJson: stub().resolves({
|
|
84
|
-
publisher,
|
|
85
|
-
}),
|
|
86
|
-
},
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
await t.throwsAsync(() => verifyPkg(cwd), {
|
|
90
|
-
instanceOf: SemanticReleaseError,
|
|
91
|
-
code: 'ENOPKGNAME',
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
test('package is missing publisher', async (t) => {
|
|
96
|
-
const name = 'test';
|
|
97
|
-
const { verifyPkg } = await esmock('../lib/verify-pkg.js', {
|
|
98
|
-
'fs-extra/esm': {
|
|
99
|
-
pathExists: stub().resolves(true),
|
|
100
|
-
readJson: stub().resolves({
|
|
101
|
-
name,
|
|
102
|
-
}),
|
|
103
|
-
},
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
await t.throwsAsync(() => verifyPkg(cwd), {
|
|
107
|
-
instanceOf: SemanticReleaseError,
|
|
108
|
-
code: 'ENOPUBLISHER',
|
|
109
|
-
});
|
|
110
|
-
});
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import SemanticReleaseError from '@semantic-release/error';
|
|
2
|
-
import avaTest from 'ava';
|
|
3
|
-
import esmock from 'esmock';
|
|
4
|
-
import { stub } from 'sinon';
|
|
5
|
-
|
|
6
|
-
// Run tests serially to avoid env pollution
|
|
7
|
-
const test = avaTest.serial;
|
|
8
|
-
|
|
9
|
-
test('VSCE_TARGET is not set', async (t) => {
|
|
10
|
-
const vscePackage = stub().returns({
|
|
11
|
-
Targets: new Map(),
|
|
12
|
-
});
|
|
13
|
-
const { verifyTarget } = await esmock('../lib/verify-target.js', {
|
|
14
|
-
'@vscode/vsce/out/package.js': vscePackage,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
await t.notThrowsAsync(() => verifyTarget());
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
test('VSCE_TARGET is valid', async (t) => {
|
|
21
|
-
stub(process, 'env').value({
|
|
22
|
-
VSCE_TARGET: 'linux-x64',
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const { verifyTarget } = await import('../lib/verify-target.js');
|
|
26
|
-
|
|
27
|
-
await t.notThrowsAsync(() => verifyTarget());
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
test('VSCE_TARGET is empty', async (t) => {
|
|
31
|
-
const vscePackage = stub().returns({
|
|
32
|
-
Targets: new Map(),
|
|
33
|
-
});
|
|
34
|
-
const { verifyTarget } = await esmock('../lib/verify-target.js', {
|
|
35
|
-
'@vscode/vsce/out/package.js': vscePackage,
|
|
36
|
-
});
|
|
37
|
-
stub(process, 'env').value({
|
|
38
|
-
VSCE_TARGET: '',
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
await t.throwsAsync(() => verifyTarget(), {
|
|
42
|
-
instanceOf: SemanticReleaseError,
|
|
43
|
-
code: 'EINVALIDVSCETARGET',
|
|
44
|
-
});
|
|
45
|
-
t.false(vscePackage.called);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
test('VSCE_TARGET is unsupported', async (t) => {
|
|
49
|
-
stub(process, 'env').value({
|
|
50
|
-
VSCE_TARGET: 'whatever-x64',
|
|
51
|
-
});
|
|
52
|
-
const { verifyTarget } = await import('../lib/verify-target.js');
|
|
53
|
-
|
|
54
|
-
await t.throwsAsync(() => verifyTarget(), {
|
|
55
|
-
instanceOf: SemanticReleaseError,
|
|
56
|
-
code: 'EUNSUPPORTEDVSCETARGET',
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
test('VSCE_TARGET is universal', async (t) => {
|
|
61
|
-
stub(process, 'env').value({
|
|
62
|
-
VSCE_TARGET: 'universal',
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
const { verifyTarget } = await import('../lib/verify-target.js');
|
|
66
|
-
|
|
67
|
-
await t.notThrowsAsync(() => verifyTarget());
|
|
68
|
-
});
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import avaTest from 'ava';
|
|
2
|
-
import { fake, stub } from 'sinon';
|
|
3
|
-
import esmock from 'esmock';
|
|
4
|
-
import SemanticReleaseError from '@semantic-release/error';
|
|
5
|
-
|
|
6
|
-
// Run tests serially to avoid env pollution
|
|
7
|
-
const test = avaTest.serial;
|
|
8
|
-
|
|
9
|
-
const logger = {
|
|
10
|
-
log: fake(),
|
|
11
|
-
};
|
|
12
|
-
const cwd = process.cwd();
|
|
13
|
-
|
|
14
|
-
test('VSCE_PAT is set', async (t) => {
|
|
15
|
-
stub(process, 'env').value({
|
|
16
|
-
VSCE_PAT: 'abc123',
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
const { verifyVsceAuth } = await esmock('../lib/verify-vsce-auth.js', {
|
|
20
|
-
execa: {
|
|
21
|
-
execa: stub()
|
|
22
|
-
.withArgs('vsce', ['verify-pat'], { preferLocal: true, cwd })
|
|
23
|
-
.resolves(),
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
await t.notThrowsAsync(() => verifyVsceAuth(logger));
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
test('VSCE_AZURE_CREDENTIAL is set to true', async (t) => {
|
|
31
|
-
stub(process, 'env').value({
|
|
32
|
-
VSCE_AZURE_CREDENTIAL: 'true',
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const { verifyVsceAuth } = await esmock('../lib/verify-vsce-auth.js', {
|
|
36
|
-
execa: {
|
|
37
|
-
execa: stub()
|
|
38
|
-
.withArgs('vsce', ['verify-pat', '--azure-credential'], {
|
|
39
|
-
preferLocal: true,
|
|
40
|
-
cwd,
|
|
41
|
-
})
|
|
42
|
-
.resolves(),
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
await t.notThrowsAsync(() => verifyVsceAuth(logger));
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
test('VSCE_AZURE_CREDENTIAL is set to 1', async (t) => {
|
|
50
|
-
stub(process, 'env').value({
|
|
51
|
-
VSCE_AZURE_CREDENTIAL: '1',
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
const { verifyVsceAuth } = await esmock('../lib/verify-vsce-auth.js', {
|
|
55
|
-
execa: {
|
|
56
|
-
execa: stub()
|
|
57
|
-
.withArgs('vsce', ['verify-pat', '--azure-credential'], {
|
|
58
|
-
preferLocal: true,
|
|
59
|
-
cwd,
|
|
60
|
-
})
|
|
61
|
-
.resolves(),
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
await t.notThrowsAsync(() => verifyVsceAuth(logger));
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
test('VSCE_AZURE_CREDENTIAL is set to false', async (t) => {
|
|
69
|
-
stub(process, 'env').value({
|
|
70
|
-
VSCE_AZURE_CREDENTIAL: 'false',
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
const { verifyVsceAuth } = await import('../lib/verify-vsce-auth.js');
|
|
74
|
-
|
|
75
|
-
await t.throwsAsync(() => verifyVsceAuth(logger), {
|
|
76
|
-
instanceOf: SemanticReleaseError,
|
|
77
|
-
code: 'EVSCEAUTHNOTPROVIDED',
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
test('VSCE_PAT is valid', async (t) => {
|
|
82
|
-
stub(process, 'env').value({
|
|
83
|
-
VSCE_PAT: 'abc123',
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
const { verifyVsceAuth } = await esmock('../lib/verify-vsce-auth.js', {
|
|
87
|
-
execa: {
|
|
88
|
-
execa: stub()
|
|
89
|
-
.withArgs('vsce', ['verify-pat'], { preferLocal: true, cwd })
|
|
90
|
-
.resolves(),
|
|
91
|
-
},
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
await t.notThrowsAsync(() => verifyVsceAuth(logger));
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
test('VSCE_PAT is valid and VSCE_AZURE_CREDENTIAL=false', async (t) => {
|
|
98
|
-
stub(process, 'env').value({
|
|
99
|
-
VSCE_PAT: 'abc123',
|
|
100
|
-
VSCE_AZURE_CREDENTIAL: 'false',
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
const { verifyVsceAuth } = await esmock('../lib/verify-vsce-auth.js', {
|
|
104
|
-
execa: {
|
|
105
|
-
execa: stub()
|
|
106
|
-
.withArgs('vsce', ['verify-pat'], { preferLocal: true, cwd })
|
|
107
|
-
.resolves(),
|
|
108
|
-
},
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
await t.notThrowsAsync(() => verifyVsceAuth(logger));
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
test('Neither VSCE_PAT or VSCE_AZURE_CREDENTIAL are set', async (t) => {
|
|
115
|
-
const logger = {
|
|
116
|
-
log: fake(),
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
stub(process, 'env').value({
|
|
120
|
-
VSCE_PAT: '',
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
const { verifyVsceAuth } = await import('../lib/verify-vsce-auth.js');
|
|
124
|
-
|
|
125
|
-
await t.throwsAsync(() => verifyVsceAuth(logger), {
|
|
126
|
-
instanceOf: SemanticReleaseError,
|
|
127
|
-
code: 'EVSCEAUTHNOTPROVIDED',
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
test('VSCE_PAT is invalid but not empty', async (t) => {
|
|
132
|
-
stub(process, 'env').value({
|
|
133
|
-
VSCE_PAT: 'abc123',
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
const { verifyVsceAuth } = await esmock('../lib/verify-vsce-auth.js', {
|
|
137
|
-
execa: {
|
|
138
|
-
execa: stub()
|
|
139
|
-
.withArgs('vsce', ['verify-pat'], { preferLocal: true, cwd })
|
|
140
|
-
.rejects(),
|
|
141
|
-
},
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
await t.throwsAsync(() => verifyVsceAuth(logger), {
|
|
145
|
-
instanceOf: SemanticReleaseError,
|
|
146
|
-
code: 'EINVALIDVSCEPAT',
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
test('Both VSCE_PAT and VSCE_AZURE_CREDENTIAL are set', async (t) => {
|
|
151
|
-
stub(process, 'env').value({
|
|
152
|
-
VSCE_PAT: 'abc123',
|
|
153
|
-
VSCE_AZURE_CREDENTIAL: 'true',
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
const { verifyVsceAuth } = await esmock('../lib/verify-vsce-auth.js', {
|
|
157
|
-
execa: {
|
|
158
|
-
execa: stub()
|
|
159
|
-
.withArgs('vsce', ['verify-pat'], { preferLocal: true, cwd })
|
|
160
|
-
.rejects(),
|
|
161
|
-
},
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
await t.throwsAsync(() => verifyVsceAuth(logger), {
|
|
165
|
-
instanceOf: SemanticReleaseError,
|
|
166
|
-
code: 'EVSCEDUPLICATEAUTHPROVIDED',
|
|
167
|
-
});
|
|
168
|
-
});
|
package/test/verify.test.js
DELETED
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
import SemanticReleaseError from '@semantic-release/error';
|
|
2
|
-
import test from 'ava';
|
|
3
|
-
import { fake, stub } from 'sinon';
|
|
4
|
-
import esmock from 'esmock';
|
|
5
|
-
|
|
6
|
-
const logger = {
|
|
7
|
-
log: fake(),
|
|
8
|
-
};
|
|
9
|
-
const cwd = process.cwd();
|
|
10
|
-
|
|
11
|
-
test('resolves', async (t) => {
|
|
12
|
-
const { verify } = await esmock('../lib/verify.js', {
|
|
13
|
-
'../lib/verify-pkg.js': {
|
|
14
|
-
verifyPkg: stub().resolves(),
|
|
15
|
-
},
|
|
16
|
-
'../lib/verify-target.js': {
|
|
17
|
-
verifyTarget: stub().resolves(),
|
|
18
|
-
},
|
|
19
|
-
'../lib/verify-vsce-auth.js': {
|
|
20
|
-
verifyVsceAuth: stub().resolves(),
|
|
21
|
-
},
|
|
22
|
-
'../lib/verify-ovsx-auth.js': {
|
|
23
|
-
verifyOvsxAuth: stub().resolves(),
|
|
24
|
-
},
|
|
25
|
-
'../lib/utils.js': {
|
|
26
|
-
isVscePublishEnabled: stub().returns(true),
|
|
27
|
-
isOvsxPublishEnabled: stub().returns(true),
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
await t.notThrowsAsync(() => verify({}, { logger, cwd }));
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
test('rejects with verify-pkg', async (t) => {
|
|
35
|
-
const { verify } = await esmock('../lib/verify.js', {
|
|
36
|
-
'../lib/verify-pkg.js': {
|
|
37
|
-
verifyPkg: stub().rejects(),
|
|
38
|
-
},
|
|
39
|
-
'../lib/verify-target.js': {
|
|
40
|
-
verifyTarget: stub().resolves(),
|
|
41
|
-
},
|
|
42
|
-
'../lib/verify-vsce-auth.js': {
|
|
43
|
-
verifyVsceAuth: stub().resolves(),
|
|
44
|
-
},
|
|
45
|
-
'../lib/verify-ovsx-auth.js': {
|
|
46
|
-
verifyOvsxAuth: stub().resolves(),
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
await t.throwsAsync(() => verify({}, { logger, cwd }));
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
test('rejects with verify-target', async (t) => {
|
|
54
|
-
const { verify } = await esmock('../lib/verify.js', {
|
|
55
|
-
'../lib/verify-pkg.js': {
|
|
56
|
-
verifyPkg: stub().resolves(),
|
|
57
|
-
},
|
|
58
|
-
'../lib/verify-target.js': {
|
|
59
|
-
verifyTarget: stub().rejects(),
|
|
60
|
-
},
|
|
61
|
-
'../lib/verify-vsce-auth.js': {
|
|
62
|
-
verifyVsceAuth: stub().resolves(),
|
|
63
|
-
},
|
|
64
|
-
'../lib/verify-ovsx-auth.js': {
|
|
65
|
-
verifyOvsxAuth: stub().resolves(),
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
await t.throwsAsync(() => verify({}, { logger, cwd }));
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
test('rejects with verify-auth', async (t) => {
|
|
73
|
-
const { verify } = await esmock('../lib/verify.js', {
|
|
74
|
-
'../lib/verify-pkg.js': {
|
|
75
|
-
verifyPkg: stub().resolves(),
|
|
76
|
-
},
|
|
77
|
-
'../lib/verify-target.js': {
|
|
78
|
-
verifyTarget: stub().resolves(),
|
|
79
|
-
},
|
|
80
|
-
'../lib/verify-vsce-auth.js': {
|
|
81
|
-
verifyVsceAuth: stub().rejects(),
|
|
82
|
-
},
|
|
83
|
-
'../lib/verify-ovsx-auth.js': {
|
|
84
|
-
verifyOvsxAuth: stub().resolves(),
|
|
85
|
-
},
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
await t.throwsAsync(() => verify({}, { logger, cwd }));
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
test('rejects with verify-ovsx-auth', async (t) => {
|
|
92
|
-
const { verify } = await esmock('../lib/verify.js', {
|
|
93
|
-
'../lib/verify-pkg.js': {
|
|
94
|
-
verifyPkg: stub().resolves(),
|
|
95
|
-
},
|
|
96
|
-
'../lib/verify-target.js': {
|
|
97
|
-
verifyTarget: stub().resolves(),
|
|
98
|
-
},
|
|
99
|
-
'../lib/verify-vsce-auth.js': {
|
|
100
|
-
verifyVsceAuth: stub().resolves(),
|
|
101
|
-
},
|
|
102
|
-
'../lib/verify-ovsx-auth.js': {
|
|
103
|
-
verifyOvsxAuth: stub().rejects(),
|
|
104
|
-
},
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
await t.throwsAsync(() => verify({}, { logger, cwd }));
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
test('it does not verify the auth tokens if publishing is disabled', async (t) => {
|
|
111
|
-
const stubs = {
|
|
112
|
-
verifyPkgStub: stub().resolves(),
|
|
113
|
-
verifyTargetStub: stub().resolves(),
|
|
114
|
-
verifyVsceAuthStub: stub().resolves(),
|
|
115
|
-
verifyOvsxAuthStub: stub().resolves(),
|
|
116
|
-
};
|
|
117
|
-
const { verify } = await esmock('../lib/verify.js', {
|
|
118
|
-
'../lib/verify-pkg.js': {
|
|
119
|
-
verifyPkg: stubs.verifyPkgStub,
|
|
120
|
-
},
|
|
121
|
-
'../lib/verify-target.js': {
|
|
122
|
-
verifyTarget: stubs.verifyTargetStub,
|
|
123
|
-
},
|
|
124
|
-
'../lib/verify-vsce-auth.js': {
|
|
125
|
-
verifyVsceAuth: stubs.verifyVsceAuthStub,
|
|
126
|
-
},
|
|
127
|
-
'../lib/verify-ovsx-auth.js': {
|
|
128
|
-
verifyOvsxAuth: stubs.verifyOvsxAuthStub,
|
|
129
|
-
},
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
await verify({ publish: false }, { logger, cwd });
|
|
133
|
-
|
|
134
|
-
t.true(stubs.verifyVsceAuthStub.notCalled);
|
|
135
|
-
t.true(stubs.verifyOvsxAuthStub.notCalled);
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
test('errors when neither vsce nor ovsx personal access token is configured', async (t) => {
|
|
139
|
-
const stubs = {
|
|
140
|
-
verifyPkgStub: stub().resolves(),
|
|
141
|
-
verifyTargetStub: stub().resolves(),
|
|
142
|
-
verifyVsceAuthStub: stub().resolves(),
|
|
143
|
-
verifyOvsxAuthStub: stub().resolves(),
|
|
144
|
-
utilsStub: {
|
|
145
|
-
isVscePublishEnabled: stub().returns(false),
|
|
146
|
-
isOvsxPublishEnabled: stub().returns(false),
|
|
147
|
-
},
|
|
148
|
-
};
|
|
149
|
-
const { verify } = await esmock('../lib/verify.js', {
|
|
150
|
-
'../lib/verify-pkg.js': {
|
|
151
|
-
verifyPkg: stubs.verifyPkgStub,
|
|
152
|
-
},
|
|
153
|
-
'../lib/verify-target.js': {
|
|
154
|
-
verifyTarget: stubs.verifyTargetStub,
|
|
155
|
-
},
|
|
156
|
-
'../lib/verify-vsce-auth.js': {
|
|
157
|
-
verifyVsceAuth: stubs.verifyVsceAuthStub,
|
|
158
|
-
},
|
|
159
|
-
'../lib/verify-ovsx-auth.js': {
|
|
160
|
-
verifyOvsxAuth: stubs.verifyOvsxAuthStub,
|
|
161
|
-
},
|
|
162
|
-
'../lib/utils.js': stubs.utilsStub,
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
await t.throwsAsync(() => verify({}, { logger, cwd }), {
|
|
166
|
-
instanceOf: SemanticReleaseError,
|
|
167
|
-
code: 'ENOPAT',
|
|
168
|
-
});
|
|
169
|
-
t.true(stubs.verifyVsceAuthStub.notCalled);
|
|
170
|
-
t.true(stubs.verifyOvsxAuthStub.notCalled);
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
test('verify vsce only', async (t) => {
|
|
174
|
-
const stubs = {
|
|
175
|
-
verifyPkgStub: stub().resolves(),
|
|
176
|
-
verifyTargetStub: stub().resolves(),
|
|
177
|
-
verifyVsceAuthStub: stub().resolves(),
|
|
178
|
-
verifyOvsxAuthStub: stub().resolves(),
|
|
179
|
-
utilsStub: {
|
|
180
|
-
isVscePublishEnabled: stub().returns(true),
|
|
181
|
-
isOvsxPublishEnabled: stub().returns(false),
|
|
182
|
-
},
|
|
183
|
-
logger: {
|
|
184
|
-
log: fake(),
|
|
185
|
-
},
|
|
186
|
-
};
|
|
187
|
-
const { verify } = await esmock('../lib/verify.js', {
|
|
188
|
-
'../lib/verify-pkg.js': {
|
|
189
|
-
verifyPkg: stubs.verifyPkgStub,
|
|
190
|
-
},
|
|
191
|
-
'../lib/verify-target.js': {
|
|
192
|
-
verifyTarget: stubs.verifyTargetStub,
|
|
193
|
-
},
|
|
194
|
-
'../lib/verify-vsce-auth.js': {
|
|
195
|
-
verifyVsceAuth: stubs.verifyVsceAuthStub,
|
|
196
|
-
},
|
|
197
|
-
'../lib/verify-ovsx-auth.js': {
|
|
198
|
-
verifyOvsxAuth: stubs.verifyOvsxAuthStub,
|
|
199
|
-
},
|
|
200
|
-
'../lib/utils.js': stubs.utilsStub,
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
await verify({}, { logger: stubs.logger, cwd });
|
|
204
|
-
t.true(stubs.verifyVsceAuthStub.calledOnce);
|
|
205
|
-
t.true(stubs.verifyOvsxAuthStub.notCalled);
|
|
206
|
-
t.true(stubs.logger.log.calledOnce);
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
test('verify ovsx only', async (t) => {
|
|
210
|
-
const stubs = {
|
|
211
|
-
verifyPkgStub: stub().resolves(),
|
|
212
|
-
verifyTargetStub: stub().resolves(),
|
|
213
|
-
verifyVsceAuthStub: stub().resolves(),
|
|
214
|
-
verifyOvsxAuthStub: stub().resolves(),
|
|
215
|
-
utilsStub: {
|
|
216
|
-
isVscePublishEnabled: stub().returns(false),
|
|
217
|
-
isOvsxPublishEnabled: stub().returns(true),
|
|
218
|
-
},
|
|
219
|
-
logger: {
|
|
220
|
-
log: fake(),
|
|
221
|
-
},
|
|
222
|
-
};
|
|
223
|
-
const { verify } = await esmock('../lib/verify.js', {
|
|
224
|
-
'../lib/verify-pkg.js': {
|
|
225
|
-
verifyPkg: stubs.verifyPkgStub,
|
|
226
|
-
},
|
|
227
|
-
'../lib/verify-target.js': {
|
|
228
|
-
verifyTarget: stubs.verifyTargetStub,
|
|
229
|
-
},
|
|
230
|
-
'../lib/verify-vsce-auth.js': {
|
|
231
|
-
verifyVsceAuth: stubs.verifyVsceAuthStub,
|
|
232
|
-
},
|
|
233
|
-
'../lib/verify-ovsx-auth.js': {
|
|
234
|
-
verifyOvsxAuth: stubs.verifyOvsxAuthStub,
|
|
235
|
-
},
|
|
236
|
-
'../lib/utils.js': stubs.utilsStub,
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
await verify({}, { logger: stubs.logger, cwd });
|
|
240
|
-
t.true(stubs.verifyVsceAuthStub.notCalled);
|
|
241
|
-
t.true(stubs.verifyOvsxAuthStub.calledOnce);
|
|
242
|
-
t.true(stubs.logger.log.calledOnce);
|
|
243
|
-
});
|