ngbp / spell-karma

An addon to add Karma unit testing support to the Warlock spell for managing client-side webapps.
MIT License
1 stars 1 forks source link

fix(browsers): add PhantomJS as default browser #1

Open Merott opened 10 years ago

Merott commented 10 years ago

If no browser is specified by the user, the karma task will not run, getting stuck at Starting Karma Server.

Make PhantomJS the default browser to use.

joshdmiller commented 10 years ago

That's true. I meant to add a warning message and a default failure without a browsers key being present. Karma isn't saying anything because I turned up the logging level - it was polluting the Warlock output with a lot of useless junk.

The consequence of specifying a default is that, because it's an array, it cannot be overwritten by the user - it can only be appended to. So if a user specifies Firefox it will run Karma on both browsers.

I'd like to be able to override the merging functionality, but I can't figure out how to signal that in a JSON-friendly way. e.g. this is ugly:

{
  "globs": {
    "source": {
      "js": [
        "$overwrite",
        "my/replacement/glob"
      ]
    }
  },
  "tasks": {
    "karma": {
      "single-run": {
        "$overwrite": true,
        "..."
      }
    }
  }
}

And this is so detached as to be confusing:

{
  "globs": {
    "source": {
      "js": [
        "my/replacement/glob"
      ]
    }
  },
  "config": {
    "no-merge": [
      "globs.source.js"
    ]
  }
}

Anyway, I don't think it's necessarily a problem to run on PhantomJS too, but I wanted to call it out as a reality. If we're good with that, I'll happily merge. Thanks!

Merott commented 10 years ago

I see!

Actually, personally I'd prefer to be able to override the default and would find it inconvenient not to be able to. So if you ask me, don't merge this PR, until it's possible to overwrite configs :)

I noticed you mentioned the lack of functionality to completely overwrite a config in the Wiki as well. I think I may have a cleaner solution for replacing configs while still being able to merge. That's a topic of its own, belonging to a repository of its own, so, here is my proposed solution.