title: Module <rootDir>/node_modules/jest-preset-angular/preprocessor.js in the transform option was not found
body: <p>When switching from karma-jasmine to jest for my Angular 7 application, I am getting the following error :</p>
  
  <pre><code>Validation Error:
  
    Module &lt;rootDir&gt;/node_modules/jest-preset-angular/preprocessor.js in the transform option was not found.
           &lt;rootDir&gt; is: C:\newAdminJestTest\jest-angular-example
  
    Configuration Documentation:
    https://jestjs.io/docs/configuration.html
  </code></pre>
  
  <p>I have been following this guide for the switch : <a href="https://blog.skarby.info/jest-with-angular/" rel="noreferrer">https://blog.skarby.info/jest-with-angular/</a></p>
  
  <p>The test cases seem to run fine if I remove the transform attribute from the jest object in <code>package.json</code>. However, I get the above error when running with the transform attribute. </p>
  
  <p>Here is my <strong>package.json</strong> :</p>
  
  <pre><code>{
    "name": "jest-angular-example",
    "version": "0.0.0",
    "scripts": {
      "ng": "ng",
      "start": "ng serve",
      "build": "ng build",
      "test": "jest",
      "test:watch": "jest --watch",
      "test:ci": "jest -ci --runInBand",
      "lint": "ng lint",
      "e2e": "ng e2e"
    },
    "private": true,
    "dependencies": {
      "@angular/animations": "~7.2.0",
      "@angular/common": "~7.2.0",
      "@angular/compiler": "~7.2.0",
      "@angular/core": "~7.2.0",
      "@angular/forms": "~7.2.0",
      "@angular/platform-browser": "~7.2.0",
      "@angular/platform-browser-dynamic": "~7.2.0",
      "@angular/router": "~7.2.0",
      "@types/jest": "^24.0.13",
      "core-js": "^2.5.4",
      "rxjs": "~6.3.3",
      "tslib": "^1.9.0",
      "zone.js": "~0.8.26"
    },
    "devDependencies": {
      "@angular-builders/jest": "^8.0.1",
      "@angular-devkit/build-angular": "~0.13.0",
      "@angular/cli": "~7.3.7",
      "@angular/compiler-cli": "~7.2.0",
      "@angular/language-service": "~7.2.0",
      "@types/jsdom": "^12.2.3",
      "@types/node": "~8.9.4",
      "babel-preset-env": "^1.7.0",
      "codelyzer": "~4.5.0",
      "jest": "^24.8.0",
      "jest-createspyobj": "^1.2.2",
      "jest-preset-angular": "^7.1.1",
      "protractor": "~5.4.0",
      "ts-node": "~7.0.0",
      "tslint": "~5.11.0",
      "typescript": "~3.2.2"
    },
    "jest": {
      "preset": "jest-preset-angular",
      "setupFilesAfterEnv": [
        "&lt;rootDir&gt;/src/setupJest.ts"
      ],
      "transform": {
        "^.+\\.(ts|html)$": "&lt;rootDir&gt;/node_modules/jest-preset-angular/preprocessor.js",
        "^.+\\.js$": "babel-jest"
      }
    }
  }
  
  </code></pre>
  
  <p>This is my <strong>setupJest.ts</strong> : </p>
  
  <pre><code>import 'jest-preset-angular';
  import './jestGlobalMocks.ts';
  </code></pre>
  
  <p>This is the <strong>jestGlobalMocks.ts</strong> :</p>
  
  <pre><code>global['CSS'] = null;
  
  const mock = () =&gt; {
    let storage = {};
    return {
      getItem: key =&gt; key in storage ? storage[key] : null,
      setItem: (key, value) =&gt; storage[key] = value || '',
      removeItem: key =&gt; delete storage[key],
      clear: () =&gt; storage = {},
    };
  };
  
  Object.defineProperty(window, 'localStorage', {value: mock()});
  Object.defineProperty(window, 'sessionStorage', {value: mock()});
  Object.defineProperty(document, 'doctype', {
    value: '&lt;!DOCTYPE html&gt;'
  });
  Object.defineProperty(window, 'getComputedStyle', {
    value: () =&gt; {
      return {
        display: 'none',
        appearance: ['-webkit-appearance']
      };
    }
  });
  /**
   * ISSUE: https://github.com/angular/material2/issues/7101
   * Workaround for JSDOM missing transform property
   */
  Object.defineProperty(document.body.style, 'transform', {
    value: () =&gt; {
      return {
        enumerable: true,
        configurable: true,
      };
    },
  });
  </code></pre>
  
  <p>My <strong>tsconfig.spec.json</strong> :</p>
  
  <pre><code>{
    "extends": "../tsconfig.json",
    "compilerOptions": {
      "outDir": "../out-tsc/spec",
      "module": "commonjs",
      "types": [
        "node",
        "jest",
        "jsdom"
      ]
    },
    "files": [
      "polyfills.ts"
    ],
    "include": [
      "**/*.spec.ts",
      "**/*.d.ts"
    ]
  }
  
  </code></pre>
  
  <p>I am expecting to see the following result :</p>
  
  <pre><code>PS C:\newAdminJestTest\jest-example-master&gt; npm run test
  
  &gt; jest-example@0.0.0 test C:\newAdminJestTest\jest-example-master
  &gt; jest
  
   PASS  src/app/store/todolist.effects.spec.ts (16.555s)
   PASS  src/app/app.component.spec.ts (16.836s)
   PASS  src/app/store/todolist.reducer.spec.ts
   PASS  src/app/item-list/item/item.component.spec.ts (18.045s)
   PASS  src/app/store/todolist.actions.spec.ts
   PASS  src/app/item-list/item-list.component.spec.ts
   PASS  src/app/pie-chart/pie-chart.component.spec.ts
   PASS  src/app/checkbox/checkbox.component.spec.ts
   PASS  src/app/local-storage.service.spec.ts
   PASS  src/app/window.service.spec.ts
  
  Test Suites: 10 passed, 10 total
  Tests:       68 passed, 68 total
  Snapshots:   1 passed, 1 total
  Time:        28.776s
  Ran all test suites.
  </code></pre>
  
  <p>which I am getting if I remove the <code>transform</code> attribute from the <code>jest</code> object in <code>package.json</code>.</p>
  
  <p>How do I solve this issue ?</p>