Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to combine .use functionality with mocha-generators? #41

Open
leimonio opened this issue Aug 28, 2017 · 0 comments
Open

Comments

@leimonio
Copy link

I would like to extract assertion functionality to separate helper functions. I'm already using mocha-generators and I'd like to implement the following case:

Assume we have a shared function like below:

function sharedFn(params) {
    return function* (nightmare) {
        yield nightmare.wait(1000) (...some functionality here)
    }
}

The snippet below works:

...
it('should combine use with a generator', function* () {
    yield nightmare.wait(1000)
    yield* sharedFn(params)(nightmare)
})
...

But how can I implement it with .use, like:

...
it('should combine use with a generator', function* () {
    yield nightmare
    .wait(1000)
    .use(sharedFn(params))
})
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant