1// some real-world examples of ERESOLVE error explanation objects,
2// copied from arborist or generated there.
3module.exports = {
4  cycleNested: {
5    code: 'ERESOLVE',
6    edge: {
7      type: 'peer',
8      name: '@isaacs/peer-dep-cycle-b',
9      spec: '1',
10      from: {
11        name: '@isaacs/peer-dep-cycle-a',
12        version: '1.0.0',
13        location: 'node_modules/@isaacs/peer-dep-cycle-a',
14        dependents: [
15          {
16            type: 'prod',
17            name: '@isaacs/peer-dep-cycle-a',
18            spec: '1.x',
19            from: { location: '/some/project' },
20          },
21        ],
22      },
23    },
24    current: {
25      name: '@isaacs/peer-dep-cycle-c',
26      version: '2.0.0',
27      location: 'node_modules/@isaacs/peer-dep-cycle-c',
28      dependents: [
29        {
30          type: 'prod',
31          name: '@isaacs/peer-dep-cycle-c',
32          spec: '2.x',
33          from: { location: '/some/project' },
34        },
35      ],
36    },
37    peerConflict: {
38      peer: {
39        name: '@isaacs/peer-dep-cycle-c',
40        version: '1.0.0',
41        whileInstalling: { name: '@isaacs/peer-dep-cycle-a', version: '1.0.0' },
42        location: 'node_modules/@isaacs/peer-dep-cycle-c',
43        dependents: [
44          {
45            type: 'peer',
46            name: '@isaacs/peer-dep-cycle-c',
47            spec: '1',
48            from: {
49              name: '@isaacs/peer-dep-cycle-b',
50              version: '1.0.0',
51              whileInstalling: { name: '@isaacs/peer-dep-cycle-a', version: '1.0.0' },
52              location: 'node_modules/@isaacs/peer-dep-cycle-b',
53              dependents: [
54                {
55                  type: 'peer',
56                  name: '@isaacs/peer-dep-cycle-b',
57                  spec: '1',
58                  from: {
59                    name: '@isaacs/peer-dep-cycle-a',
60                    version: '1.0.0',
61                    location: 'node_modules/@isaacs/peer-dep-cycle-a',
62                    dependents: [
63                      {
64                        type: 'prod',
65                        name: '@isaacs/peer-dep-cycle-a',
66                        spec: '1.x',
67                        from: { location: '/some/project' },
68                      },
69                    ],
70                  },
71                },
72              ],
73            },
74          },
75        ],
76      },
77    },
78    strictPeerDeps: true,
79  },
80
81  withShrinkwrap: {
82    code: 'ERESOLVE',
83    edge: {
84      type: 'peer',
85      name: '@isaacs/peer-dep-cycle-c',
86      spec: '1',
87      error: 'INVALID',
88      from: {
89        name: '@isaacs/peer-dep-cycle-b',
90        version: '1.0.0',
91        location: 'node_modules/@isaacs/peer-dep-cycle-b',
92        whileInstalling: { name: '@isaacs/peer-dep-cycle-b', version: '1.0.0' },
93        dependents: [
94          {
95            type: 'peer',
96            name: '@isaacs/peer-dep-cycle-b',
97            spec: '1',
98            from: {
99              name: '@isaacs/peer-dep-cycle-a',
100              version: '1.0.0',
101              location: 'node_modules/@isaacs/peer-dep-cycle-a',
102              dependents: [
103                {
104                  type: 'prod',
105                  name: '@isaacs/peer-dep-cycle-a',
106                  spec: '1.x',
107                  from: { location: '/some/project' },
108                },
109              ],
110            },
111          },
112        ],
113      },
114    },
115    current: {
116      name: '@isaacs/peer-dep-cycle-c',
117      version: '2.0.0',
118      location: 'node_modules/@isaacs/peer-dep-cycle-c',
119      dependents: [
120        {
121          type: 'prod',
122          name: '@isaacs/peer-dep-cycle-c',
123          spec: '2.x',
124          from: { location: '/some/project' },
125        },
126      ],
127    },
128    strictPeerDeps: true,
129  },
130
131  'chain-conflict': {
132    code: 'ERESOLVE',
133    current: {
134      name: '@isaacs/testing-peer-dep-conflict-chain-d',
135      version: '2.0.0',
136      whileInstalling: {
137        name: 'project',
138        version: '1.2.3',
139        path: '/some/project',
140      },
141      location: 'node_modules/@isaacs/testing-peer-dep-conflict-chain-d',
142      dependents: [
143        {
144          type: 'prod',
145          name: '@isaacs/testing-peer-dep-conflict-chain-d',
146          spec: '2',
147          from: { location: '/some/project' },
148        },
149      ],
150    },
151    edge: {
152      type: 'peer',
153      name: '@isaacs/testing-peer-dep-conflict-chain-d',
154      spec: '1',
155      error: 'INVALID',
156      from: {
157        name: '@isaacs/testing-peer-dep-conflict-chain-c',
158        version: '1.0.0',
159        whileInstalling: {
160          name: 'project',
161          version: '1.2.3',
162          path: '/some/project',
163        },
164        location: 'node_modules/@isaacs/testing-peer-dep-conflict-chain-c',
165        dependents: [
166          {
167            type: 'prod',
168            name: '@isaacs/testing-peer-dep-conflict-chain-c',
169            spec: '1',
170            from: { location: '/some/project' },
171          },
172        ],
173      },
174    },
175    peerConflict: null,
176    strictPeerDeps: false,
177  },
178
179  gatsby: {
180    code: 'ERESOLVE',
181    current: {
182      name: 'ink',
183      version: '3.0.0-7',
184      whileInstalling: {
185        name: 'gatsby-recipes',
186        version: '0.2.31',
187        path: '/some/project/node_modules/gatsby-recipes',
188      },
189      location: 'node_modules/ink',
190      dependents: [
191        {
192          type: 'dev',
193          name: 'ink',
194          spec: 'next',
195          from: {
196            name: 'gatsby-recipes',
197            version: '0.2.31',
198            location: 'node_modules/gatsby-recipes',
199            dependents: [
200              {
201                type: 'prod',
202                name: 'gatsby-recipes',
203                spec: '^0.2.31',
204                from: {
205                  name: 'gatsby-cli',
206                  version: '2.12.107',
207                  location: 'node_modules/gatsby-cli',
208                  dependents: [
209                    {
210                      type: 'prod',
211                      name: 'gatsby-cli',
212                      spec: '^2.12.107',
213                      from: {
214                        name: 'gatsby',
215                        version: '2.24.74',
216                        location: 'node_modules/gatsby',
217                        dependents: [
218                          {
219                            type: 'prod',
220                            name: 'gatsby',
221                            spec: '',
222                            from: {
223                              location: '/some/project/gatsby-user',
224                            },
225                          },
226                        ],
227                      },
228                    },
229                  ],
230                },
231              },
232            ],
233          },
234        },
235      ],
236    },
237    edge: {
238      type: 'peer',
239      name: 'ink',
240      spec: '>=2.0.0',
241      error: 'INVALID',
242      from: {
243        name: 'ink-box',
244        version: '1.0.0',
245        whileInstalling: {
246          name: 'gatsby-recipes',
247          version: '0.2.31',
248          path: '/some/project/gatsby-user/node_modules/gatsby-recipes',
249        },
250        location: 'node_modules/ink-box',
251        dependents: [
252          {
253            type: 'prod',
254            name: 'ink-box',
255            spec: '^1.0.0',
256            from: {
257              name: 'gatsby-recipes',
258              version: '0.2.31',
259              location: 'node_modules/gatsby-recipes',
260              dependents: [
261                {
262                  type: 'prod',
263                  name: 'gatsby-recipes',
264                  spec: '^0.2.31',
265                  from: {
266                    name: 'gatsby-cli',
267                    version: '2.12.107',
268                    location: 'node_modules/gatsby-cli',
269                    dependents: [
270                      {
271                        type: 'prod',
272                        name: 'gatsby-cli',
273                        spec: '^2.12.107',
274                        from: {
275                          name: 'gatsby',
276                          version: '2.24.74',
277                          location: 'node_modules/gatsby',
278                          dependents: [
279                            {
280                              type: 'prod',
281                              name: 'gatsby',
282                              spec: '',
283                              from: {
284                                location: '/some/project/gatsby-user',
285                              },
286                            },
287                          ],
288                        },
289                      },
290                    ],
291                  },
292                },
293              ],
294            },
295          },
296        ],
297      },
298    },
299    peerConflict: null,
300    strictPeerDeps: true,
301  },
302
303  'no current node, but has current edge': {
304    code: 'ERESOLVE',
305    current: null,
306    currentEdge: {
307      type: 'dev',
308      name: 'eslint',
309      spec: 'file:.',
310      error: 'MISSING',
311      from: {
312        location: '/some/projects/eslint',
313      },
314    },
315    edge: {
316      type: 'peer',
317      name: 'eslint',
318      spec: '^6.0.0',
319      error: 'MISSING',
320      from: {
321        name: 'eslint-plugin-jsdoc',
322        version: '22.2.0',
323        whileInstalling: {
324          name: 'eslint',
325          version: '7.22.0',
326          path: '/Users/isaacs/dev/npm/cli/eslint',
327        },
328        location: 'node_modules/eslint-plugin-jsdoc',
329        dependents: [
330          {
331            type: 'dev',
332            name: 'eslint-plugin-jsdoc',
333            spec: '^22.1.0',
334            from: {
335              location: '/some/projects/eslint',
336            },
337          },
338        ],
339      },
340    },
341    peerConflict: null,
342    strictPeerDeps: false,
343    force: false,
344  },
345  'no current node, no current edge, idk': {
346    code: 'ERESOLVE',
347    current: null,
348    edge: {
349      type: 'peer',
350      name: 'eslint',
351      spec: '^6.0.0',
352      error: 'MISSING',
353      from: {
354        name: 'eslint-plugin-jsdoc',
355        version: '22.2.0',
356        whileInstalling: {
357          name: 'eslint',
358          version: '7.22.0',
359          path: '/Users/isaacs/dev/npm/cli/eslint',
360        },
361        location: 'node_modules/eslint-plugin-jsdoc',
362        dependents: [
363          {
364            type: 'dev',
365            name: 'eslint-plugin-jsdoc',
366            spec: '^22.1.0',
367            from: {
368              location: '/some/projects/eslint',
369            },
370          },
371        ],
372      },
373    },
374    peerConflict: null,
375    strictPeerDeps: false,
376    force: false,
377  },
378
379  'eslint-plugin case': {
380    code: 'ERESOLVE',
381    edge: {
382      type: 'dev',
383      name: 'eslint-plugin-eslint-plugin',
384      spec: '^3.1.0',
385      error: 'MISSING',
386      from: {
387        location: '/Users/isaacs/dev/npm/arborist/fixtures/eslint-plugin-react',
388      },
389    },
390    dep: {
391      name: 'eslint-plugin-eslint-plugin',
392      version: '3.5.1',
393      whileInstalling: {
394        name: 'eslint-plugin-react',
395        version: '7.24.0',
396        path: '/Users/isaacs/dev/npm/arborist/fixtures/eslint-plugin-react',
397      },
398      location: 'node_modules/eslint-plugin-eslint-plugin',
399      isWorkspace: false,
400      dependents: [
401        {
402          type: 'dev',
403          name: 'eslint-plugin-eslint-plugin',
404          spec: '^3.1.0',
405          error: 'MISSING',
406          from: {
407            location: '/Users/isaacs/dev/npm/arborist/fixtures/eslint-plugin-react',
408          },
409        },
410      ],
411    },
412    current: null,
413    peerConflict: {
414      current: {
415        name: 'eslint',
416        version: '6.8.0',
417        location: 'node_modules/eslint',
418        isWorkspace: false,
419        dependents: [
420          {
421            type: 'dev',
422            name: 'eslint',
423            spec: '^3 || ^4 || ^5 || ^6 || ^7',
424            from: {
425              location: '/Users/isaacs/dev/npm/arborist/fixtures/eslint-plugin-react',
426            },
427          },
428          {
429            type: 'peer',
430            name: 'eslint',
431            spec: '^5.0.0 || ^6.0.0',
432            from: {
433              name: '@typescript-eslint/parser',
434              version: '2.34.0',
435              location: 'node_modules/@typescript-eslint/parser',
436              isWorkspace: false,
437              dependents: [
438                {
439                  type: 'dev',
440                  name: '@typescript-eslint/parser',
441                  spec: '^2.34.0',
442                  from: {
443                    location: '/Users/isaacs/dev/npm/arborist/fixtures/eslint-plugin-react',
444                  },
445                },
446              ],
447            },
448          },
449          {
450            type: 'peer',
451            name: 'eslint',
452            spec: '^5.16.0 || ^6.8.0 || ^7.2.0',
453            from: {
454              name: 'eslint-config-airbnb-base',
455              version: '14.2.1',
456              location: 'node_modules/eslint-config-airbnb-base',
457              isWorkspace: false,
458              dependents: [
459                {
460                  type: 'dev',
461                  name: 'eslint-config-airbnb-base',
462                  spec: '^14.2.1',
463                  from: {
464                    location: '/Users/isaacs/dev/npm/arborist/fixtures/eslint-plugin-react',
465                  },
466                },
467              ],
468            },
469          },
470          {
471            type: 'peer',
472            name: 'eslint',
473            spec: '^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0',
474            from: {
475              name: 'eslint-plugin-import',
476              version: '2.23.4',
477              location: 'node_modules/eslint-plugin-import',
478              isWorkspace: false,
479              dependents: [
480                {
481                  type: 'dev',
482                  name: 'eslint-plugin-import',
483                  spec: '^2.23.4',
484                  from: {
485                    location: '/Users/isaacs/dev/npm/arborist/fixtures/eslint-plugin-react',
486                  },
487                },
488                {
489                  type: 'peer',
490                  name: 'eslint-plugin-import',
491                  spec: '^2.22.1',
492                  from: {
493                    name: 'eslint-config-airbnb-base',
494                    version: '14.2.1',
495                    location: 'node_modules/eslint-config-airbnb-base',
496                    isWorkspace: false,
497                    dependents: [
498                      {
499                        type: 'dev',
500                        name: 'eslint-config-airbnb-base',
501                        spec: '^14.2.1',
502                        from: {
503                          location: '/Users/isaacs/dev/npm/arborist/fixtures/eslint-plugin-react',
504                        },
505                      },
506                    ],
507                  },
508                },
509              ],
510            },
511          },
512        ],
513      },
514      peer: {
515        name: 'eslint',
516        version: '7.31.0',
517        whileInstalling: {
518          name: 'eslint-plugin-react',
519          version: '7.24.0',
520          path: '/Users/isaacs/dev/npm/arborist/fixtures/eslint-plugin-react',
521        },
522        location: 'node_modules/eslint',
523        isWorkspace: false,
524        dependents: [
525          {
526            type: 'peer',
527            name: 'eslint',
528            spec: '^7.0.0',
529            from: {
530              name: 'eslint-plugin-eslint-plugin',
531              version: '3.5.1',
532              whileInstalling: {
533                name: 'eslint-plugin-react',
534                version: '7.24.0',
535                path: '/Users/isaacs/dev/npm/arborist/fixtures/eslint-plugin-react',
536              },
537              location: 'node_modules/eslint-plugin-eslint-plugin',
538              isWorkspace: false,
539              dependents: [
540                {
541                  type: 'dev',
542                  name: 'eslint-plugin-eslint-plugin',
543                  spec: '^3.1.0',
544                  error: 'MISSING',
545                  from: {
546                    location: '/Users/isaacs/dev/npm/arborist/fixtures/eslint-plugin-react',
547                  },
548                },
549              ],
550            },
551          },
552        ],
553      },
554    },
555    strictPeerDeps: false,
556    force: false,
557    isMine: true,
558  },
559}
560