feat: include private self dependency · mjeanroy/rollup-plugin-license@1401f5d (original) (raw)
`@@ -27,6 +27,7 @@ import { join } from './utils/join';
`
27
27
``
28
28
`describe('Dependency', () => {
`
29
29
`it('should extract package fields', () => {
`
``
30
`+
const self = false;
`
30
31
`const pkg = {
`
31
32
`name: 'foo',
`
32
33
`version: '1.0.0',
`
`@@ -52,9 +53,10 @@ describe('Dependency', () => {
`
52
53
`],
`
53
54
`};
`
54
55
``
55
``
`-
const dependency = new Dependency(pkg);
`
``
56
`+
const dependency = new Dependency(pkg, self);
`
56
57
``
57
58
`expect(dependency).toEqual({
`
``
59
`+
self: false,
`
58
60
`name: 'foo',
`
59
61
`version: '1.0.0',
`
60
62
`license: 'MIT',
`
`@@ -89,6 +91,7 @@ describe('Dependency', () => {
`
89
91
`});
`
90
92
``
91
93
`it('should parse author field', () => {
`
``
94
`+
const self = false;
`
92
95
`const pkg = {
`
93
96
`name: 'foo',
`
94
97
`version: '1.0.0',
`
`@@ -97,7 +100,7 @@ describe('Dependency', () => {
`
97
100
`author: 'Mickael Jeanroy mickael.jeanroy@gmail.com (https://mjeanroy.com)',
`
98
101
`};
`
99
102
``
100
``
`-
const dependency = new Dependency(pkg);
`
``
103
`+
const dependency = new Dependency(pkg, self);
`
101
104
``
102
105
`expect(dependency.author).toEqual({
`
103
106
`name: 'Mickael Jeanroy',
`
`@@ -107,6 +110,7 @@ describe('Dependency', () => {
`
107
110
`});
`
108
111
``
109
112
`it('should parse contributors field', () => {
`
``
113
`+
const self = false;
`
110
114
`const pkg = {
`
111
115
`name: 'foo',
`
112
116
`version: '1.0.0',
`
`@@ -117,7 +121,7 @@ describe('Dependency', () => {
`
117
121
`],
`
118
122
`};
`
119
123
``
120
``
`-
const dependency = new Dependency(pkg);
`
``
124
`+
const dependency = new Dependency(pkg, self);
`
121
125
``
122
126
`expect(dependency.contributors.length).toBe(1);
`
123
127
`expect(dependency.contributors[0]).toEqual({
`
`@@ -128,6 +132,7 @@ describe('Dependency', () => {
`
128
132
`});
`
129
133
``
130
134
`it('should parse deprecated licenses field', () => {
`
``
135
`+
const self = false;
`
131
136
`const pkg = {
`
132
137
`name: 'foo',
`
133
138
`version: '1.0.0',
`
`@@ -138,20 +143,21 @@ describe('Dependency', () => {
`
138
143
`],
`
139
144
`};
`
140
145
``
141
``
`-
const dependency = new Dependency(pkg);
`
``
146
`+
const dependency = new Dependency(pkg, self);
`
142
147
``
143
148
`expect(dependency.licenses).not.toBeDefined();
`
144
149
`expect(dependency.license).toBe('(MIT OR Apache 2.0)');
`
145
150
`});
`
146
151
``
147
152
`it('should format dependency with name, version, and license fields', () => {
`
``
153
`+
const self = false;
`
148
154
`const pkg = {
`
149
155
`name: 'foo',
`
150
156
`version: '1.0.0',
`
151
157
`license: 'MIT',
`
152
158
`};
`
153
159
``
154
``
`-
const dependency = new Dependency(pkg);
`
``
160
`+
const dependency = new Dependency(pkg, self);
`
155
161
``
156
162
`expect(dependency.text()).toEqual(join([
`
157
163
`` Name: ${pkg.name},
``
`@@ -162,14 +168,15 @@ describe('Dependency', () => {
`
162
168
`});
`
163
169
``
164
170
`it('should format dependency with optional description fied', () => {
`
``
171
`+
const self = false;
`
165
172
`const pkg = {
`
166
173
`name: 'foo',
`
167
174
`version: '1.0.0',
`
168
175
`license: 'MIT',
`
169
176
`description: 'Desc',
`
170
177
`};
`
171
178
``
172
``
`-
const dependency = new Dependency(pkg);
`
``
179
`+
const dependency = new Dependency(pkg, self);
`
173
180
``
174
181
`expect(dependency.text()).toEqual(join([
`
175
182
`` Name: ${pkg.name},
``
`@@ -181,6 +188,7 @@ describe('Dependency', () => {
`
181
188
`});
`
182
189
``
183
190
`it('should format dependency with optional author field', () => {
`
``
191
`+
const self = false;
`
184
192
`const pkg = {
`
185
193
`name: 'foo',
`
186
194
`version: '1.0.0',
`
`@@ -191,7 +199,7 @@ describe('Dependency', () => {
`
191
199
`},
`
192
200
`};
`
193
201
``
194
``
`-
const dependency = new Dependency(pkg);
`
``
202
`+
const dependency = new Dependency(pkg, self);
`
195
203
``
196
204
`expect(dependency.text()).toEqual(join([
`
197
205
`` Name: ${pkg.name},
``
`@@ -203,6 +211,7 @@ describe('Dependency', () => {
`
203
211
`});
`
204
212
``
205
213
`it('should format dependency with optional repository field', () => {
`
``
214
`+
const self = false;
`
206
215
`const pkg = {
`
207
216
`name: 'foo',
`
208
217
`version: '1.0.0',
`
`@@ -213,7 +222,7 @@ describe('Dependency', () => {
`
213
222
`},
`
214
223
`};
`
215
224
``
216
``
`-
const dependency = new Dependency(pkg);
`
``
225
`+
const dependency = new Dependency(pkg, self);
`
217
226
``
218
227
`expect(dependency.text()).toEqual(join([
`
219
228
`` Name: ${pkg.name},
``
`@@ -225,14 +234,15 @@ describe('Dependency', () => {
`
225
234
`});
`
226
235
``
227
236
`it('should format dependency with optional homepage field', () => {
`
``
237
`+
const self = false;
`
228
238
`const pkg = {
`
229
239
`name: 'foo',
`
230
240
`version: '1.0.0',
`
231
241
`license: 'MIT',
`
232
242
`homepage: 'https://github.com/mjeanroy',
`
233
243
`};
`
234
244
``
235
``
`-
const dependency = new Dependency(pkg);
`
``
245
`+
const dependency = new Dependency(pkg, self);
`
236
246
``
237
247
`expect(dependency.text()).toEqual(join([
`
238
248
`` Name: ${pkg.name},
``
`@@ -244,6 +254,7 @@ describe('Dependency', () => {
`
244
254
`});
`
245
255
``
246
256
`it('should format dependency with optional contributors field', () => {
`
``
257
`+
const self = false;
`
247
258
`const pkg = {
`
248
259
`name: 'foo',
`
249
260
`version: '1.0.0',
`
`@@ -254,7 +265,7 @@ describe('Dependency', () => {
`
254
265
`],
`
255
266
`};
`
256
267
``
257
``
`-
const dependency = new Dependency(pkg);
`
``
268
`+
const dependency = new Dependency(pkg, self);
`
258
269
``
259
270
`expect(dependency.text()).toEqual(join([
`
260
271
`` Name: ${pkg.name},
``
`@@ -268,6 +279,7 @@ describe('Dependency', () => {
`
268
279
`});
`
269
280
``
270
281
`it('should format dependency with all optional fields', () => {
`
``
282
`+
const self = false;
`
271
283
`const pkg = {
`
272
284
`name: 'foo',
`
273
285
`version: '1.0.0',
`
`@@ -282,7 +294,7 @@ describe('Dependency', () => {
`
282
294
`],
`
283
295
`};
`
284
296
``
285
``
`-
const dependency = new Dependency(pkg);
`
``
297
`+
const dependency = new Dependency(pkg, self);
`
286
298
``
287
299
`expect(dependency.text()).toEqual(join([
`
288
300
`` Name: ${pkg.name},
``
`@@ -300,6 +312,7 @@ describe('Dependency', () => {
`
300
312
`});
`
301
313
``
302
314
`it('should format dependency with license text', () => {
`
``
315
`+
const self = false;
`
303
316
`const pkg = {
`
304
317
`name: 'foo',
`
305
318
`version: '1.0.0',
`
`@@ -326,7 +339,7 @@ describe('Dependency', () => {
`
326
339
`],
`
327
340
`};
`
328
341
``
329
``
`-
const dependency = new Dependency(pkg);
`
``
342
`+
const dependency = new Dependency(pkg, self);
`
330
343
``
331
344
`expect(dependency.text()).toEqual(join([
`
332
345
`` Name: ${pkg.name},
``
`@@ -348,6 +361,7 @@ describe('Dependency', () => {
`
348
361
`});
`
349
362
``
350
363
`it('should format dependency with notice text', () => {
`
``
364
`+
const self = false;
`
351
365
`const pkg = {
`
352
366
`name: 'foo',
`
353
367
`version: '1.0.0',
`
`@@ -358,7 +372,7 @@ describe('Dependency', () => {
`
358
372
`homepage: 'https://github.com/mjeanroy',
`
359
373
`};
`
360
374
``
361
``
`-
const dependency = new Dependency(pkg);
`
``
375
`+
const dependency = new Dependency(pkg, self);
`
362
376
``
363
377
`expect(dependency.text()).toEqual(join([
`
364
378
`` Name: ${pkg.name},
``