Skip to content

Commit

Permalink
fix(cdk-graph-plugin-diagram): reduce jest concurrency
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyJonas authored and agdimech committed Jan 24, 2023
1 parent 17f0a9d commit dd3bf69
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
4 changes: 3 additions & 1 deletion packages/cdk-graph-plugin-diagram/package.json
Expand Up @@ -185,7 +185,9 @@
"ts-jest": {
"tsconfig": "tsconfig.dev.json"
}
}
},
"maxWorkers": "25%",
"maxConcurrency": 2
},
"types": "lib/index.d.ts",
"stability": "experimental",
Expand Down
26 changes: 17 additions & 9 deletions private/projects/cdk-graph-plugin-diagram.ts
Expand Up @@ -80,15 +80,23 @@ export class CdkGraphPluginDiagramProject extends CdkGraphPluginProject {

this.postCompileTask.prependSpawn(copyFilesTask);

this.jest?.addIgnorePattern("/\\.tmp/");
this.jest?.addIgnorePattern("/__\\w+__/");
this.jest?.addWatchIgnorePattern("/\\.tmp/");
if (this.jest) {
this.jest.addIgnorePattern("/\\.tmp/");
this.jest.addIgnorePattern("/__\\w+__/");
this.jest.addWatchIgnorePattern("/\\.tmp/");

// https://www.npmjs.com/package/jest-image-snapshot
this.jest?.addReporter(
"jest-image-snapshot/src/outdated-snapshot-reporter.js"
);
this.testTask.env("JEST_IMAGE_SNAPSHOT_TRACK_OBSOLETE", "1");
this.addGitIgnore(".jest-image-snapshot-touched-files");
// Tests in this package consume a lot of memory and compute; reducing concurrency to limit effects
// https://jestjs.io/docs/27.x/configuration#maxworkers-number--string
this.jest.config.maxWorkers = "25%";
// https://jestjs.io/docs/27.x/configuration#maxconcurrency-number
this.jest.config.maxConcurrency = 2;

// https://www.npmjs.com/package/jest-image-snapshot
this.jest.addReporter(
"jest-image-snapshot/src/outdated-snapshot-reporter.js"
);
this.testTask.env("JEST_IMAGE_SNAPSHOT_TRACK_OBSOLETE", "1");
this.addGitIgnore(".jest-image-snapshot-touched-files");
}
}
}

0 comments on commit dd3bf69

Please sign in to comment.