Skip to content
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

TypeError: Cannot read property 'result' of undefined in grunt watch #9

Open
maksimr opened this issue Feb 18, 2013 · 6 comments
Open

Comments

@maksimr
Copy link

maksimr commented Feb 18, 2013

Hello! I have a problem with grunt watch and grunt-jasmine-node.
When I run grunt watch and change some files first run grunt-jasmine-node is ok, but
second fails with error 'TypeError'.

Any suggestions?

Thanks!

grunt.js:

    grunt.initConfig({
        jasmine_node: {
            projectRoot: './test'
        },
        ...
        watch: {
            files: '<config:lint.files>',
            tasks: 'jasmine_node'
        }
    });

trace:

Running "watch" task
Waiting...
timers.js:103
if (!process.listeners('uncaughtException').length) throw e;
^
  TypeError: Cannot read property 'result' of undefined
  at Object.jasmineNode.TerminalVerboseReporter.buildMessagesFromResults_ (/home/{project}/node_modules/grunt-jasmine-node/node_modules/jasmine-node/lib/jasmine-node/reporter.js:241:25)
  at Object.jasmineNode.TerminalVerboseReporter.buildMessagesFromResults_ (/home/{project}/node_modules/grunt-jasmine-node/node_modules/jasmine-node/lib/jasmine-node/reporter.js:253:14)
  at Object.jasmineNode.TerminalVerboseReporter.reportRunnerResults (/home/{project}/node_modules/grunt-jasmine-node/node_modules/jasmine-node/lib/jasmine-node/reporter.js:217:12)
  at null.reportRunnerResults (/home/{project}/node_modules/grunt-jasmine-node/node_modules/jasmine-node/lib/jasmine-node/jasmine-1.3.1.js:1788:39)
  at jasmine.Runner.finishCallback (/home/{project}/node_modules/grunt-jasmine-node/node_modules/jasmine-node/lib/jasmine-node/jasmine-1.3.1.js:2160:21)
  at null.onComplete (/home/{project}/node_modules/grunt-jasmine-node/node_modules/jasmine-node/lib/jasmine-node/jasmine-1.3.1.js:2144:10)
  at jasmine.Queue.next_ (/home/{project}/node_modules/grunt-jasmine-node/node_modules/jasmine-node/lib/jasmine-node/jasmine-1.3.1.js:2106:14)
  at onComplete (/home/{project}/node_modules/grunt-jasmine-node/node_modules/jasmine-node/lib/jasmine-node/jasmine-1.3.1.js:2092:18)
  at jasmine.Suite.finish (/home/{project}/node_modules/grunt-jasmine-node/node_modules/jasmine-node/lib/jasmine-node/jasmine-1.3.1.js:2478:5)
at null.onComplete (/home/{project}/node_modules/grunt-jasmine-node/node_modules/jasmine-node/lib/jasmine-node/jasmine-1.3.1.js:2522:10)

Tests files locate in './test' directory:

test/
     test_spec.js
@s9tpepper
Copy link
Member

I don't really use grunt.watch so I haven't run into this.
Do you have a test project or something I can look at? Like a repo or something?

@maksimr
Copy link
Author

maksimr commented Apr 21, 2013

https://github.com/maksimr/grunt-jasmine-issue

Now it fail with other Error. Test fail but grunt write that 'Done, without errors.'

@drouillard
Copy link

@maksimr I ran into a similar issue when trying to run this plugin alongside an express plugin that required the nospawn option to be specified when using watch.

I found another grunt plugin that worked for me

https://github.com/tmtk75/grunt-contrib-jasmine-node

Might work as a temporary workaround for you until this issue is closed.

@dnephin
Copy link

dnephin commented Dec 31, 2013

It looks like grunt-contrib-jasmine-node is now deprecated (according to that link).

I've run into this problem as well (this task with grunt-contrib-watch and spawn option set to false). The first run is fine (tests pass), the second and following runs it is trying to run the entire test suite multiple times (3 times on the second run, 5+ on the third, etc).

I've been able to set the grunt-contrib-watch spawn option to true for now, but that is noticeably slower, so I would like to disable it again. It sounds like the issue is this task holding onto some global references between runs?

@dnephin
Copy link

dnephin commented Dec 31, 2013

Note: pr #34 fixes this problem

@s9tpepper
Copy link
Member

I merged PR #15 which had multi task support and fixed for CoffeeScript, I am not sure that it also fixed these issues with watch. I will set up a project tomorrow and test if #15 also fixes it like #34 did, if not I'll look through PR #34 and see what else was changed there to fix the issue when using watch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants