diff options
| author | Shinigami <[email protected]> | 2025-02-12 20:32:44 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-02-12 19:32:44 +0000 |
| commit | e28273f14af87f52fe1e1a430bc357f9545c0fca (patch) | |
| tree | 37478fcfe6c65d16e78018b0396bfdf51e81f0b9 /test/scripts | |
| parent | b9a12f5f17e6e25b5398b0065fad053452e21137 (diff) | |
| download | faker-e28273f14af87f52fe1e1a430bc357f9545c0fca.tar.xz faker-e28273f14af87f52fe1e1a430bc357f9545c0fca.zip | |
test: retry verify tag 3 times (#3395)
Diffstat (limited to 'test/scripts')
| -rw-r--r-- | test/scripts/apidocs/verify-jsdoc-tags.spec.ts | 94 |
1 files changed, 54 insertions, 40 deletions
diff --git a/test/scripts/apidocs/verify-jsdoc-tags.spec.ts b/test/scripts/apidocs/verify-jsdoc-tags.spec.ts index dd77620d..244741c6 100644 --- a/test/scripts/apidocs/verify-jsdoc-tags.spec.ts +++ b/test/scripts/apidocs/verify-jsdoc-tags.spec.ts @@ -164,54 +164,68 @@ ${examples}`; assertDescription(signature.description); }); - it('verify @example tag', { timeout: 30000 }, async () => { - const examples = signature.examples.join('\n'); - - expect( - examples, - `${moduleName}.${methodName} to have examples` - ).not.toBe(''); - - // Grab path to example file - const path = resolvePathToMethodFile( - moduleName, - methodName, - signatureIndex - ); + it( + 'verify @example tag', + { + retry: 3, + timeout: 30000, + }, + async () => { + const examples = signature.examples.join('\n'); + + expect( + examples, + `${moduleName}.${methodName} to have examples` + ).not.toBe(''); + + // Grab path to example file + const path = resolvePathToMethodFile( + moduleName, + methodName, + signatureIndex + ); - // Executing the examples should not throw - await expect( - import(`${path}?scope=example`), - examples - ).resolves.toBeDefined(); - }); + // Executing the examples should not throw + await expect( + import(`${path}?scope=example`), + examples + ).resolves.toBeDefined(); + } + ); // This only checks whether the whole method is deprecated or not // It does not check whether the method is deprecated for a specific set of arguments - it('verify @deprecated tag', { timeout: 30000 }, async () => { - // Grab path to example file - const path = resolvePathToMethodFile( - moduleName, - methodName, - signatureIndex - ); + it( + 'verify @deprecated tag', + { + retry: 3, + timeout: 30000, + }, + async () => { + // Grab path to example file + const path = resolvePathToMethodFile( + moduleName, + methodName, + signatureIndex + ); - const consoleWarnSpy = vi.spyOn(console, 'warn'); + const consoleWarnSpy = vi.spyOn(console, 'warn'); - // Run the examples - await import(`${path}?scope=deprecated`); + // Run the examples + await import(`${path}?scope=deprecated`); - // Verify that deprecated methods log a warning - const { deprecated } = signature; - if (deprecated == null) { - expect(consoleWarnSpy).not.toHaveBeenCalled(); - } else { - expect(consoleWarnSpy).toHaveBeenCalled(); - expect(deprecated).not.toBe(''); - } + // Verify that deprecated methods log a warning + const { deprecated } = signature; + if (deprecated == null) { + expect(consoleWarnSpy).not.toHaveBeenCalled(); + } else { + expect(consoleWarnSpy).toHaveBeenCalled(); + expect(deprecated).not.toBe(''); + } - consoleWarnSpy.mockRestore(); - }); + consoleWarnSpy.mockRestore(); + } + ); describe.each(signature.parameters.map((p) => [p.name, p]))( '%s', |
