Skip to content

gulp test:client returns Error: 1 at formatError #1748

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lydemann opened this issue Mar 28, 2016 · 9 comments
Closed

gulp test:client returns Error: 1 at formatError #1748

lydemann opened this issue Mar 28, 2016 · 9 comments
Assignees

Comments

@lydemann
Copy link

lydemann commented Mar 28, 2016

Item Version
generator-angular-fullstack 3.5.0
Node 5.5.0
npm 3.3.12
Operating System Windows 10
Item Answer
Transpiler TypeScript
Markup HTML
CSS SCSS
Router ui-router
Build Tool Gulp
Client Tests Jasmine
DB MongoDB
Auth Y

I just created a new project with the specified options. When i run "gulp test:client" I get the following error:

PhantomJS 2.1.1 (Windows 8 0.0.0): Executed 0 of 0 ERROR (0.001 secs / 0 secs)

[11:06:15] 'test:client' errored after 3.09 s
[11:06:15] Error: 1
at formatError (C:\Users\chris\Desktop\DemoMEAN\node_modules\gulp\bin\gulp.js:169:10)
at Gulp. (C:\Users\chris\Desktop\DemoMEAN\node_modules\gulp\bin\gulp.js:195:15)

@Awk34 Awk34 self-assigned this Mar 28, 2016
@Koslun
Copy link
Member

Koslun commented Apr 19, 2016

Getting the same error with similar setups.

Item Version
generator-angular-fullstack 3.5.0
Node 4.4.2
npm 3.3.6

Operating System: Ubuntu 15.10

Item Answer 1 Answer 2 Answer 3
Transpiler TypeScript TypeScript TypeScript
Markup HTML HTML HTML
CSS SCSS SCSS SCSS
Router ngRouter ngRouter UI-router
Build Tool Gulp Gulp Gulp
Client Tests Jasmine Mocha + Chai + Sinon Jasmine
DB Mongoose Mongoose Mongoose
Auth Y Y Y

Using Answer 2 but with ui-router and Grunt does however work for me.

Should probably also be mentioned that I for answer 1 & 2 manually added the same typings folders used in the grunt version before either configuration would work. Additionally removed

"client/components/ui-router/ui-router.mock.ts" ,

from tsconfig.client.json.

Answer 3 came to this state after running gulp serve once.

@Awk34 Awk34 added the bug label Apr 19, 2016
@Awk34
Copy link
Member

Awk34 commented Apr 20, 2016

I'm looking into this. Adding this option to karma helps: logLevel: 'debug'.

@Awk34
Copy link
Member

Awk34 commented Apr 20, 2016

First issue: './tsconfig.client.json' should be './tsconfig.client.test.json' here: gulpfile.babel(gulp).js#L318

@Koslun
Copy link
Member

Koslun commented Apr 20, 2016

@Awk34: Using the configuration labeled as "Answer 3" above and using the change you mentioned, the tests did now show up but they all fail because of some issue with transpilation I think.

The errors I'm getting now:

Component: mainComponent
     should attach a list of things to the controller
    /home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:4588:53
    forEach@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:322:24
    loadModules@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:4548:12
    createInjector@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:4470:30
    workFn@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular-mocks/angular-mocks.js:2954:60

    TypeError: undefined is not an object (evaluating 'mainComponent.$onInit') in /home/adam/apps/karma-fullstack-gulp/.tmp/test/app/main/main.controller.spec.js (line 25)
    /home/adam/apps/karma-fullstack-gulp/.tmp/test/app/main/main.controller.spec.js:25:22


  Controller: OauthButtonsCtrl
     should attach loginOauth
    /home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:4588:53
    forEach@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:322:24
    loadModules@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:4548:12
    createInjector@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:4470:30
    workFn@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular-mocks/angular-mocks.js:2954:60

    TypeError: undefined is not an object (evaluating 'OauthButtonsCtrl.loginOauth') in /home/adam/apps/karma-fullstack-gulp/.tmp/test/components/oauth-buttons/oauth-buttons.controller.spec.js (line 16)
    /home/adam/apps/karma-fullstack-gulp/.tmp/test/components/oauth-buttons/oauth-buttons.controller.spec.js:16:32


  Directive: oauthButtons
     should contain anchor buttons
    /home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:4588:53
    forEach@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:322:24
    loadModules@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:4548:12
    createInjector@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:4470:30
    workFn@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular-mocks/angular-mocks.js:2954:60

    /home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:4588:53
    forEach@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:322:24
    loadModules@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:4548:12
    createInjector@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:4470:30
    workFn@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular-mocks/angular-mocks.js:2954:60
    inject@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular-mocks/angular-mocks.js:2934:46
    compileDirective@/home/adam/apps/karma-fullstack-gulp/.tmp/test/components/oauth-buttons/oauth-buttons.directive.spec.js:8:15
    /home/adam/apps/karma-fullstack-gulp/.tmp/test/components/oauth-buttons/oauth-buttons.directive.spec.js:19:25

     should evaluate and bind the classes attribute to scope.classes
    /home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:4588:53
    forEach@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:322:24
    loadModules@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:4548:12
    createInjector@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:4470:30
    workFn@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular-mocks/angular-mocks.js:2954:60

    TypeError: Attempted to assign to readonly property. in /home/adam/apps/karma-fullstack-gulp/.tmp/test/components/oauth-buttons/oauth-buttons.directive.spec.js (line 23)
    /home/adam/apps/karma-fullstack-gulp/.tmp/test/components/oauth-buttons/oauth-buttons.directive.spec.js:23:20

     should bind scope.classes to class names on the anchor buttons
    /home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:4588:53
    forEach@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:322:24
    loadModules@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:4548:12
    createInjector@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:4470:30
    workFn@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular-mocks/angular-mocks.js:2954:60

    /home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:4588:53
    forEach@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:322:24
    loadModules@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:4548:12
    createInjector@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular/angular.js:4470:30
    workFn@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular-mocks/angular-mocks.js:2954:60
    inject@/home/adam/apps/karma-fullstack-gulp/client/bower_components/angular-mocks/angular-mocks.js:2934:46
    compileDirective@/home/adam/apps/karma-fullstack-gulp/.tmp/test/components/oauth-buttons/oauth-buttons.directive.spec.js:8:15
    /home/adam/apps/karma-fullstack-gulp/.tmp/test/components/oauth-buttons/oauth-buttons.directive.spec.js:28:25


PhantomJS 2.1.1 (Linux 0.0.0): Executed 5 of 5 (5 FAILED) ERROR (0.046 secs / 0.036 secs)

[20:12:47] 'test:client' errored after 645 ms
[20:12:47] Error: 1
    at formatError (/home/adam/.nvm/versions/node/v4.4.2/lib/node_modules/gulp-cli/lib/versioned/^3.7.0/formatError.js:20:10)
    at Gulp.<anonymous> (/home/adam/.nvm/versions/node/v4.4.2/lib/node_modules/gulp-cli/lib/versioned/^3.7.0/log/events.js:41:15)
    at emitOne (events.js:77:13)
    at Gulp.emit (events.js:169:7)
    at Gulp.Orchestrator._emitTaskDone (/home/adam/apps/karma-fullstack-gulp/node_modules/orchestrator/index.js:264:8)
    at /home/adam/apps/karma-fullstack-gulp/node_modules/orchestrator/index.js:275:23
    at finish (/home/adam/apps/karma-fullstack-gulp/node_modules/orchestrator/lib/runTask.js:21:8)
    at cb (/home/adam/apps/karma-fullstack-gulp/node_modules/orchestrator/lib/runTask.js:29:3)
    at removeAllListeners (/home/adam/apps/karma-fullstack-gulp/node_modules/karma/lib/server.js:336:7)
    at Server.<anonymous> (/home/adam/apps/karma-fullstack-gulp/node_modules/karma/lib/server.js:347:9)
    at Server.g (events.js:260:16)
    at emitNone (events.js:72:20)
    at Server.emit (events.js:166:7)
    at emitCloseNT (net.js:1521:8)
    at nextTickCallbackWith1Arg (node.js:431:9)
    at process._tickDomainCallback (node.js:394:17)

Looking into the .tmp folder after the tests have run the .tmp/test directory contains the same app and components folders that the non-test part does. Meaning it somehow ends with none of the test files still there and the regular source code in its place.

Will try with the aforementioned karma option as well.

@Awk34
Copy link
Member

Awk34 commented Apr 20, 2016

@Koslun This is what mine contains with your 'Options 1'
asdfddd

@Koslun
Copy link
Member

Koslun commented Apr 20, 2016

@Awk34 Yours does make a lot more sense, can't really find why my version doesn't look like it yet. Mine is like your .tmp/app folder. Will try to post a screen shot.

@Koslun
Copy link
Member

Koslun commented Apr 20, 2016

So here it is:
tmp-folder

EDIT: My grunt version does however look like the one you posted.

@Koslun
Copy link
Member

Koslun commented Apr 21, 2016

Looking at it again it's obvious that the test files are present with the main.controller.spec.js file present in the picture and others in the components folder not shown in the picture.

Deleting the .tmp folder I additionally found the old regular files gone.

The new errors I got were:

    Error: [$injector:modulerr] Failed to instantiate module karmaFullstackGulpOneApp due to:
    Error: [$injector:modulerr] Failed to instantiate module karmaFullstackGulpOneApp.auth due to:
    Error: [$injector:modulerr] Failed to instantiate module karmaFullstackGulpOneApp.constants due to:
    Error: [$injector:nomod] Module 'karmaFullstackGulpOneApp.constants' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

Solved by including '.tmp/app.constant.js', in the files array in karma.conf.js.

Where there is a difference between the gulp and grunt version, where the gulp version has this app.constant.js file and the grunt version does not.

@Koslun
Copy link
Member

Koslun commented Apr 21, 2016

@Awk34 Unless you already fixed this I made a PR that should fix the remaining issue the same way as my previous post outlines. See PR #1809.

Koslun added a commit to Koslun/generator-angular-fullstack that referenced this issue Apr 21, 2016
Fix a bug in gulp + typescript builds causing the test files to not be found by karma.

Relates to issue angular-fullstack#1748
@Awk34 Awk34 closed this as completed in a5e31cf Apr 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants