using javascript generators with mocha

I have a generator function that I am trying to unit test. The function I am testing takes a generator as a method argument too.

I can run mocha --harmony so it runs the tests however, I have put a generator function in my test file which will be the function I will pass to the function I am testing but mocha throws an error saying it does not understand * on my test file.

For example,

    function mytestgenerator() * {
        return "next gen"
    }

    describe('my app', function () {
        describe('important method', function () {
            it('should return -1', function () {
                var result = sut(mytestgenerator);
            })
        })
    })


/Users/jonathan/Projects/myapp/test/index_spec.js:9
function mytestgenerator() * {
               ^
SyntaxError: Unexpected token *

The * is in the wrong place for a generator function.

It should be just after the function keyword, before the name or parameters.

function * mytestgenerator() {
    return "next gen";
}

If it still isn't recognized, make sure you're using Node 0.11 or later, as --harmony doesn't include generators in previous versions.