@theia/plugin-utils 1.77.0-next.99 → 1.78.0-next.0
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/lib/common/constants.js +12 -15
- package/lib/common/constants.js.map +1 -1
- package/lib/common/constants.spec.js +7 -9
- package/lib/common/constants.spec.js.map +1 -1
- package/lib/common/contribution-types.d.ts +8 -3
- package/lib/common/contribution-types.d.ts.map +1 -1
- package/lib/common/contribution-types.js +5 -7
- package/lib/common/contribution-types.js.map +1 -1
- package/lib/common/manifest-types.d.ts +1 -1
- package/lib/common/manifest-types.d.ts.map +1 -1
- package/lib/common/manifest-types.js +7 -11
- package/lib/common/manifest-types.js.map +1 -1
- package/lib/common/manifest-types.spec.js +7 -9
- package/lib/common/manifest-types.spec.js.map +1 -1
- package/lib/common/package-nls.js +6 -11
- package/lib/common/package-nls.js.map +1 -1
- package/lib/common/package-nls.spec.js +23 -25
- package/lib/common/package-nls.spec.js.map +1 -1
- package/lib/common/plugin-activation-events.d.ts +1 -1
- package/lib/common/plugin-activation-events.d.ts.map +1 -1
- package/lib/common/plugin-activation-events.js +14 -17
- package/lib/common/plugin-activation-events.js.map +1 -1
- package/lib/common/plugin-activation-events.spec.js +14 -16
- package/lib/common/plugin-activation-events.spec.js.map +1 -1
- package/lib/common/plugin-manifest.d.ts +1 -1
- package/lib/common/plugin-manifest.d.ts.map +1 -1
- package/lib/common/plugin-manifest.js +8 -12
- package/lib/common/plugin-manifest.js.map +1 -1
- package/lib/common/plugin-manifest.spec.js +21 -23
- package/lib/common/plugin-manifest.spec.js.map +1 -1
- package/lib/common/plugin-model.d.ts +1 -1
- package/lib/common/plugin-model.d.ts.map +1 -1
- package/lib/common/plugin-model.js +23 -37
- package/lib/common/plugin-model.js.map +1 -1
- package/lib/common/plugin-model.spec.js +66 -69
- package/lib/common/plugin-model.spec.js.map +1 -1
- package/lib/common/protocol-shims.js +3 -6
- package/lib/common/protocol-shims.js.map +1 -1
- package/lib/common/test-helpers.d.ts +2 -2
- package/lib/common/test-helpers.d.ts.map +1 -1
- package/lib/common/test-helpers.js +5 -9
- package/lib/common/test-helpers.js.map +1 -1
- package/lib/common/utils.js +6 -14
- package/lib/common/utils.js.map +1 -1
- package/lib/common/utils.spec.js +25 -27
- package/lib/common/utils.spec.js.map +1 -1
- package/lib/node/normalize-contributions.d.ts +3 -3
- package/lib/node/normalize-contributions.d.ts.map +1 -1
- package/lib/node/normalize-contributions.js +95 -129
- package/lib/node/normalize-contributions.js.map +1 -1
- package/lib/node/normalize-contributions.spec.js +184 -162
- package/lib/node/normalize-contributions.spec.js.map +1 -1
- package/lib/node/package-nls.d.ts +1 -1
- package/lib/node/package-nls.d.ts.map +1 -1
- package/lib/node/package-nls.js +9 -12
- package/lib/node/package-nls.js.map +1 -1
- package/lib/node/plugin-manifest.d.ts +2 -2
- package/lib/node/plugin-manifest.d.ts.map +1 -1
- package/lib/node/plugin-manifest.js +6 -9
- package/lib/node/plugin-manifest.js.map +1 -1
- package/lib/node/plugin-model.d.ts +1 -1
- package/lib/node/plugin-model.d.ts.map +1 -1
- package/lib/node/plugin-model.js +5 -8
- package/lib/node/plugin-model.js.map +1 -1
- package/lib/node/read-grammars.d.ts +2 -2
- package/lib/node/read-grammars.d.ts.map +1 -1
- package/lib/node/read-grammars.js +8 -12
- package/lib/node/read-grammars.js.map +1 -1
- package/lib/node/read-grammars.spec.js +25 -27
- package/lib/node/read-grammars.spec.js.map +1 -1
- package/package.json +11 -3
- package/src/common/constants.spec.ts +1 -1
- package/src/common/contribution-types.ts +9 -3
- package/src/common/manifest-types.spec.ts +1 -1
- package/src/common/manifest-types.ts +2 -2
- package/src/common/package-nls.spec.ts +4 -3
- package/src/common/package-nls.ts +1 -1
- package/src/common/plugin-activation-events.spec.ts +2 -2
- package/src/common/plugin-activation-events.ts +2 -2
- package/src/common/plugin-manifest.spec.ts +6 -5
- package/src/common/plugin-manifest.ts +3 -3
- package/src/common/plugin-model.spec.ts +4 -4
- package/src/common/plugin-model.ts +2 -2
- package/src/common/test-helpers.ts +3 -3
- package/src/common/utils.spec.ts +2 -2
- package/src/node/normalize-contributions.spec.ts +37 -7
- package/src/node/normalize-contributions.ts +15 -7
- package/src/node/package-nls.ts +4 -3
- package/src/node/plugin-manifest.ts +4 -3
- package/src/node/plugin-model.ts +1 -1
- package/src/node/read-grammars.spec.ts +3 -2
- package/src/node/read-grammars.ts +5 -4
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// *****************************************************************************
|
|
3
2
|
// Copyright (C) 2026 Maksim Kachurin and others.
|
|
4
3
|
//
|
|
@@ -14,39 +13,38 @@
|
|
|
14
13
|
//
|
|
15
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
15
|
// *****************************************************************************
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const test_helpers_1 = require("../common/test-helpers");
|
|
16
|
+
import { expect } from 'chai';
|
|
17
|
+
import { CustomEditorPriority } from '../common/contribution-types.js';
|
|
18
|
+
import { PreferenceScope } from '../common/protocol-shims.js';
|
|
19
|
+
import { deriveDefaultForType, extractPluginViewsIds, getScope, normalizeContributions, readColors, readCommand, readConfiguration, readCustomEditors, readDebuggers, readIconThemes, readIcons, readKeybinding, readLanguages, readLocalization, readLocalizations, readMenus, readSnippets, readSubmenus, readTaskDefinition, readTerminals, readThemes, readViews, readViewsContainers, readViewContainer, readViewWelcome, readViewsWelcome, readWalkthroughs, toSchema, transformIconUrl } from './normalize-contributions.js';
|
|
20
|
+
import { createNormalizeCtx, manifest } from '../common/test-helpers.js';
|
|
23
21
|
describe('normalize-contributions', () => {
|
|
24
22
|
describe('deriveDefaultForType', () => {
|
|
25
23
|
it('mirrors VS Code defaults for each json type', () => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
expect(deriveDefaultForType('boolean')).to.equal(false);
|
|
25
|
+
expect(deriveDefaultForType('integer')).to.equal(0);
|
|
26
|
+
expect(deriveDefaultForType('number')).to.equal(0);
|
|
27
|
+
expect(deriveDefaultForType('string')).to.equal('');
|
|
28
|
+
expect(deriveDefaultForType('array')).to.deep.equal([]);
|
|
29
|
+
expect(deriveDefaultForType('object')).to.deep.equal({});
|
|
32
30
|
// eslint-disable-next-line no-null/no-null
|
|
33
|
-
|
|
31
|
+
expect(deriveDefaultForType(undefined)).to.equal(null);
|
|
34
32
|
});
|
|
35
33
|
it('uses the first type when an array is provided', () => {
|
|
36
|
-
|
|
34
|
+
expect(deriveDefaultForType(['string', 'number'])).to.equal('');
|
|
37
35
|
});
|
|
38
36
|
});
|
|
39
37
|
describe('getScope', () => {
|
|
40
38
|
it('maps monaco scopes to preference scope and overridable flag', () => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
expect(getScope('machine-overridable')).to.deep.equal({ scope: PreferenceScope.Folder, overridable: false });
|
|
40
|
+
expect(getScope('language-overridable')).to.deep.equal({ scope: PreferenceScope.Folder, overridable: true });
|
|
41
|
+
expect(getScope('application')).to.deep.equal({ scope: PreferenceScope.User, overridable: false });
|
|
42
|
+
expect(getScope(undefined)).to.deep.equal({ scope: undefined, overridable: false });
|
|
45
43
|
});
|
|
46
44
|
});
|
|
47
45
|
describe('readConfiguration', () => {
|
|
48
46
|
it('derives defaults and property scopes', () => {
|
|
49
|
-
const schema =
|
|
47
|
+
const schema = readConfiguration({
|
|
50
48
|
title: 'Sample',
|
|
51
49
|
scope: 'application',
|
|
52
50
|
properties: {
|
|
@@ -54,20 +52,20 @@ describe('normalize-contributions', () => {
|
|
|
54
52
|
'sample.path': { type: 'string', default: '/tmp' }
|
|
55
53
|
}
|
|
56
54
|
}, '/tmp/plugin');
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
expect(schema?.scope).to.equal(PreferenceScope.User);
|
|
56
|
+
expect(schema?.properties['sample.enabled'].default).to.equal(false);
|
|
57
|
+
expect(schema?.properties['sample.enabled'].overridable).to.equal(true);
|
|
58
|
+
expect(schema?.properties['sample.path'].default).to.equal('/tmp');
|
|
61
59
|
});
|
|
62
60
|
});
|
|
63
61
|
describe('transformIconUrl and readCommand', () => {
|
|
64
62
|
it('resolves file icons and codicons', () => {
|
|
65
|
-
const ctx =
|
|
66
|
-
|
|
63
|
+
const ctx = createNormalizeCtx();
|
|
64
|
+
expect(transformIconUrl(ctx, ctx.plugin, './media/icon.png')).to.deep.equal({
|
|
67
65
|
iconUrl: 'hostedPlugin/acme_test_ext/media/icon.png'
|
|
68
66
|
});
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
expect(transformIconUrl(ctx, ctx.plugin, '$(zap)')).to.deep.equal({ themeIcon: '$(zap)' });
|
|
68
|
+
expect(transformIconUrl(ctx, ctx.plugin, {
|
|
71
69
|
light: './light.png',
|
|
72
70
|
dark: './dark.png'
|
|
73
71
|
})).to.deep.equal({
|
|
@@ -76,13 +74,13 @@ describe('normalize-contributions', () => {
|
|
|
76
74
|
dark: 'hostedPlugin/acme_test_ext/dark.png'
|
|
77
75
|
}
|
|
78
76
|
});
|
|
79
|
-
const command =
|
|
77
|
+
const command = readCommand(ctx, {
|
|
80
78
|
command: 'sample.run',
|
|
81
79
|
title: 'Run',
|
|
82
80
|
original: 'Original',
|
|
83
81
|
icon: '$(play)'
|
|
84
82
|
}, ctx.plugin);
|
|
85
|
-
|
|
83
|
+
expect(command).to.include({
|
|
86
84
|
command: 'sample.run',
|
|
87
85
|
title: 'Run',
|
|
88
86
|
originalTitle: 'Original',
|
|
@@ -90,14 +88,14 @@ describe('normalize-contributions', () => {
|
|
|
90
88
|
});
|
|
91
89
|
});
|
|
92
90
|
it('honors ctx.transformIconUrl from readCommand / readSubmenu', () => {
|
|
93
|
-
const ctx =
|
|
91
|
+
const ctx = createNormalizeCtx();
|
|
94
92
|
ctx.transformIconUrl = () => ({ themeIcon: '$(custom)' });
|
|
95
|
-
|
|
93
|
+
expect(readCommand(ctx, {
|
|
96
94
|
command: 'sample.run',
|
|
97
95
|
title: 'Run',
|
|
98
96
|
icon: '$(play)'
|
|
99
97
|
}, ctx.plugin).themeIcon).to.equal('$(custom)');
|
|
100
|
-
|
|
98
|
+
expect(readSubmenus(ctx, [{
|
|
101
99
|
id: 'sample.submenu',
|
|
102
100
|
label: 'Sample',
|
|
103
101
|
icon: './icon.png'
|
|
@@ -106,7 +104,7 @@ describe('normalize-contributions', () => {
|
|
|
106
104
|
});
|
|
107
105
|
describe('readKeybinding and menus', () => {
|
|
108
106
|
it('copies keybinding fields', () => {
|
|
109
|
-
|
|
107
|
+
expect(readKeybinding({
|
|
110
108
|
key: 'ctrl+shift+p',
|
|
111
109
|
command: 'sample.run',
|
|
112
110
|
when: 'editorFocus',
|
|
@@ -122,7 +120,7 @@ describe('normalize-contributions', () => {
|
|
|
122
120
|
});
|
|
123
121
|
});
|
|
124
122
|
it('copies menu fields', () => {
|
|
125
|
-
|
|
123
|
+
expect(readMenus([{
|
|
126
124
|
command: 'sample.run',
|
|
127
125
|
group: 'navigation',
|
|
128
126
|
when: 'true'
|
|
@@ -137,53 +135,62 @@ describe('normalize-contributions', () => {
|
|
|
137
135
|
});
|
|
138
136
|
describe('views', () => {
|
|
139
137
|
it('extracts view ids across locations', () => {
|
|
140
|
-
|
|
138
|
+
expect(extractPluginViewsIds({
|
|
141
139
|
explorer: [{ id: 'a', name: 'A' }],
|
|
142
140
|
panel: [{ id: 'b', name: 'B' }]
|
|
143
141
|
})).to.deep.equal(['a', 'b']);
|
|
144
142
|
});
|
|
145
143
|
it('normalizes view containers, views, and welcome content order', () => {
|
|
146
|
-
const ctx =
|
|
147
|
-
const containers =
|
|
144
|
+
const ctx = createNormalizeCtx();
|
|
145
|
+
const containers = readViewsContainers(ctx, [{
|
|
148
146
|
id: 'sample.container',
|
|
149
147
|
title: 'Sample',
|
|
150
148
|
icon: '$(folder)'
|
|
151
149
|
}], ctx.plugin);
|
|
152
|
-
|
|
150
|
+
expect(containers[0]).to.include({
|
|
153
151
|
id: 'sample.container',
|
|
154
152
|
themeIcon: '$(folder)'
|
|
155
153
|
});
|
|
156
|
-
|
|
157
|
-
const views =
|
|
158
|
-
|
|
154
|
+
expect(containers[0].iconUrl).to.equal('hostedPlugin/acme_test_ext/%24(folder)');
|
|
155
|
+
const views = readViews([{ id: 'sample.view', name: 'Sample View' }]);
|
|
156
|
+
expect(views).to.deep.equal([{
|
|
159
157
|
id: 'sample.view',
|
|
160
158
|
name: 'Sample View',
|
|
161
159
|
when: undefined,
|
|
162
|
-
type: undefined
|
|
160
|
+
type: undefined,
|
|
161
|
+
visibility: undefined,
|
|
162
|
+
initialSize: undefined
|
|
163
163
|
}]);
|
|
164
|
-
const welcome =
|
|
164
|
+
const welcome = readViewsWelcome([{
|
|
165
165
|
view: 'sample.view',
|
|
166
166
|
contents: 'Welcome'
|
|
167
167
|
}], { explorer: [{ id: 'sample.view', name: 'Sample View' }] });
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
expect(welcome[0].order).to.equal(0);
|
|
169
|
+
expect(readViewWelcome({
|
|
170
170
|
view: 'missing.view',
|
|
171
171
|
contents: 'Missing'
|
|
172
172
|
}, ['sample.view']).order).to.equal(1);
|
|
173
173
|
});
|
|
174
|
+
it('keeps the initial visibility and size a view declares, and drops values of the wrong kind', () => {
|
|
175
|
+
const rawView = { id: 'sample.view', name: 'Sample View', visibility: 'collapsed', initialSize: 3 };
|
|
176
|
+
const malformedView = { id: 'malformed.view', name: 'Malformed View', visibility: 'shown', initialSize: Infinity };
|
|
177
|
+
const [view, malformed] = readViews([rawView, malformedView]);
|
|
178
|
+
expect(view).to.include({ visibility: 'collapsed', initialSize: 3 });
|
|
179
|
+
expect(malformed).to.include({ visibility: undefined, initialSize: undefined });
|
|
180
|
+
});
|
|
174
181
|
it('skips view containers without a string icon and reports an error', () => {
|
|
175
182
|
const errors = [];
|
|
176
|
-
const ctx =
|
|
183
|
+
const ctx = createNormalizeCtx({}, {
|
|
177
184
|
onError: (_kind, message) => {
|
|
178
185
|
errors.push(message);
|
|
179
186
|
}
|
|
180
187
|
});
|
|
181
|
-
|
|
188
|
+
expect(readViewContainer(ctx, {
|
|
182
189
|
id: 'sample.container',
|
|
183
190
|
title: 'Sample'
|
|
184
191
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
185
192
|
}, ctx.plugin)).to.equal(undefined);
|
|
186
|
-
|
|
193
|
+
expect(readViewsContainers(ctx, [{
|
|
187
194
|
id: 'valid.container',
|
|
188
195
|
title: 'Valid',
|
|
189
196
|
icon: '$(folder)'
|
|
@@ -192,23 +199,23 @@ describe('normalize-contributions', () => {
|
|
|
192
199
|
title: 'Invalid'
|
|
193
200
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
194
201
|
}], ctx.plugin)).to.have.lengthOf(1);
|
|
195
|
-
|
|
202
|
+
expect(errors.length).to.be.greaterThan(0);
|
|
196
203
|
});
|
|
197
204
|
});
|
|
198
205
|
describe('custom editors and debuggers', () => {
|
|
199
206
|
it('normalizes custom editors with default priority', () => {
|
|
200
|
-
|
|
207
|
+
expect(readCustomEditors([{
|
|
201
208
|
viewType: 'sample.editor',
|
|
202
209
|
displayName: 'Editor'
|
|
203
210
|
}])).to.deep.equal([{
|
|
204
211
|
viewType: 'sample.editor',
|
|
205
212
|
displayName: 'Editor',
|
|
206
213
|
selector: [],
|
|
207
|
-
priority:
|
|
214
|
+
priority: CustomEditorPriority.default
|
|
208
215
|
}]);
|
|
209
216
|
});
|
|
210
217
|
it('copies debugger contributions', () => {
|
|
211
|
-
|
|
218
|
+
expect(readDebuggers([{
|
|
212
219
|
type: 'node',
|
|
213
220
|
label: 'Node Debug',
|
|
214
221
|
program: './out/debug.js',
|
|
@@ -237,8 +244,8 @@ describe('normalize-contributions', () => {
|
|
|
237
244
|
});
|
|
238
245
|
describe('themes, snippets, icon themes, and colors', () => {
|
|
239
246
|
it('resolves theme and snippet uris', () => {
|
|
240
|
-
const ctx =
|
|
241
|
-
const plugin =
|
|
247
|
+
const ctx = createNormalizeCtx(undefined, undefined);
|
|
248
|
+
const plugin = manifest({
|
|
242
249
|
name: 'themes',
|
|
243
250
|
contributes: {
|
|
244
251
|
themes: [{ id: 'dark', label: 'Dark', path: './themes/dark.json' }],
|
|
@@ -247,19 +254,19 @@ describe('normalize-contributions', () => {
|
|
|
247
254
|
}
|
|
248
255
|
});
|
|
249
256
|
ctx.plugin = plugin;
|
|
250
|
-
|
|
257
|
+
expect(readThemes(ctx, plugin)).to.deep.equal([{
|
|
251
258
|
id: 'dark',
|
|
252
259
|
label: 'Dark',
|
|
253
260
|
uri: 'hostedPlugin/acme_themes/themes/dark.json',
|
|
254
261
|
description: undefined,
|
|
255
262
|
uiTheme: undefined
|
|
256
263
|
}]);
|
|
257
|
-
|
|
264
|
+
expect(readSnippets(ctx, plugin)).to.deep.equal([{
|
|
258
265
|
language: 'typescript',
|
|
259
266
|
source: 'Test Extension',
|
|
260
267
|
uri: 'hostedPlugin/acme_themes/snippets/ts.json'
|
|
261
268
|
}]);
|
|
262
|
-
|
|
269
|
+
expect(readIconThemes(ctx, plugin)).to.deep.equal([{
|
|
263
270
|
id: 'set',
|
|
264
271
|
label: 'Set',
|
|
265
272
|
uri: 'hostedPlugin/acme_themes/icons/theme.json',
|
|
@@ -270,8 +277,8 @@ describe('normalize-contributions', () => {
|
|
|
270
277
|
// A `uiTheme` that does not survive normalization falls back to `vs-dark` in the frontend, which
|
|
271
278
|
// files the theme under the dark ones and resolves its colors through the dark path.
|
|
272
279
|
it('keeps every ui theme, including hc-light', () => {
|
|
273
|
-
const ctx =
|
|
274
|
-
const plugin =
|
|
280
|
+
const ctx = createNormalizeCtx(undefined, undefined);
|
|
281
|
+
const plugin = manifest({
|
|
275
282
|
name: 'themes',
|
|
276
283
|
contributes: {
|
|
277
284
|
themes: [
|
|
@@ -285,17 +292,17 @@ describe('normalize-contributions', () => {
|
|
|
285
292
|
}
|
|
286
293
|
});
|
|
287
294
|
ctx.plugin = plugin;
|
|
288
|
-
|
|
295
|
+
expect(readThemes(ctx, plugin)?.map(theme => theme.uiTheme))
|
|
289
296
|
.to.deep.equal(['vs', 'vs-dark', 'hc-black', 'hc-light', undefined]);
|
|
290
297
|
});
|
|
291
298
|
it('validates color contributions and reports invalid ids', () => {
|
|
292
299
|
const warnings = [];
|
|
293
|
-
const ctx =
|
|
300
|
+
const ctx = createNormalizeCtx({ name: 'colors' }, {
|
|
294
301
|
onWarn: message => {
|
|
295
302
|
warnings.push(message);
|
|
296
303
|
}
|
|
297
304
|
});
|
|
298
|
-
const plugin =
|
|
305
|
+
const plugin = manifest({
|
|
299
306
|
name: 'colors',
|
|
300
307
|
contributes: {
|
|
301
308
|
colors: [
|
|
@@ -309,19 +316,19 @@ describe('normalize-contributions', () => {
|
|
|
309
316
|
}
|
|
310
317
|
});
|
|
311
318
|
ctx.plugin = plugin;
|
|
312
|
-
const colors =
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
319
|
+
const colors = readColors(ctx, plugin);
|
|
320
|
+
expect(colors).to.have.lengthOf(1);
|
|
321
|
+
expect(colors[0].defaults).to.deep.equal({ light: '#fff', dark: '#000', hc: '#111' });
|
|
322
|
+
expect(warnings.some(message => message.includes('word[.word]*'))).to.equal(true);
|
|
316
323
|
});
|
|
317
324
|
it('rejects color contributions with empty descriptions', () => {
|
|
318
325
|
const warnings = [];
|
|
319
|
-
const ctx =
|
|
326
|
+
const ctx = createNormalizeCtx({ name: 'colors' }, {
|
|
320
327
|
onWarn: message => {
|
|
321
328
|
warnings.push(message);
|
|
322
329
|
}
|
|
323
330
|
});
|
|
324
|
-
const plugin =
|
|
331
|
+
const plugin = manifest({
|
|
325
332
|
name: 'colors',
|
|
326
333
|
contributes: {
|
|
327
334
|
colors: [{
|
|
@@ -332,14 +339,14 @@ describe('normalize-contributions', () => {
|
|
|
332
339
|
}
|
|
333
340
|
});
|
|
334
341
|
ctx.plugin = plugin;
|
|
335
|
-
|
|
336
|
-
|
|
342
|
+
expect(readColors(ctx, plugin)).to.deep.equal([]);
|
|
343
|
+
expect(warnings.some(message => message.includes('description'))).to.equal(true);
|
|
337
344
|
});
|
|
338
345
|
});
|
|
339
346
|
describe('icons', () => {
|
|
340
347
|
it('accepts icon references and font-based defaults', () => {
|
|
341
|
-
const ctx =
|
|
342
|
-
const plugin =
|
|
348
|
+
const ctx = createNormalizeCtx({ name: 'icons', publisher: 'acme' });
|
|
349
|
+
const plugin = manifest({
|
|
343
350
|
name: 'icons',
|
|
344
351
|
publisher: 'acme',
|
|
345
352
|
contributes: {
|
|
@@ -359,8 +366,8 @@ describe('normalize-contributions', () => {
|
|
|
359
366
|
}
|
|
360
367
|
});
|
|
361
368
|
ctx.plugin = plugin;
|
|
362
|
-
const icons =
|
|
363
|
-
|
|
369
|
+
const icons = readIcons(ctx, plugin);
|
|
370
|
+
expect(icons).to.deep.equal([
|
|
364
371
|
{
|
|
365
372
|
id: 'sample-icon',
|
|
366
373
|
extensionId: 'acme.icons',
|
|
@@ -381,7 +388,7 @@ describe('normalize-contributions', () => {
|
|
|
381
388
|
});
|
|
382
389
|
describe('terminals, localizations, submenus, and tasks', () => {
|
|
383
390
|
it('reads terminal profiles with required fields only', () => {
|
|
384
|
-
const plugin =
|
|
391
|
+
const plugin = manifest({
|
|
385
392
|
name: 'terminal',
|
|
386
393
|
contributes: {
|
|
387
394
|
terminal: {
|
|
@@ -394,11 +401,11 @@ describe('normalize-contributions', () => {
|
|
|
394
401
|
}
|
|
395
402
|
}
|
|
396
403
|
});
|
|
397
|
-
|
|
404
|
+
expect(readTerminals(plugin)).to.deep.equal([{ id: 'bash', title: 'Bash' }]);
|
|
398
405
|
});
|
|
399
406
|
it('drops empty theme/snippet paths (avoids resolving to the plugin root)', () => {
|
|
400
|
-
const ctx =
|
|
401
|
-
const plugin =
|
|
407
|
+
const ctx = createNormalizeCtx(undefined, undefined);
|
|
408
|
+
const plugin = manifest({
|
|
402
409
|
name: 'empty-paths',
|
|
403
410
|
contributes: {
|
|
404
411
|
themes: [{ id: 'bad', path: '' }],
|
|
@@ -407,12 +414,12 @@ describe('normalize-contributions', () => {
|
|
|
407
414
|
}
|
|
408
415
|
});
|
|
409
416
|
ctx.plugin = plugin;
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
417
|
+
expect(readThemes(ctx, plugin)).to.deep.equal([]);
|
|
418
|
+
expect(readSnippets(ctx, plugin)).to.deep.equal([]);
|
|
419
|
+
expect(readIconThemes(ctx, plugin)).to.deep.equal([]);
|
|
413
420
|
});
|
|
414
421
|
it('reads localization bundles', () => {
|
|
415
|
-
const plugin =
|
|
422
|
+
const plugin = manifest({
|
|
416
423
|
name: 'l10n',
|
|
417
424
|
packagePath: '/tmp/plugin',
|
|
418
425
|
contributes: {
|
|
@@ -423,7 +430,7 @@ describe('normalize-contributions', () => {
|
|
|
423
430
|
}]
|
|
424
431
|
}
|
|
425
432
|
});
|
|
426
|
-
|
|
433
|
+
expect(readLocalizations(plugin)).to.deep.equal([{
|
|
427
434
|
languageId: 'de',
|
|
428
435
|
languageName: 'German',
|
|
429
436
|
localizedLanguageName: undefined,
|
|
@@ -432,7 +439,7 @@ describe('normalize-contributions', () => {
|
|
|
432
439
|
}]);
|
|
433
440
|
});
|
|
434
441
|
it('honors readLocalization / readTranslation ctx hooks', () => {
|
|
435
|
-
const plugin =
|
|
442
|
+
const plugin = manifest({
|
|
436
443
|
name: 'l10n',
|
|
437
444
|
packagePath: '/tmp/plugin',
|
|
438
445
|
contributes: {
|
|
@@ -442,13 +449,13 @@ describe('normalize-contributions', () => {
|
|
|
442
449
|
}]
|
|
443
450
|
}
|
|
444
451
|
});
|
|
445
|
-
const ctx =
|
|
452
|
+
const ctx = createNormalizeCtx({ name: 'l10n', packagePath: '/tmp/plugin' });
|
|
446
453
|
ctx.readTranslation = (entry, pluginPath) => ({
|
|
447
454
|
id: entry.id,
|
|
448
455
|
path: `${pluginPath}/${entry.path}`
|
|
449
456
|
});
|
|
450
|
-
ctx.readLocalization = (entry, pluginPath) =>
|
|
451
|
-
|
|
457
|
+
ctx.readLocalization = (entry, pluginPath) => readLocalization(entry, pluginPath, ctx);
|
|
458
|
+
expect(readLocalizations(plugin, ctx)).to.deep.equal([{
|
|
452
459
|
languageId: 'de',
|
|
453
460
|
languageName: undefined,
|
|
454
461
|
localizedLanguageName: undefined,
|
|
@@ -457,8 +464,8 @@ describe('normalize-contributions', () => {
|
|
|
457
464
|
}]);
|
|
458
465
|
});
|
|
459
466
|
it('reads submenu icons via transformIconUrl', () => {
|
|
460
|
-
const ctx =
|
|
461
|
-
|
|
467
|
+
const ctx = createNormalizeCtx();
|
|
468
|
+
expect(readSubmenus(ctx, [{
|
|
462
469
|
id: 'sample.submenu',
|
|
463
470
|
label: 'Sample',
|
|
464
471
|
icon: '$(gear)'
|
|
@@ -469,17 +476,17 @@ describe('normalize-contributions', () => {
|
|
|
469
476
|
}]);
|
|
470
477
|
});
|
|
471
478
|
it('builds task definition schema with required type property', () => {
|
|
472
|
-
const definition =
|
|
479
|
+
const definition = readTaskDefinition('sample.tasks', {
|
|
473
480
|
type: 'npm',
|
|
474
481
|
required: ['script'],
|
|
475
482
|
properties: {
|
|
476
483
|
script: { type: 'string' }
|
|
477
484
|
}
|
|
478
485
|
});
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
486
|
+
expect(definition.taskType).to.equal('npm');
|
|
487
|
+
expect(definition.source).to.equal('sample.tasks');
|
|
488
|
+
expect(definition.properties.all).to.deep.equal(['script']);
|
|
489
|
+
expect(toSchema({
|
|
483
490
|
type: 'npm',
|
|
484
491
|
required: [],
|
|
485
492
|
properties: { script: { type: 'string' } }
|
|
@@ -487,42 +494,42 @@ describe('normalize-contributions', () => {
|
|
|
487
494
|
});
|
|
488
495
|
it('honors ctx.toSchema from readTaskDefinition', () => {
|
|
489
496
|
const customSchema = { type: 'object', properties: { custom: { type: 'boolean' } } };
|
|
490
|
-
const definition =
|
|
497
|
+
const definition = readTaskDefinition('sample.tasks', {
|
|
491
498
|
type: 'npm',
|
|
492
499
|
required: [],
|
|
493
500
|
properties: {}
|
|
494
501
|
}, {
|
|
495
502
|
toSchema: () => customSchema
|
|
496
503
|
});
|
|
497
|
-
|
|
504
|
+
expect(definition.properties.schema).to.equal(customSchema);
|
|
498
505
|
});
|
|
499
506
|
});
|
|
500
507
|
describe('readLanguage', () => {
|
|
501
508
|
it('loads language configuration from a relative json file', async () => {
|
|
502
|
-
const ctx =
|
|
509
|
+
const ctx = createNormalizeCtx({ name: 'lang', packagePath: '/tmp/plugin' }, {
|
|
503
510
|
readJsonFile: async () => ({
|
|
504
511
|
autoClosingPairs: [['{', '}'], { open: '[', close: ']', notIn: ['string'] }],
|
|
505
512
|
surroundingPairs: [['(', ')']]
|
|
506
513
|
})
|
|
507
514
|
});
|
|
508
|
-
const languages = await
|
|
515
|
+
const languages = await readLanguages(ctx, [{
|
|
509
516
|
id: 'sample',
|
|
510
517
|
configuration: './language-configuration.json'
|
|
511
518
|
}], ctx.plugin);
|
|
512
|
-
|
|
519
|
+
expect(languages[0].configuration?.autoClosingPairs).to.deep.equal([
|
|
513
520
|
{ open: '{', close: '}' },
|
|
514
521
|
{ open: '[', close: ']', notIn: ['string'] }
|
|
515
522
|
]);
|
|
516
|
-
|
|
523
|
+
expect(languages[0].configuration?.surroundingPairs).to.deep.equal([{ open: '(', close: ')' }]);
|
|
517
524
|
});
|
|
518
525
|
});
|
|
519
526
|
describe('normalizeContributions', () => {
|
|
520
527
|
it('leaves output empty when the manifest has no contribution kinds', async () => {
|
|
521
|
-
const contributions = await
|
|
522
|
-
|
|
528
|
+
const contributions = await normalizeContributions(createNormalizeCtx({ name: 'empty' }), {});
|
|
529
|
+
expect(Object.keys(contributions)).to.deep.equal([]);
|
|
523
530
|
});
|
|
524
531
|
it('normalizes supported contribution kinds via injectable readers', async () => {
|
|
525
|
-
const ctx =
|
|
532
|
+
const ctx = createNormalizeCtx({
|
|
526
533
|
name: 'full',
|
|
527
534
|
contributes: {
|
|
528
535
|
commands: [{ command: 'sample.run', title: 'Run' }],
|
|
@@ -530,10 +537,10 @@ describe('normalize-contributions', () => {
|
|
|
530
537
|
configuration: { title: 'Sample', properties: { enabled: { type: 'boolean' } } }
|
|
531
538
|
}
|
|
532
539
|
});
|
|
533
|
-
const contributions = await
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
540
|
+
const contributions = await normalizeContributions(ctx, {});
|
|
541
|
+
expect(contributions).to.have.property('commands').with.lengthOf(1);
|
|
542
|
+
expect(contributions).to.have.property('keybindings').with.lengthOf(1);
|
|
543
|
+
expect(contributions).to.have.property('configuration').with.lengthOf(1);
|
|
537
544
|
});
|
|
538
545
|
it('runs the orchestrator for shell layout, passthrough, and async contribution kinds', async () => {
|
|
539
546
|
const readGrammars = async () => [{
|
|
@@ -543,7 +550,7 @@ describe('normalize-contributions', () => {
|
|
|
543
550
|
grammar: { scopeName: 'source.sample' },
|
|
544
551
|
grammarLocation: './grammar.json'
|
|
545
552
|
}];
|
|
546
|
-
const ctx =
|
|
553
|
+
const ctx = createNormalizeCtx({
|
|
547
554
|
name: 'orchestrator',
|
|
548
555
|
displayName: 'Orchestrator Extension',
|
|
549
556
|
contributes: {
|
|
@@ -604,24 +611,24 @@ describe('normalize-contributions', () => {
|
|
|
604
611
|
grammars: [{ language: 'sample-lang', scopeName: 'source.sample', path: './grammar.json' }]
|
|
605
612
|
}
|
|
606
613
|
}, { readGrammars });
|
|
607
|
-
const contributions = await
|
|
608
|
-
|
|
614
|
+
const contributions = await normalizeContributions(ctx, {});
|
|
615
|
+
expect(contributions.configurationDefaults).to.deep.equal({ 'sample.enabled': true });
|
|
609
616
|
const configuration = contributions.configuration;
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
617
|
+
expect(configuration).to.have.lengthOf(2);
|
|
618
|
+
expect(configuration[0].properties['sample.enabled'].owner).to.equal('Orchestrator Extension');
|
|
619
|
+
expect(configuration[0].properties['sample.enabled'].group).to.equal('General');
|
|
620
|
+
expect(contributions.submenus).to.deep.equal([{
|
|
614
621
|
icon: '$(gear)',
|
|
615
622
|
id: 'sample.submenu',
|
|
616
623
|
label: 'Sample'
|
|
617
624
|
}]);
|
|
618
|
-
|
|
625
|
+
expect(contributions.customEditors).to.deep.equal([{
|
|
619
626
|
viewType: 'sample.editor',
|
|
620
627
|
displayName: 'Editor',
|
|
621
628
|
selector: [],
|
|
622
|
-
priority:
|
|
629
|
+
priority: CustomEditorPriority.default
|
|
623
630
|
}]);
|
|
624
|
-
|
|
631
|
+
expect(contributions.viewsContainers).to.deep.equal({
|
|
625
632
|
left: [{
|
|
626
633
|
id: 'sample.container',
|
|
627
634
|
title: 'Sample',
|
|
@@ -637,20 +644,20 @@ describe('normalize-contributions', () => {
|
|
|
637
644
|
when: undefined
|
|
638
645
|
}]
|
|
639
646
|
});
|
|
640
|
-
|
|
641
|
-
explorer: [{ id: 'sample.view', name: 'Sample View', when: undefined, type: undefined }]
|
|
647
|
+
expect(contributions.views).to.deep.equal({
|
|
648
|
+
explorer: [{ id: 'sample.view', name: 'Sample View', when: undefined, type: undefined, visibility: undefined, initialSize: undefined }]
|
|
642
649
|
});
|
|
643
|
-
|
|
650
|
+
expect(contributions.viewsWelcome).to.deep.equal([{
|
|
644
651
|
view: 'sample.view',
|
|
645
652
|
content: 'Welcome',
|
|
646
653
|
when: undefined,
|
|
647
654
|
enablement: undefined,
|
|
648
655
|
order: 0
|
|
649
656
|
}]);
|
|
650
|
-
|
|
657
|
+
expect(contributions.menus).to.deep.equal({
|
|
651
658
|
'editor/title': [{ command: 'sample.run', group: 'navigation', submenu: undefined, alt: undefined, when: undefined }]
|
|
652
659
|
});
|
|
653
|
-
|
|
660
|
+
expect(contributions.debuggers).to.deep.equal([{
|
|
654
661
|
type: 'node',
|
|
655
662
|
label: 'Node Debug',
|
|
656
663
|
program: './debug.js',
|
|
@@ -669,7 +676,7 @@ describe('normalize-contributions', () => {
|
|
|
669
676
|
runtimeArgs: undefined,
|
|
670
677
|
configurationAttributes: undefined
|
|
671
678
|
}]);
|
|
672
|
-
|
|
679
|
+
expect(contributions.taskDefinitions).to.deep.equal([{
|
|
673
680
|
taskType: 'npm',
|
|
674
681
|
source: 'orchestrator',
|
|
675
682
|
properties: {
|
|
@@ -685,52 +692,52 @@ describe('normalize-contributions', () => {
|
|
|
685
692
|
}
|
|
686
693
|
}
|
|
687
694
|
}]);
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
695
|
+
expect(contributions.problemMatchers).to.deep.equal([{ name: 'sample-matcher' }]);
|
|
696
|
+
expect(contributions.problemPatterns).to.deep.equal([{ regexp: 'sample' }]);
|
|
697
|
+
expect(contributions.resourceLabelFormatters).to.deep.equal([{ scheme: 'file' }]);
|
|
698
|
+
expect(contributions.authentication).to.deep.equal([{ id: 'github', label: 'GitHub' }]);
|
|
699
|
+
expect(contributions.notebooks).to.deep.equal([{ type: 'sample-notebook', displayName: 'Notebook' }]);
|
|
700
|
+
expect(contributions.notebookRenderer).to.deep.equal([{ id: 'sample-renderer', displayName: 'Renderer' }]);
|
|
701
|
+
expect(contributions.notebookPreload).to.deep.equal([{ type: 'sample-preload' }]);
|
|
702
|
+
expect(contributions.snippets).to.deep.equal([{
|
|
696
703
|
language: 'typescript',
|
|
697
704
|
source: 'Orchestrator Extension',
|
|
698
705
|
uri: 'hostedPlugin/acme_orchestrator/snippets/ts.json'
|
|
699
706
|
}]);
|
|
700
|
-
|
|
707
|
+
expect(contributions.themes).to.deep.equal([{
|
|
701
708
|
id: 'dark',
|
|
702
709
|
label: 'Dark',
|
|
703
710
|
uri: 'hostedPlugin/acme_orchestrator/themes/dark.json',
|
|
704
711
|
description: undefined,
|
|
705
712
|
uiTheme: undefined
|
|
706
713
|
}]);
|
|
707
|
-
|
|
714
|
+
expect(contributions.colors).to.deep.equal([{
|
|
708
715
|
id: 'sample.color',
|
|
709
716
|
description: 'Sample',
|
|
710
717
|
defaults: { light: '#fff', dark: '#000', hc: '#111' }
|
|
711
718
|
}]);
|
|
712
|
-
|
|
719
|
+
expect(contributions.iconThemes).to.deep.equal([{
|
|
713
720
|
id: 'sample-icons',
|
|
714
721
|
label: 'Icons',
|
|
715
722
|
uri: 'hostedPlugin/acme_orchestrator/icons/theme.json',
|
|
716
723
|
description: undefined,
|
|
717
724
|
uiTheme: undefined
|
|
718
725
|
}]);
|
|
719
|
-
|
|
726
|
+
expect(contributions.icons).to.deep.equal([{
|
|
720
727
|
id: 'sample-icon',
|
|
721
728
|
extensionId: 'acme.orchestrator',
|
|
722
729
|
description: 'Sample icon',
|
|
723
730
|
defaults: { id: 'other-icon' }
|
|
724
731
|
}]);
|
|
725
|
-
|
|
726
|
-
|
|
732
|
+
expect(contributions.terminalProfiles).to.deep.equal([{ id: 'bash', title: 'Bash' }]);
|
|
733
|
+
expect(contributions.localizations).to.deep.equal([{
|
|
727
734
|
languageId: 'de',
|
|
728
735
|
languageName: 'German',
|
|
729
736
|
localizedLanguageName: undefined,
|
|
730
737
|
minimalTranslations: undefined,
|
|
731
738
|
translations: [{ id: 'package', path: './package.nls.de.json' }]
|
|
732
739
|
}]);
|
|
733
|
-
|
|
740
|
+
expect(contributions.languages).to.deep.equal([{
|
|
734
741
|
id: 'sample-lang',
|
|
735
742
|
aliases: undefined,
|
|
736
743
|
extensions: ['.sample'],
|
|
@@ -740,7 +747,7 @@ describe('normalize-contributions', () => {
|
|
|
740
747
|
mimetypes: undefined,
|
|
741
748
|
icon: undefined
|
|
742
749
|
}]);
|
|
743
|
-
|
|
750
|
+
expect(contributions.grammars).to.deep.equal([{
|
|
744
751
|
language: 'sample-lang',
|
|
745
752
|
scope: 'source.sample',
|
|
746
753
|
format: 'json',
|
|
@@ -748,9 +755,24 @@ describe('normalize-contributions', () => {
|
|
|
748
755
|
grammarLocation: './grammar.json'
|
|
749
756
|
}]);
|
|
750
757
|
});
|
|
758
|
+
it('keeps the initial size of a view only in a view container the same plugin contributes', async () => {
|
|
759
|
+
const ctx = createNormalizeCtx({
|
|
760
|
+
name: 'sized',
|
|
761
|
+
contributes: {
|
|
762
|
+
viewsContainers: { activitybar: [{ id: 'own', title: 'Own', icon: '$(a)' }] },
|
|
763
|
+
views: {
|
|
764
|
+
own: [{ id: 'own.view', name: 'Own View', initialSize: 2 }],
|
|
765
|
+
explorer: [{ id: 'foreign.view', name: 'Foreign View', initialSize: 3 }]
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
});
|
|
769
|
+
const { views } = await normalizeContributions(ctx, {});
|
|
770
|
+
expect(views?.own[0].initialSize).to.equal(2);
|
|
771
|
+
expect(views?.explorer[0].initialSize).to.equal(undefined);
|
|
772
|
+
});
|
|
751
773
|
it('merges aliased view container locations and reports async reader failures', async () => {
|
|
752
774
|
const errors = [];
|
|
753
|
-
const ctx =
|
|
775
|
+
const ctx = createNormalizeCtx({
|
|
754
776
|
name: 'merge',
|
|
755
777
|
contributes: {
|
|
756
778
|
viewsContainers: {
|
|
@@ -771,8 +793,8 @@ describe('normalize-contributions', () => {
|
|
|
771
793
|
errors.push({ kind, message });
|
|
772
794
|
}
|
|
773
795
|
});
|
|
774
|
-
const contributions = await
|
|
775
|
-
|
|
796
|
+
const contributions = await normalizeContributions(ctx, {});
|
|
797
|
+
expect(contributions.viewsContainers).to.deep.equal({
|
|
776
798
|
left: [{
|
|
777
799
|
id: 'left-a',
|
|
778
800
|
title: 'A',
|
|
@@ -788,13 +810,13 @@ describe('normalize-contributions', () => {
|
|
|
788
810
|
when: undefined
|
|
789
811
|
}]
|
|
790
812
|
});
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
813
|
+
expect(contributions).to.not.have.property('languages');
|
|
814
|
+
expect(contributions).to.not.have.property('grammars');
|
|
815
|
+
expect(errors.map(error => error.kind)).to.include.members(['languages', 'grammars']);
|
|
794
816
|
});
|
|
795
817
|
it('continues after reader errors and reports them', async () => {
|
|
796
818
|
const errors = [];
|
|
797
|
-
const ctx =
|
|
819
|
+
const ctx = createNormalizeCtx({
|
|
798
820
|
name: 'broken',
|
|
799
821
|
contributes: {
|
|
800
822
|
commands: [{ command: 'ok', title: 'OK' }],
|
|
@@ -808,17 +830,17 @@ describe('normalize-contributions', () => {
|
|
|
808
830
|
errors.push({ kind, message });
|
|
809
831
|
}
|
|
810
832
|
});
|
|
811
|
-
const contributions = await
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
833
|
+
const contributions = await normalizeContributions(ctx, {});
|
|
834
|
+
expect(contributions).to.have.property('commands').with.lengthOf(1);
|
|
835
|
+
expect(contributions).to.have.property('configuration').that.is.empty;
|
|
836
|
+
expect(errors).to.have.lengthOf(1);
|
|
837
|
+
expect(errors[0].kind).to.equal('configuration');
|
|
838
|
+
expect(errors[0].message).to.be.instanceOf(Error);
|
|
817
839
|
});
|
|
818
840
|
});
|
|
819
841
|
describe('readWalkthroughs', () => {
|
|
820
842
|
it('resolves media and plugin icon URLs for browser-only static hosting', async () => {
|
|
821
|
-
const ctx =
|
|
843
|
+
const ctx = createNormalizeCtx({
|
|
822
844
|
name: 'test-plugin',
|
|
823
845
|
publisher: 'test-publisher',
|
|
824
846
|
icon: 'images/icon.png',
|
|
@@ -836,18 +858,18 @@ describe('normalize-contributions', () => {
|
|
|
836
858
|
}]
|
|
837
859
|
}
|
|
838
860
|
});
|
|
839
|
-
const contributions = await
|
|
840
|
-
|
|
861
|
+
const contributions = await normalizeContributions(ctx, {});
|
|
862
|
+
expect(contributions).to.have.property('walkthroughs').with.lengthOf(1);
|
|
841
863
|
const walkthrough = contributions.walkthroughs[0];
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
864
|
+
expect(walkthrough.pluginId).to.equal('test-publisher.test-plugin');
|
|
865
|
+
expect(walkthrough.pluginIcon).to.equal('hostedPlugin/test_publisher_test_plugin/images/icon.png');
|
|
866
|
+
expect(walkthrough.steps[0].media).to.deep.equal({
|
|
845
867
|
markdown: 'hostedPlugin/test_publisher_test_plugin/walkthroughs/open.md'
|
|
846
868
|
});
|
|
847
869
|
});
|
|
848
870
|
it('skips walkthroughs with a missing id', () => {
|
|
849
871
|
const warnings = [];
|
|
850
|
-
const ctx =
|
|
872
|
+
const ctx = createNormalizeCtx({
|
|
851
873
|
name: 'test-plugin',
|
|
852
874
|
publisher: 'test-publisher',
|
|
853
875
|
contributes: {
|
|
@@ -863,8 +885,8 @@ describe('normalize-contributions', () => {
|
|
|
863
885
|
warnings.push(msg);
|
|
864
886
|
}
|
|
865
887
|
});
|
|
866
|
-
|
|
867
|
-
|
|
888
|
+
expect(readWalkthroughs(ctx.plugin, ctx)).to.be.undefined;
|
|
889
|
+
expect(warnings).to.have.lengthOf(1);
|
|
868
890
|
});
|
|
869
891
|
});
|
|
870
892
|
});
|