File: disable-network-tests.patch

package info (click to toggle)
node-yarnpkg 4.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 24,752 kB
  • sloc: javascript: 38,953; ansic: 26,035; cpp: 7,247; sh: 2,829; makefile: 724; perl: 493
file content (137 lines) | stat: -rw-r--r-- 4,291 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
Description: Disable network tests
 We can't reliably test those during the build as the build environment
 does not have Internet connection.
Author: Zixing Liu <zixing.liu@canonical.com>
Forwarded: not-needed
Last-Update: 2024-06-19
---
--- a/packages/plugin-compat/tests/patches.test.ts
+++ /dev/null
@@ -1,127 +0,0 @@
-import {Configuration, Descriptor, Project, ResolveOptions, ThrowReport, structUtils, Locator, Cache, LocatorHash} from '@yarnpkg/core';
-import {PortablePath, xfs, ppath}                                                                                  from '@yarnpkg/fslib';
-import NpmPlugin                                                                                                   from '@yarnpkg/plugin-npm';
-import PatchPlugin                                                                                                 from '@yarnpkg/plugin-patch';
-
-import CompatPlugin                                                                                                from '../sources/index';
-
-function getConfiguration(p: PortablePath) {
-  return Configuration.create(p, p, new Map([
-    [`@yarnpkg/plugin-compat`, CompatPlugin],
-    [`@yarnpkg/plugin-npm`, NpmPlugin],
-    [`@yarnpkg/plugin-patch`, PatchPlugin],
-  ]));
-}
-
-async function createProject(configuration: Configuration, p: PortablePath, manifest: object = {}) {
-  await xfs.writeFilePromise(ppath.join(p, `package.json`), JSON.stringify(manifest));
-
-  return Project.find(configuration, p);
-}
-
-async function getDescriptorCandidates(descriptor: Descriptor) {
-  return await xfs.mktempPromise(async dir => {
-    const configuration = getConfiguration(dir);
-    const {project} = await createProject(configuration, dir);
-
-    const resolver = configuration.makeResolver();
-    const resolveOptions: ResolveOptions = {project, resolver, report: new ThrowReport()};
-
-    const normalizedDescriptor = configuration.normalizeDependency(descriptor);
-    const candidates = await resolver.getCandidates(normalizedDescriptor, {}, resolveOptions);
-
-    return candidates;
-  });
-}
-
-/**
- * A Set used to keep track of the test candidates, so we only test each candidate once.
- */
-const testedCandidates: Set<LocatorHash> = new Set();
-
-async function testCandidate(locator: Locator) {
-  if (testedCandidates.has(locator.locatorHash))
-    return;
-
-  testedCandidates.add(locator.locatorHash);
-
-  await xfs.mktempPromise(async dir => {
-    const configuration = getConfiguration(dir);
-    const {project} = await createProject(configuration, dir, {
-      dependencies: {
-        [structUtils.stringifyIdent(locator)]: locator.reference,
-      },
-    });
-    const cache = await Cache.find(configuration);
-
-    await project.resolveEverything({
-      cache,
-      lockfileOnly: false,
-      report: new ThrowReport(),
-    });
-
-    let error: Error | null = null;
-
-    try {
-      await project.fetchEverything({
-        cache,
-        report: new ThrowReport(),
-      });
-    } catch (e) {
-      error = e;
-    }
-
-    if (error) {
-      expect(error.message).not.toContain(`Cannot apply hunk`);
-    }
-  });
-}
-
-const TEST_TIMEOUT = 100000000;
-
-const TEST_RANGES: Array<[string, Array<string>]> = [
-  [
-    `fsevents`, [
-      `^1`,
-      `^2.1`,
-      `latest`,
-    ],
-  ], [
-    `resolve`, [
-      `>=1.9`,
-      `latest`,
-      `next`,
-    ],
-  ], [
-    `typescript`, [
-      `>=3.2`,
-      `latest`,
-      `next`,
-    ],
-  ],
-];
-
-describe(`patches`, () => {
-  describe.each(TEST_RANGES)(`%s`, (stringifiedIdent, ranges) => {
-    const ident = structUtils.parseIdent(stringifiedIdent);
-
-    it.each(ranges)(`should work with ${stringifiedIdent}@%s`, async range => {
-      const descriptor = structUtils.makeDescriptor(ident, range);
-      const candidates = await getDescriptorCandidates(descriptor);
-
-      const errors = [];
-
-      for (const candidate of candidates) {
-        try {
-          await testCandidate(candidate);
-        } catch (error) {
-          errors.push(`--- ${structUtils.stringifyLocator(candidate)} ---\n${error.stack}`);
-        }
-      }
-
-      if (errors.length > 0) {
-        throw new Error(errors.join(`\n`));
-      }
-    }, TEST_TIMEOUT);
-  });
-});