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

Feat: Create custom ESLint Rule to avoid lingering modules #1

Closed
thiagomini opened this issue Nov 28, 2023 · 0 comments
Closed

Feat: Create custom ESLint Rule to avoid lingering modules #1

thiagomini opened this issue Nov 28, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@thiagomini
Copy link
Contributor

Description

We need a Rule that enforces closing a TestingModule. When we create a module in tests and don't close it we potentially leak memory and/or database connections.

Acceptance Criteria

The ESLint rule should warn when:

  • A Test.createTestingModule() is executed in the beforeEach() hook, but then the module isn’t closed in the afterEach()
  • A Test.createTestingModule() is executed in the beforeAll() hook, but isn’t closed in the afterAll() one.
  • A Test.createTestingModule() is executed within a test, or it block, but isn't closed.

The ESLint rule should consider valid:

  • When a Test.createTestingModule() is executed in the beforeEach() and the module is then closed in the afterEach() hook
  • When a Test.createTestingModule() is executed in the beforeAll() and the module is then closed in the afterAll() hook
  • When a Test.createTestingModule() is executed, followed by a module.createNestApp(), and then the application is closed in the correct hook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant