Skip to content

Commit

Permalink
use Set
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Jan 20, 2019
1 parent 61523b0 commit 44aa91d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/jest-config/src/normalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ const normalizePreprocessor = (options: InitialOptions): InitialOptions => {
};

const normalizeMissingOptions = (options: InitialOptions): InitialOptions => {
const knownRootDirs = {};
const knownRootDirs = new Set();
if (!options.name) {
options.name = crypto
.createHash('md5')
Expand All @@ -276,11 +276,11 @@ const normalizeMissingOptions = (options: InitialOptions): InitialOptions => {
options.projects = options.projects.map((project, index) => {
if (typeof project !== 'string' && !project.name) {
let rootDir = project.rootDir || options.rootDir;
if (knownRootDirs[rootDir]) {
if (knownRootDirs.has(rootDir)) {
rootDir = `${rootDir}:${index}`;
}

knownRootDirs[rootDir] = true;
knownRootDirs.add(rootDir);
project.name = crypto
.createHash('md5')
.update(rootDir)
Expand Down

0 comments on commit 44aa91d

Please sign in to comment.