tacoss / grunt-nightwatch

Run your Nightwatch.js tests with Grunt
50 stars 22 forks source link

Problem with targets #49

Closed jpablo closed 9 years ago

jpablo commented 9 years ago

Hi, I'm struggling defining targets that override the default options attribute:

nightwatch: {
            options: {
               globals: { x: 1 }
            },
            a: {
                options: {
                    globals: {x:2}
                }
            }
}

I.e., running grunt nightwatch:a doesn't seem to have any effect. I still get browser.globals.x === 1.

Is this a known limitation?

pateketrueke commented 9 years ago

Actually the current merge strategy is not well defined to cover all cases.

However I think you can use the following:

nightwatch: {
  options: {
    globals: { x: 1 }
  },
  a: {
    globals: { x: 2 }
  }
}

Let me know if that works for you.

If not, please test against the develop branch and share your results.

jpablo commented 9 years ago

It worked, thanks!

jpablo commented 9 years ago

Well, it kind of works. If I don't put the key in nightwatch.options.globals then it gets used with grunt nightwatch:a. At least I can have multiple tasks, albeit no default one.

nightwatch: {
  options: {
    globals: {  }
  },
  a: {
    globals: { x: 2 }
  }
}