jira.js icon indicating copy to clipboard operation
jira.js copied to clipboard

Improve integration tests performance

Open MrRefactoring opened this issue 1 year ago • 5 comments

Currently, each test file (or group of tests) uses beforeAll and afterAll hooks to create and delete a project, respectively. This approach is redundant and negatively impacts test performance.

The objective is to refactor the test setup so that the project is created only once at the beginning of the tests and deleted after all tests finish (regardless of success or failure).

Checklist:

  1. Remove tests.setupFiles

    • Open the vitest.config.mts file.
    • Remove the tests.setupFiles property.
  2. Add tests.globalSetup

    • In vitest.config.mts, add a tests.globalSetup property pointing to a configuration file.
    • Ensure the file runs only for integration tests by checking process.env.TEST_ENV === 'integration'.
    • Update package.json -> scripts -> test:integration to set this flag.
  3. Create a Global Setup File

    • Use the following template for the configuration file:

      export async function setup() {
        // TODO: Implement project creation
      }
      
      export async function teardown() {
        // TODO: Implement project deletion
      }
      
  4. Clean Up Test Files

    • Remove beforeAll and afterAll hooks from test files where they are no longer needed.

Notes:
Submit a pull request to the release/v5.0.0 branch.

MrRefactoring avatar Jan 12 '25 23:01 MrRefactoring

/attempt Interesting.

tamirazrab avatar Jan 13 '25 10:01 tamirazrab

Hi @MrRefactoring , I'm facing couple of blockers, is there any Slack/Discord for me to get some help?

tamirazrab avatar Jan 14 '25 06:01 tamirazrab

Hi @tamirazrab! You can message me on Telegram or email me

MrRefactoring avatar Jan 14 '25 10:01 MrRefactoring

Hi @tamirazrab! You can message me on Telegram or email me

Hi, Telegram doesn't work in my country and email won't be good for back and forth communication.

tamirazrab avatar Jan 15 '25 06:01 tamirazrab

But Slack and Discord doesn't work in my country :D

MrRefactoring avatar Jan 21 '25 11:01 MrRefactoring