@link-assistant/web-capture 1.7.1 → 1.7.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @link-assistant/web-capture
2
2
 
3
+ ## 1.7.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 9c0df3c: Retry npm publish verification long enough to tolerate registry propagation delays after a successful publish.
8
+
3
9
  ## 1.7.1
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@link-assistant/web-capture",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "description": "CLI and microservice to render web pages as HTML, Markdown, or PNG",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -0,0 +1,57 @@
1
+ import { jest } from '@jest/globals';
2
+
3
+ const originalFetch = global.fetch;
4
+
5
+ beforeAll(() => {
6
+ global.fetch = jest.fn().mockResolvedValue({
7
+ text: async () => `
8
+ ({
9
+ use: async (name) => {
10
+ if (name === 'command-stream') return { $: () => ({ run: async () => ({ code: 0, stdout: '', stderr: '' }) }) };
11
+ if (name === 'lino-arguments') return { makeConfig: () => ({ shouldPull: false, jsRoot: 'js' }) };
12
+ throw new Error('Unexpected dynamic import: ' + name);
13
+ }
14
+ })
15
+ `,
16
+ });
17
+ });
18
+
19
+ afterAll(() => {
20
+ global.fetch = originalFetch;
21
+ });
22
+
23
+ describe('publish verification', () => {
24
+ test('keeps polling verification through transient npm 404s', async () => {
25
+ const { verifyPublishedVersionWithRunner } =
26
+ await import('../../../scripts/publish-to-npm.mjs');
27
+
28
+ const runVerify = jest
29
+ .fn()
30
+ .mockResolvedValueOnce({
31
+ code: 1,
32
+ stdout: '',
33
+ stderr: 'npm error code E404',
34
+ })
35
+ .mockResolvedValueOnce({
36
+ code: 1,
37
+ stdout: '',
38
+ stderr: 'npm error code E404',
39
+ })
40
+ .mockResolvedValueOnce({
41
+ code: 0,
42
+ stdout: '1.7.1\n',
43
+ stderr: '',
44
+ });
45
+ const sleepFn = jest.fn().mockResolvedValue(undefined);
46
+
47
+ const published = await verifyPublishedVersionWithRunner(
48
+ '1.7.1',
49
+ runVerify,
50
+ sleepFn
51
+ );
52
+
53
+ expect(published).toBe(true);
54
+ expect(runVerify).toHaveBeenCalledTimes(3);
55
+ expect(sleepFn).toHaveBeenCalledTimes(2);
56
+ });
57
+ });