FountainJS / generator-fountain-webapp

Yeoman 'fountain' generator to start a webapp
http://fountainjs.io
MIT License
963 stars 67 forks source link

Tests failing when TypeScript target is set to "es6" (Angular 1 & 2) #60

Open fdcastel opened 8 years ago

fdcastel commented 8 years ago

Description

npm run test fails when TypeScript target is set to "es6".

For Angular 2: the tests run, although a lot of errors are shown.

Error Message & Stack Trace (Angular 1)

[03:37:00] Loading C:\Temp\tst-angular1-ts\gulp_tasks\browsersync.js
[03:37:00] Loading C:\Temp\tst-angular1-ts\gulp_tasks\karma.js
[03:37:01] Loading C:\Temp\tst-angular1-ts\gulp_tasks\misc.js
[03:37:01] Loading C:\Temp\tst-angular1-ts\gulp_tasks\partials.js
[03:37:01] Loading C:\Temp\tst-angular1-ts\gulp_tasks\webpack.js
[03:37:01] Using gulpfile C:\Temp\tst-angular1-ts\gulpfile.js
[03:37:01] Starting 'test'...
[03:37:01] Starting 'karma:single-run'...
ts-loader: Using typescript@1.8.10 and C:\Temp\tst-angular1-ts\tsconfig.json
27 06 2016 03:37:05.030:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
27 06 2016 03:37:05.030:INFO [launcher]: Starting browser PhantomJS
27 06 2016 03:37:06.459:INFO [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Connected on socket /#RlcLfswuA0JP0fgCAAAA with id 230
02180
PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
  SyntaxError: Unexpected token 'const'
  at C:/Temp/tst-angular1-ts/src/index.spec.js:102

PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
  ReferenceError: Can't find variable: angular
  at C:/Temp/tst-angular1-ts/src/app/footer.html.js:1

PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
  ReferenceError: Can't find variable: angular
  at C:/Temp/tst-angular1-ts/src/app/header.html.js:1

PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
  ReferenceError: Can't find variable: angular
  at C:/Temp/tst-angular1-ts/src/app/main.html.js:1

PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
  ReferenceError: Can't find variable: angular
  at C:/Temp/tst-angular1-ts/src/app/techs/tech.html.js:1

PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
  ReferenceError: Can't find variable: angular
  at C:/Temp/tst-angular1-ts/src/app/techs/techs.html.js:1

PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
  ReferenceError: Can't find variable: angular
  at C:/Temp/tst-angular1-ts/src/app/title.html.js:1

PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
  ReferenceError: Can't find variable: angular
  at C:/Temp/tst-angular1-ts/src/index.html.js:1

[03:37:06] 'karma:single-run' errored after 4.7 s
[03:37:06] Error: Failed 1 tests.
    at C:\Temp\tst-angular1-ts\gulp_tasks\karma.js:11:22
    at removeAllListeners (C:\Temp\tst-angular1-ts\node_modules\karma\lib\server.js:336:7)
    at Server.<anonymous> (C:\Temp\tst-angular1-ts\node_modules\karma\lib\server.js:347:9)
    at Server.g (events.js:273:16)
    at emitNone (events.js:85:20)
    at Server.emit (events.js:179:7)
    at emitCloseNT (net.js:1529:8)
    at _combinedTickCallback (node.js:380:13)
    at process._tickDomainCallback (node.js:431:11)
[03:37:06] 'test' errored after 4.73 s

Error Message & Stack Trace (Angular 2)

[03:39:21] Loading C:\Temp\tst-angular2-ts\gulp_tasks\browsersync.js
[03:39:21] Loading C:\Temp\tst-angular2-ts\gulp_tasks\karma.js
[03:39:22] Loading C:\Temp\tst-angular2-ts\gulp_tasks\misc.js
[03:39:22] Loading C:\Temp\tst-angular2-ts\gulp_tasks\webpack.js
[03:39:22] Using gulpfile C:\Temp\tst-angular2-ts\gulpfile.js
[03:39:22] Starting 'test'...
[03:39:22] Starting 'karma:single-run'...
ts-loader: Using typescript@1.8.10 and C:\Temp\tst-angular2-ts\conf\ts.conf.json
Hash: 6be75ed3fb8e1609af55
Version: webpack 2.1.0-beta.8
Time: 7300ms
            Asset     Size  Chunks             Chunk Names
src/index.spec.js  8.01 MB       0  [emitted]  src/index.spec.js
chunk    {0} src/index.spec.js (src/index.spec.js) 2.93 MB [rendered]
    [0] ./~/rxjs/Observable.js 6.03 kB {0} [built]
(... lines removed ...)
  [793] ./src/index.spec.js 128 bytes {0} [built]
  [794] util (ignored) 15 bytes {0}

ERROR in ./src/app/techs/techs.spec.ts
(5,43): error TS2307: Cannot find module '@angular/http/testing'.

ERROR in ./src/app/techs/techs.spec.ts
(6,67): error TS2307: Cannot find module '@angular/http'.

ERROR in ./src/app/techs/techs.spec.ts
(7,41): error TS2307: Cannot find module '@angular/core'.

ERROR in ./src/app/techs/techs.spec.ts
(10,72): error TS2307: Cannot find module '@angular/core/testing'.

ERROR in ./src/app/techs/techs.spec.ts
(11,54): error TS2307: Cannot find module '@angular/compiler/testing'.

ERROR in ./src/app/techs/techs.spec.ts
(13,26): error TS2307: Cannot find module 'rxjs/Rx'.

ERROR in ./src/app/techs/tech.spec.ts
(6,51): error TS2307: Cannot find module '@angular/core/testing'.

ERROR in ./src/app/techs/tech.spec.ts
(7,54): error TS2307: Cannot find module '@angular/compiler/testing'.

ERROR in ./src/app/title.spec.ts
(6,51): error TS2307: Cannot find module '@angular/core/testing'.

ERROR in ./src/app/title.spec.ts
(7,54): error TS2307: Cannot find module '@angular/compiler/testing'.

ERROR in ./src/app/techs/tech.ts
(1,32): error TS2307: Cannot find module '@angular/core'.

ERROR in ./src/app/title.ts
(1,25): error TS2307: Cannot find module '@angular/core'.

ERROR in ./src/app/techs/techs.ts
(1,25): error TS2307: Cannot find module '@angular/core'.

ERROR in ./src/app/techs/techs.ts
(2,36): error TS2307: Cannot find module '@angular/http'.

ERROR in ./src/app/techs/techs.ts
(3,26): error TS2307: Cannot find module 'rxjs/Observable'.

ERROR in ./src/app/main.ts
(1,25): error TS2307: Cannot find module '@angular/core'.

ERROR in ./src/app/main.spec.ts
(5,25): error TS2307: Cannot find module '@angular/core'.

ERROR in ./src/app/main.spec.ts
(11,73): error TS2307: Cannot find module '@angular/core/testing'.

ERROR in ./src/app/main.spec.ts
(12,54): error TS2307: Cannot find module '@angular/compiler/testing'.

ERROR in ./src/app/main.spec.ts
(13,89): error TS2307: Cannot find module '@angular/platform-browser/testing'.

ERROR in ./src/app/main.spec.ts
(14,45): error TS2307: Cannot find module '@angular/platform-browser-dynamic'.

ERROR in ./src/app/header.ts
(1,25): error TS2307: Cannot find module '@angular/core'.

ERROR in ./src/app/header.spec.ts
(6,51): error TS2307: Cannot find module '@angular/core/testing'.

ERROR in ./src/app/header.spec.ts
(7,54): error TS2307: Cannot find module '@angular/compiler/testing'.

ERROR in C:\Temp\tst-angular2-ts\typings\globals\es6-shim\index.d.ts
(3,14): error TS2300: Duplicate identifier 'PropertyKey'.

ERROR in C:\Temp\tst-angular2-ts\typings\globals\es6-shim\index.d.ts
(6,5): error TS2300: Duplicate identifier 'done'.

ERROR in C:\Temp\tst-angular2-ts\typings\globals\es6-shim\index.d.ts
(7,5): error TS2300: Duplicate identifier 'value'.

ERROR in C:\Temp\tst-angular2-ts\typings\globals\es6-shim\index.d.ts
(245,5): error TS2300: Duplicate identifier 'EPSILON'.

ERROR in C:\Temp\tst-angular2-ts\typings\globals\es6-shim\index.d.ts
(280,5): error TS2300: Duplicate identifier 'MAX_SAFE_INTEGER'.

ERROR in C:\Temp\tst-angular2-ts\typings\globals\es6-shim\index.d.ts
(287,5): error TS2300: Duplicate identifier 'MIN_SAFE_INTEGER'.

ERROR in C:\Temp\tst-angular2-ts\typings\globals\es6-shim\index.d.ts
(343,5): error TS2300: Duplicate identifier 'flags'.

ERROR in C:\Temp\tst-angular2-ts\typings\globals\es6-shim\index.d.ts
(495,5): error TS2300: Duplicate identifier 'prototype'.

ERROR in C:\Temp\tst-angular2-ts\typings\globals\es6-shim\index.d.ts
(558,5): error TS2300: Duplicate identifier 'size'.

ERROR in C:\Temp\tst-angular2-ts\typings\globals\es6-shim\index.d.ts
(567,5): error TS2300: Duplicate identifier 'prototype'.

ERROR in C:\Temp\tst-angular2-ts\typings\globals\es6-shim\index.d.ts
(578,5): error TS2300: Duplicate identifier 'size'.

ERROR in C:\Temp\tst-angular2-ts\typings\globals\es6-shim\index.d.ts
(587,5): error TS2300: Duplicate identifier 'prototype'.

ERROR in C:\Temp\tst-angular2-ts\typings\globals\es6-shim\index.d.ts
(602,5): error TS2300: Duplicate identifier 'prototype'.

ERROR in C:\Temp\tst-angular2-ts\typings\globals\es6-shim\index.d.ts
(616,5): error TS2300: Duplicate identifier 'prototype'.

ERROR in ./src/app/footer.spec.ts
(7,51): error TS2307: Cannot find module '@angular/core/testing'.

ERROR in ./src/app/footer.spec.ts
(8,54): error TS2307: Cannot find module '@angular/compiler/testing'.

ERROR in ./src/app/footer.ts
(1,25): error TS2307: Cannot find module '@angular/core'.

ERROR in C:\Temp\tst-angular2-ts\node_modules\typescript\lib\lib.es6.d.ts
(17,14): error TS2300: Duplicate identifier 'PropertyKey'.

ERROR in C:\Temp\tst-angular2-ts\node_modules\typescript\lib\lib.es6.d.ts
(237,5): error TS2300: Duplicate identifier 'EPSILON'.

ERROR in C:\Temp\tst-angular2-ts\node_modules\typescript\lib\lib.es6.d.ts
(272,5): error TS2300: Duplicate identifier 'MAX_SAFE_INTEGER'.

ERROR in C:\Temp\tst-angular2-ts\node_modules\typescript\lib\lib.es6.d.ts
(279,5): error TS2300: Duplicate identifier 'MIN_SAFE_INTEGER'.

ERROR in C:\Temp\tst-angular2-ts\node_modules\typescript\lib\lib.es6.d.ts
(565,5): error TS2300: Duplicate identifier 'done'.

ERROR in C:\Temp\tst-angular2-ts\node_modules\typescript\lib\lib.es6.d.ts
(566,5): error TS2300: Duplicate identifier 'value'.

ERROR in C:\Temp\tst-angular2-ts\node_modules\typescript\lib\lib.es6.d.ts
(795,5): error TS2300: Duplicate identifier 'flags'.

ERROR in C:\Temp\tst-angular2-ts\node_modules\typescript\lib\lib.es6.d.ts
(823,5): error TS2300: Duplicate identifier 'size'.

ERROR in C:\Temp\tst-angular2-ts\node_modules\typescript\lib\lib.es6.d.ts
(833,5): error TS2300: Duplicate identifier 'prototype'.

ERROR in C:\Temp\tst-angular2-ts\node_modules\typescript\lib\lib.es6.d.ts
(849,5): error TS2300: Duplicate identifier 'prototype'.

ERROR in C:\Temp\tst-angular2-ts\node_modules\typescript\lib\lib.es6.d.ts
(861,5): error TS2300: Duplicate identifier 'size'.

ERROR in C:\Temp\tst-angular2-ts\node_modules\typescript\lib\lib.es6.d.ts
(871,5): error TS2300: Duplicate identifier 'prototype'.

ERROR in C:\Temp\tst-angular2-ts\node_modules\typescript\lib\lib.es6.d.ts
(886,5): error TS2300: Duplicate identifier 'prototype'.

ERROR in C:\Temp\tst-angular2-ts\node_modules\typescript\lib\lib.es6.d.ts
(1282,5): error TS2300: Duplicate identifier 'prototype'.
27 06 2016 03:39:34.739:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
27 06 2016 03:39:34.755:INFO [launcher]: Starting browser Chrome
27 06 2016 03:39:36.373:INFO [Chrome 51.0.2704 (Windows 8.1 0.0.0)]: Connected on socket /#NXHH5GeDfSMopsQkAAAA with id
44621177
Chrome 51.0.2704 (Windows 8.1 0.0.0): Executed 7 of 7 SUCCESS (0.254 secs / 0.248 secs)
[03:39:37] Finished 'karma:single-run' after 14 s
[03:39:37] Finished 'test' after 15 s

Config (Angular 1)

Content from .yo-rc.json for Angular 1:

{
  "generator-fountain-angular1": {
    "version": "0.5.4",
    "props": {
      "framework": "angular1",
      "modules": "webpack",
      "js": "typescript",
      "css": "scss",
      "resolved": "C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\generator-fountain-webapp\\node_modules\\generator-fountain-angular1\\generators\\app\\index.js",
      "namespace": "fountain-angular1",
      "argv": {
        "remain": [],
        "cooked": [],
        "original": []
      },
      "skip-cache": false,
      "skip-install": false,
      "sample": "techs",
      "router": "none"
    }
  }
}

Config (Angular 2)

Content from .yo-rc.json for Angular 2:

{
  "generator-fountain-angular2": {
    "version": "0.5.4",
    "props": {
      "framework": "angular2",
      "modules": "webpack",
      "js": "typescript",
      "css": "scss",
      "resolved": "C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\generator-fountain-webapp\\node_modules\\generator-fountain-angular2\\generators\\app\\index.js",
      "namespace": "fountain-angular2",
      "argv": {
        "remain": [],
        "cooked": [],
        "original": []
      },
      "skip-cache": false,
      "skip-install": false,
      "sample": "techs",
      "router": "none"
    }
  }
}

Environment

Tell us which operating system you are using, as well as which versions of Node.js, npm, and yo.

Node.js v5.9.1 win32 6.3.9600 yo 1.8.4 npm 3.8.0

micaelmbagira commented 8 years ago

@fdcastel Is it fixed with latest version of generator-fountain-webapp 0.6.0 ?