Skip to content
This repository has been archived by the owner on Jul 17, 2022. It is now read-only.

Notification does not show after watch task fails #24

Closed
fcanache opened this issue Aug 6, 2013 · 7 comments
Closed

Notification does not show after watch task fails #24

fcanache opened this issue Aug 6, 2013 · 7 comments

Comments

@fcanache
Copy link

fcanache commented Aug 6, 2013

I have a simple watch task that runs all my tests when a change is detected on my source code. Not sure why, but after the watch finish running all my tests and a failure is detected ... the expected notification does not show up.

the setup of my watch is:

watch: {
    scripts: {
        files: ['js/src/**/*'],
        tasks: ['test'],
        options: {
            spawn: false
        }
    }
}

and for the notification I am using the basic default config.

Any help or hint here would great,

Thanks,

@dylang
Copy link
Owner

dylang commented Aug 7, 2013

Do you ever see notifications, or are they just not showing up when using watch?

Here's a simple test to see if notifications work...

Add this to your gruntfile

notify: {
  test: {
    options: {
      title: 'Hello world',
      message: 'fcanache sees notifications!'
    }
  }

First try this on the command line:

$ grunt notify

That should show that notification.

If that doesn't work then there's something wrong with your notification system setup.

If it does work then change your watch task to force a notification:

watch: {
  scripts: {
    files: ['js/src/**/*'],
    tasks: ['notify:test', 'test'],
    options: {
    spawn: false
    }
  }
}

And see if notifications show when you make changes.

BTW - what does test run?

@fcanache
Copy link
Author

fcanache commented Aug 7, 2013

test runs all my jasmine unit tests.

Thanks for the response!

So, I followed your suggestions and everything worked ok. I was able to get a notification that said: "fcanache sees notifications!".

Actually, what I was actually trying to get working was ... right after my test task runs ... I want to get notifications with any errors or even a single notification that something is wrong with my unit test would be nice. Right now, if I do just: $ grunt test ... it works perfect! ... the issue is when I do $ grunt watch. As soon as the watch detects a change on my files ... it triggers test as expected ... but if an error is found on my tests I don't get the notification saying that something is not ok. Not sure why I would get notify of errors if I directly do $ grunt test and not when I rely on the watch. Any clue about it?

Thanks,

@dylang
Copy link
Owner

dylang commented Aug 18, 2013

I just released Grunt-Notify 0.2.8 - it should hopefully address this issue. Let me know if you run into this again or other issues. Thanks for your support.

@dylang dylang closed this as completed Aug 18, 2013
@leigeber
Copy link

leigeber commented Oct 8, 2013

Wanted to chime in that I am having the same issue using the latest version. Specific notifications work but I don't get any error notifications (Growl on Windows). The following is an example of a watch task which if it compiles fine I get the notice I point to, otherwise the error only prints to command line and not Growl.

watch: {
        css: {
            options: {
                spawn: false
            },
            files: [
                'assets/css/**/*.less'
            ],
            tasks: [
                'less:all',
                'notify:css'
            ]
        }
}

@vict-shevchenko
Copy link

Here the problem is in spawn: false, grunt-watch suppres error and warning events, so in command line you`ll see only

Warning:
but not
Warning: Use --force to continue.Aborted due to warnings. and notification miss this.
So if you can, just remove 'spawn'.
In my case, i need to save context of task with its subtasks, so I am not able to remove 'spawn'. So for me +1 for show all (err/warn/success) notifications.

@leigeber
Copy link

leigeber commented Oct 8, 2013

Yes, makes sense. It would be nice if the two could somehow work together but this is helpful. Thanks.

@krasnoperov
Copy link

Hello!

I just created new thread for latest issue: #39

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

No branches or pull requests

5 participants