Skip to content

[Feature]: The transformer tests are not run in parallel #251

Closed
@trivikr

Description

@trivikr

Is your feature request related to a problem? Please describe.

The transformer tests are not run in parallel

The tests start in parallel, but are run in sync

Diff:

-  describe.each(fixtureSubDirs)("%s", (subDir) => {
+  describe.each(["new-client"])("%s", (subDir) => {
     const subDirPath = join(fixtureDir, subDir);
     it.concurrent.each(getTestFileMetadata(subDirPath))(
       `transforms: %s.%s`,
       async (filePrefix, fileExtension) => {
+        const startDate = new Date();
+        console.log(`${filePrefix} start: `, startDate.toTimeString());
+
         const { input, outputCode } = await getTestMetadata(subDirPath, filePrefix, fileExtension);
         runInlineTest(transformer, null, input, outputCode);
+
+        const endDate = new Date();
+        console.log(`${filePrefix} end: ${endDate.toTimeString()}`);
+        console.log(`${filePrefix} test run time: ${endDate.getTime() - startDate.getTime()}ms`);
       }
     );

Output:

    global-import start:  14:25:39 GMT-0800 (Pacific Standard Time)
    global-require start:  14:25:39 GMT-0800 (Pacific Standard Time)
    service-import-deep start:  14:25:39 GMT-0800 (Pacific Standard Time)
    service-import start:  14:25:39 GMT-0800 (Pacific Standard Time)
    service-require-deep start:  14:25:39 GMT-0800 (Pacific Standard Time)

    service-import end: 14:25:51 GMT-0800 (Pacific Standard Time)
    service-import test run time: 11781ms

    service-require start:  14:25:51 GMT-0800 (Pacific Standard Time)

    global-require end: 14:26:04 GMT-0800 (Pacific Standard Time)
    global-require test run time: 24973ms

    service-require-deep end: 14:26:20 GMT-0800 (Pacific Standard Time)
    service-require-deep test run time: 40440ms

    global-import end: 14:26:30 GMT-0800 (Pacific Standard Time)
    global-import test run time: 50777ms

    service-import-deep end: 14:26:41 GMT-0800 (Pacific Standard Time)
    service-import-deep test run time: 62212ms

    service-require end: 14:27:00 GMT-0800 (Pacific Standard Time)
    service-require test run time: 68779ms

This leads to CI taking time. For example, the test step takes 3m https://github.com/awslabs/aws-sdk-js-codemod/actions/runs/3803141886/jobs/6469293363

Describe the solution you'd like

Experiment with Jest code or configuration to run tests in parallel

Describe alternatives you've considered

N/A

Additional Context

$ yarn dlx -q envinfo --preset jest

  System:
    OS: macOS 12.1
    CPU: (8) arm64 Apple M1 Pro
  Binaries:
    Node: 18.12.1 - /private/var/folders/42/54jl1_3x4hz06cf7bc_kzd4h0000gn/T/xfs-6daa84fb/node
    Yarn: 3.3.1 - /private/var/folders/42/54jl1_3x4hz06cf7bc_kzd4h0000gn/T/xfs-6daa84fb/yarn
    npm: 8.19.2 - ~/Library/Caches/fnm_multishells/57062_1672199177403/bin/npm
  npmPackages:
    jest: ^29.3.1 => 29.3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions