busterjs / grunt-buster

Grunt task for running Buster.JS tests in Node.js or headless in PhantomJS
MIT License
35 stars 14 forks source link

Task "buster" failed. Use --force to continue. #6

Closed lovehandle closed 11 years ago

lovehandle commented 12 years ago

I seem to be having an issue that I'm having trouble debugging.

My grunt.js config file looks like this:

module.exports = function () {
  grunt.initConfig({
    buster: {
      test: {
        config: "./test/buster.js"
      },
      server: {
        port: '1111'
      }
    }
  });

  grunt.loadNpmTasks('grunt-buster');  
};

When I run grunt buster I get the following error:

Running "buster" task
<WARN> Task "buster" failed. Use --force to continue. </WARN>

Aborted due to warnings.

Verbose looks like this:

» grunt buster --verbose

Initializing
Command-line options: --verbose

Registering built-in tasks.
Loading "concat.js" tasks and helpers...OK
Tasks: concat
Helpers: concat
Loading "init.js" tasks and helpers...OK
Tasks: init
Helpers: prompt, prompt_for_obj, prompt_for, git_origin, github_web_url
Loading "lint.js" tasks and helpers...OK
Tasks: lint
Helpers: lint
Loading "min.js" tasks and helpers...OK
Tasks: min
Helpers: uglify, gzip, min_max_info
Loading "misc.js" tasks and helpers...OK
Helpers: config, json, strip_banner, file_strip_banner, file_template, banner
Loading "qunit.js" tasks and helpers...OK
Tasks: qunit
Helpers: phantomjs
Loading "server.js" tasks and helpers...OK
Tasks: server
Loading "test.js" tasks and helpers...OK
Tasks: test
Loading "watch.js" tasks and helpers...OK
Tasks: watch

Reading "grunt.js" config file...OK
Initializing config...OK
Reading package.json...OK
Parsing package.json...OK

Registering "grunt-buster" local Npm module tasks.
Reading /Users/ryan/Code/backbone.validate/node_modules/grunt-buster/package.json...OK
Parsing /Users/ryan/Code/backbone.validate/node_modules/grunt-buster/package.json...OK
Loading "buster.js" tasks and helpers...OK
Tasks: buster
Loading "grunt.js" tasks and helpers...OK
Tasks: default

Running tasks: buster

Running "buster" task
buster-server stopped
<WARN> Task "buster" failed. Use --force to continue. </WARN>

Aborted due to warnings.
--------------------------

Any ideas as to what might be the issue, or where I might look to debug the task?

thedersen commented 12 years ago

Can you run Buster successfully without grunt (from the same directory you run grunt)?

lovehandle commented 12 years ago

Yes, buster test works without issue:

» buster test
  Chrome 22.0.1229.79, OS X: .                                                                                
  1 test case, 1 test, 1 assertion, 0 failures, 0 errors, 0 timeouts
  Finished in 0.006s

It's only when I run grunt buster that it fails:

» grunt buster
  Running "buster" task
  <WARN> Task "buster" failed. Use --force to continue. </WARN>

  Aborted due to warnings.
thedersen commented 12 years ago

Hmm, where is your buster.js file stored? ATM it needs to be in the same directory as your grunt file.

lovehandle commented 12 years ago

Initially I had buster.js stored in my test directory, but I moved it to my root folder after reading that this wasn't supported.

The directory looks like this:

.
├── README.md
├── buster.js
├── grunt.js
├── lib
│   ├── backbone-1.9.2.js
│   ├── jquery-1.8.1.js
│   └── underscore-1.3.3.js
├── node_modules
├── package.json
├── src
│   └── appname.coffee
└── test
    └── general.js
thedersen commented 12 years ago

What's the output if you run grunt with the debug og verbose flag?

lovehandle commented 12 years ago

Interesting... I didn't see the debug flag on grunt. That would have been useful.

The error backtrace for grunt --debug 9 --verbose looks like this:

Running "buster" task
buster-server stopped
<WARN> Task "buster" failed. Use --force to continue. </WARN>
Error
    at /usr/local/share/npm/lib/node_modules/grunt/lib/util/task.js:47:25
    at Object.<anonymous> (/usr/local/share/npm/lib/node_modules/grunt/lib/util/task.js:390:2)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Object.<anonymous> (/usr/local/share/npm/lib/node_modules/grunt/lib/grunt/utils.js:17:14)
    at Module._compile (module.js:449:26)
thedersen commented 12 years ago

Will need to look into this. What version of buster and grunt are you running? Are they installed globally?

myme commented 11 years ago

@rclosner: I've noticed that grunt-buster dies without any warnings if buster-server is not able to start. More specifically, if you are running buster-server in a separate process while trying to run grunt buster. Of course it might be that in https://github.com/busterjs/grunt-buster/issues/6#issuecomment-8953973 you only gave a partial CLI copy-paste, but there you ran buster test without any mention of the server. Which could be because you were running the server on the side?

Even if this isn't @rclosner's issue, it would be useful with a descriptive error message if the buster grunt task is not able to start the server.

jodal commented 11 years ago

Errors in buster server are now displayed by Grunt, so this should be easier to debug next time.

As far as I can tell, this issue was probably caused by buster server already running, and occupying port 1111, before grunt buster was executed. Please reopen if this is still an issue.