Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for module jsdoc parsing #1973

Closed
ST-DDT opened this issue Mar 24, 2023 · 6 comments · Fixed by #2412
Closed

Add tests for module jsdoc parsing #1973

ST-DDT opened this issue Mar 24, 2023 · 6 comments · Fixed by #2412
Assignees
Labels
c: docs Improvements or additions to documentation c: test p: 1-normal Nothing urgent
Milestone

Comments

@ST-DDT
Copy link
Member

ST-DDT commented Mar 24, 2023

Clear and concise description of the problem

Currently we only have tests covering the signatures.

Suggested solution

Add a test setup for modules as well.

  • Deprecated and non-deprecated
  • Containing references to fakerjs.dev and next.fakerjs.dev

Alternative

None

Additional context

Split from #1929

@ST-DDT ST-DDT added c: docs Improvements or additions to documentation p: 1-normal Nothing urgent c: test labels Mar 24, 2023
@ST-DDT ST-DDT moved this to Todo in Faker Roadmap Mar 24, 2023
@ST-DDT ST-DDT changed the title A tests for module jsdoc parsing Add tests for module jsdoc parsing Mar 24, 2023
@ST-DDT
Copy link
Member Author

ST-DDT commented Apr 5, 2023

Blocked by #2024

@ST-DDT ST-DDT added the s: on hold Blocked by something or frozen to avoid conflicts label Apr 5, 2023
@ST-DDT ST-DDT removed the s: on hold Blocked by something or frozen to avoid conflicts label May 6, 2023
@ST-DDT
Copy link
Member Author

ST-DDT commented May 6, 2023

This is no longer blocked. In fact we already have a base setup from #2101, we should probably extend it with more cases like @deprecated.

@xDivisionByZerox
Copy link
Member

Deprecated and non-deprecated

We do not log any messages when a module is deprecated. All of them are instantiated when a Faker instance is created which would lead to misleading logs.
How would you test this? What is the expected behavior to test?

@ST-DDT
Copy link
Member Author

ST-DDT commented Jun 28, 2023

This is not about the module behavior being tested, but our jsdocs tooling.

@xDivisionByZerox
Copy link
Member

So this is about the test\scripts\apidoc\module.spec.ts file, not test\scripts\apidoc\verify-jsdoc-tags.spec.ts?

I was looking at the following test. But guess I looked at the wrong place:

it('verify @deprecated tag', async () => {
// Grab path to example file
const path = resolvePathToMethodFile(moduleName, methodName);
const consoleWarnSpy = vi.spyOn(console, 'warn');
// Run the examples
await import(`${path}?scope=deprecated`);
// Verify that deprecated methods log a warning
const deprecatedFlag = extractDeprecated(signature) !== undefined;
if (deprecatedFlag) {
expect(consoleWarnSpy).toHaveBeenCalled();
expect(
extractTagContent('@deprecated', signature).join(''),
'@deprecated tag without message'
).not.toBe('');
} else {
expect(consoleWarnSpy).not.toHaveBeenCalled();
}
});

@ST-DDT
Copy link
Member Author

ST-DDT commented Sep 21, 2023

Will be added in #2412

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: docs Improvements or additions to documentation c: test p: 1-normal Nothing urgent
Projects
No open projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

2 participants