refactor: leverage native async setTimeout rather than delay
This commit is contained in:
		
							parent
							
								
									42385d0f96
								
							
						
					
					
						commit
						ab4fe4c3d4
					
				
							
								
								
									
										19
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										19
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @ -46,7 +46,6 @@ | |||||||
|         "c8": "7.13.0", |         "c8": "7.13.0", | ||||||
|         "clear-module": "4.1.2", |         "clear-module": "4.1.2", | ||||||
|         "codecov": "3.8.3", |         "codecov": "3.8.3", | ||||||
|         "delay": "6.0.0", |  | ||||||
|         "dockerode": "3.3.5", |         "dockerode": "3.3.5", | ||||||
|         "file-url": "4.0.0", |         "file-url": "4.0.0", | ||||||
|         "fs-extra": "11.1.1", |         "fs-extra": "11.1.1", | ||||||
| @ -2000,18 +1999,6 @@ | |||||||
|         "url": "https://github.com/sponsors/sindresorhus" |         "url": "https://github.com/sponsors/sindresorhus" | ||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "node_modules/delay": { |  | ||||||
|       "version": "6.0.0", |  | ||||||
|       "resolved": "https://registry.npmjs.org/delay/-/delay-6.0.0.tgz", |  | ||||||
|       "integrity": "sha512-2NJozoOHQ4NuZuVIr5CWd0iiLVIRSDepakaovIN+9eIDHEhdCAEvSy2cuf1DCrPPQLvHmbqTHODlhHg8UCy4zw==", |  | ||||||
|       "dev": true, |  | ||||||
|       "engines": { |  | ||||||
|         "node": ">=16" |  | ||||||
|       }, |  | ||||||
|       "funding": { |  | ||||||
|         "url": "https://github.com/sponsors/sindresorhus" |  | ||||||
|       } |  | ||||||
|     }, |  | ||||||
|     "node_modules/deprecation": { |     "node_modules/deprecation": { | ||||||
|       "version": "2.3.1", |       "version": "2.3.1", | ||||||
|       "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", |       "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", | ||||||
| @ -10838,12 +10825,6 @@ | |||||||
|         } |         } | ||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "delay": { |  | ||||||
|       "version": "6.0.0", |  | ||||||
|       "resolved": "https://registry.npmjs.org/delay/-/delay-6.0.0.tgz", |  | ||||||
|       "integrity": "sha512-2NJozoOHQ4NuZuVIr5CWd0iiLVIRSDepakaovIN+9eIDHEhdCAEvSy2cuf1DCrPPQLvHmbqTHODlhHg8UCy4zw==", |  | ||||||
|       "dev": true |  | ||||||
|     }, |  | ||||||
|     "deprecation": { |     "deprecation": { | ||||||
|       "version": "2.3.1", |       "version": "2.3.1", | ||||||
|       "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", |       "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", | ||||||
|  | |||||||
| @ -60,7 +60,6 @@ | |||||||
|     "c8": "7.13.0", |     "c8": "7.13.0", | ||||||
|     "clear-module": "4.1.2", |     "clear-module": "4.1.2", | ||||||
|     "codecov": "3.8.3", |     "codecov": "3.8.3", | ||||||
|     "delay": "6.0.0", |  | ||||||
|     "dockerode": "3.3.5", |     "dockerode": "3.3.5", | ||||||
|     "file-url": "4.0.0", |     "file-url": "4.0.0", | ||||||
|     "fs-extra": "11.1.1", |     "fs-extra": "11.1.1", | ||||||
|  | |||||||
| @ -1,9 +1,9 @@ | |||||||
| import path, { dirname } from "node:path"; | import path, { dirname } from "node:path"; | ||||||
| import { fileURLToPath } from "node:url"; | import { fileURLToPath } from "node:url"; | ||||||
|  | import { setTimeout } from "node:timers/promises"; | ||||||
| import Docker from "dockerode"; | import Docker from "dockerode"; | ||||||
| import getStream from "get-stream"; | import getStream from "get-stream"; | ||||||
| import got from "got"; | import got from "got"; | ||||||
| import delay from "delay"; |  | ||||||
| import pRetry from "p-retry"; | import pRetry from "p-retry"; | ||||||
| 
 | 
 | ||||||
| const IMAGE = "verdaccio/verdaccio:5"; | const IMAGE = "verdaccio/verdaccio:5"; | ||||||
| @ -33,7 +33,7 @@ export async function start() { | |||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|   await container.start(); |   await container.start(); | ||||||
|   await delay(4000); |   await setTimeout(4000); | ||||||
| 
 | 
 | ||||||
|   try { |   try { | ||||||
|     // Wait for the registry to be ready
 |     // Wait for the registry to be ready
 | ||||||
|  | |||||||
| @ -1,11 +1,11 @@ | |||||||
| import path from "path"; | import path from "node:path"; | ||||||
|  | import { setTimeout } from "node:timers/promises"; | ||||||
| import test from "ava"; | import test from "ava"; | ||||||
| import * as td from "testdouble"; | import * as td from "testdouble"; | ||||||
| import { escapeRegExp } from "lodash-es"; | import { escapeRegExp } from "lodash-es"; | ||||||
| import fsExtra from "fs-extra"; | import fsExtra from "fs-extra"; | ||||||
| import { execa } from "execa"; | import { execa } from "execa"; | ||||||
| import { WritableStreamBuffer } from "stream-buffers"; | import { WritableStreamBuffer } from "stream-buffers"; | ||||||
| import delay from "delay"; |  | ||||||
| 
 | 
 | ||||||
| import getAuthUrl from "../lib/get-git-auth-url.js"; | import getAuthUrl from "../lib/get-git-auth-url.js"; | ||||||
| import { SECRET_REPLACEMENT } from "../lib/definitions/constants.js"; | import { SECRET_REPLACEMENT } from "../lib/definitions/constants.js"; | ||||||
| @ -295,7 +295,7 @@ test("Release patch, minor and major versions", async (t) => { | |||||||
|   t.is(exitCode, 0); |   t.is(exitCode, 0); | ||||||
| 
 | 
 | ||||||
|   // Wait for 3s as the change of dist-tag takes time to be reflected in the registry
 |   // Wait for 3s as the change of dist-tag takes time to be reflected in the registry
 | ||||||
|   await delay(3000); |   await setTimeout(3000); | ||||||
|   // Retrieve the published package from the registry and check version and gitHead
 |   // Retrieve the published package from the registry and check version and gitHead
 | ||||||
|   ({ |   ({ | ||||||
|     "dist-tags": { latest: releasedVersion }, |     "dist-tags": { latest: releasedVersion }, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user