Skip to content

Can't run ng test with @ngtools/webpack 1.3.2 #6457

Closed
@eng-almeida

Description

@eng-almeida

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

                             _                           _  _
  __ _  _ __    __ _  _   _ | |  __ _  _ __         ___ | |(_)
 / _` || '_ \  / _` || | | || | / _` || '__|_____  / __|| || |
| (_| || | | || (_| || |_| || || (_| || |  |_____|| (__ | || |
 \__,_||_| |_| \__, | \__,_||_| \__,_||_|          \___||_||_|
               |___/
@angular/cli: 1.0.0-beta.29
node: 6.10.1
os: darwin x64
@angular/common: 2.4.8
@angular/compiler: 2.4.8
@angular/core: 2.4.8
@angular/forms: 2.4.8
@angular/http: 2.4.8
@angular/platform-browser: 2.4.8
@angular/platform-browser-dynamic: 2.4.8
@angular/router: 3.4.8
@angular/cli: 1.0.0-beta.29
@angular/compiler-cli: 2.4.8

Repro steps.

After doing a clean npm install, run:
ng test --single-run

The log given by the failure.

25 05 2017 15:00:18.993:ERROR [preprocess]: Can not load "webpack"!
  TypeError: Cannot read property 'plugin' of undefined
    at PathsPlugin.apply (/Users/joaoalmeida/MyProj/xxx/node_modules/@ngtools/webpack/src/paths-plugin.js:68:18)
    at Resolver.apply (/Users/joaoalmeida/MyProj/xxx/node_modules/tapable/lib/Tapable.js:306:16)
    at /Users/joaoalmeida/MyProj/xxx/node_modules/enhanced-resolve/lib/ResolverFactory.js:246:12
    at Array.forEach (native)
    at Object.exports.createResolver (/Users/joaoalmeida/MyProj/xxx/node_modules/enhanced-resolve/lib/ResolverFactory.js:245:10)
    at WebpackOptionsApply.process (/Users/joaoalmeida/MyProj/xxx/node_modules/webpack/lib/WebpackOptionsApply.js:282:46)
    at webpack (/Users/joaoalmeida/MyProj/xxx/node_modules/webpack/lib/webpack.js:36:48)
    at new Plugin (/Users/joaoalmeida/MyProj/xxx/node_modules/karma-webpack/lib/karma-webpack.js:63:18)
    at invoke (/Users/joaoalmeida/MyProj/xxx/node_modules/di/lib/injector.js:75:15)
    at Array.instantiate (/Users/joaoalmeida/MyProj/xxx/node_modules/di/lib/injector.js:59:20)
    at get (/Users/joaoalmeida/MyProj/xxx/node_modules/di/lib/injector.js:48:43)
    at /Users/joaoalmeida/MyProj/xxx/node_modules/di/lib/injector.js:71:14
    at Array.map (native)
    at Array.invoke (/Users/joaoalmeida/MyProj/xxx/node_modules/di/lib/injector.js:70:31)
    at Injector.get (/Users/joaoalmeida/MyProj/xxx/node_modules/di/lib/injector.js:48:43)
    at instantiatePreprocessor (/Users/joaoalmeida/MyProj/xxx/node_modules/karma/lib/preprocessor.js:55:20)
    at /Users/joaoalmeida/MyProj/xxx/node_modules/karma/lib/preprocessor.js:106:17
    at Array.forEach (native)
    at /Users/joaoalmeida/MyProj/xxx/node_modules/karma/lib/preprocessor.js:103:27
    at module.exports (/Users/joaoalmeida/MyProj/xxx/node_modules/karma/node_modules/isbinaryfile/index.js:28:12)
    at /Users/joaoalmeida/MyProj/xxx/node_modules/karma/lib/preprocessor.js:84:7
    at /Users/joaoalmeida/MyProj/xxx/node_modules/graceful-fs/graceful-fs.js:78:16
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:446:3)
25 05 2017 15:00:19.032:INFO [karma]: Karma v1.2.0 server started at http://localhost:9876/
25 05 2017 15:00:19.032:INFO [launcher]: Launching browser Chrome with unlimited concurrency
25 05 2017 15:00:19.033:ERROR [karma]: Found 1 load error

Desired functionality.

Should run unit tests

Mention any other details that might be useful.

I believe this issue might be related to the last updated on ngtools/webpack . Specifically from version 1.3.1 to 1.3.2.

Package.json from my project

{
  "name": "###",
  "version": "0.0.1",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "start": "ng serve",
    "lint": "tslint \"src/**/*.ts\"",
    "test": "ng test",
    "pree2e": "webdriver-manager update",
    "e2e": "protractor"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "2.4.8",
    "@angular/compiler": "2.4.8",
    "@angular/core": "2.4.8",
    "@angular/forms": "2.4.8",
    "@angular/http": "2.4.8",
    "@angular/platform-browser": "2.4.8",
    "@angular/platform-browser-dynamic": "2.4.8",
    "@angular/router": "3.4.8",
    "@ngrx/core": "1.2.0",
    "@ngrx/effects": "2.0.0",
    "@ngrx/store": "2.2.1",
    "@ngrx/store-devtools": "3.2.2",
    "angular2-recaptcha": "^0.3.7",
    "angular2-text-mask": "^4.1.0",
    "bulma": "0.2.3",
    "core-js": "2.4.1",
    "ng2-file-upload": "1.2.0",
    "ng2-translate": "5.0.0",
    "oidc-token-manager": "1.2.0",
    "rxjs": "5.0.3",
    "ts-helpers": "1.1.2",
    "typescript": "2.0.10",
    "web-animations-js": "2.2.2",
    "zone.js": "0.7.2"
  },
  "devDependencies": {
    "@angular/cli": "1.0.0-beta.29",
    "@angular/compiler-cli": "2.4.8",
    "@types/chai": "3.4.34",
    "@types/isomorphic-fetch": "0.0.32",
    "@types/jasmine": "2.5.41",
    "@types/node": "7.0.3",
    "azure-storage": "1.3.2",
    "codelyzer": "2.0.0-beta.4",
    "faker": "^4.1.0",
    "jasmine-core": "2.4.1",
    "jasmine-reporters": "^2.2.0",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "2.0.0",
    "karma-cli": "1.0.1",
    "karma-coverage": "1.1.1",
    "karma-jasmine": "1.0.2",
    "karma-remap-istanbul": "0.2.1",
    "karma-teamcity-reporter": "1.0.0",
    "node-sass": "3.7.0",
    "protractor": "5.1.0",
    "react": "15.4.2",
    "react-redux": "5.0.2",
    "redux": "3.6.0",
    "redux-devtools": "3.3.2",
    "remap-istanbul": "0.6.4",
    "string-replace-loader": "1.0.3",
    "ts-node": "1.2.1",
    "tslint": "4.3.1",
    "webdriver-manager": "10.2.5",
    "webpack": "~2.2.1"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions