Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

feature request: mocha adapter support #35

Closed

Description

@steve-baer

Would love to see this supported. Currently we are experimenting with using protractor as a library for our mocha tests; thank you, included code example ;)

If there is some high-level conceptual understanding that someone could present that would describe how to accomplish this, I would love to fork this and do it myself. Some guidance as to the right direction to head would be awesome, if anyone has any ideas.

Activity

  1. juliemr commented on Jul 22, 2013

    @juliemr
    Contributor

    Hello,

    I assume you saw examples/onMocha.js? It requires a bit more setup (if you look into the test file, you'll see that it has to build its own webdriver).

    There are a couple things missing for good mocha integration. First, there's an adapter for Jasmine that allows expectations to be called directly on webdriver promises expect(myPromise).toEqual('foo'). This currently won't work for Mocha, so an adapter for one of Mocha's assertion libraries to work with promises would be nice.

    The other missing bit would be a way to run it directly from the command line and with a configuration file (so your tests are separate from the configuration), but I'm not sure if that's what you're asking for.

  2. steve-baer commented on Jul 22, 2013

    @steve-baer
    Author

    I did; using that example as a sort of base to model after, and so far so good.

    I would like to be able to use the Chai assertion library instead of Jasmine; our unit tests are Mocha/Chai, so having one less library for our developers to learn would be fantastic. The additional setup required in the current implementation (including Protractor and wrapping the driver) isn't an issue right now, but having things abstracted out and being able to use Protractor directly would be highly desired.

  3. kburson commented on Aug 6, 2013

    @kburson

    +1 on this.
    I am working on integrating protractor with our project. We use grunt with karma, mocha, chai for our unit/integration (midway) tests already. That is working fine. I want to move away from karma-ng-scenario for e2e and use protractor. The bonus is if we could use mocha+chai through all levels of testing.

    I have some time this week to work on this if someone is willing to join me.

  4. jamestalmage commented on Aug 15, 2013

    @jamestalmage

    As for promise adapters. I've done some preliminary work on one:
    https://github.com/promise-testing/promise-testing

    It has chai+mocha support built in.

    I have been dogfooding it for a few months, and it works.

  5. rweng commented on Oct 28, 2013

    @rweng

    nice, +1

  6. juliemr commented on Dec 27, 2013

    @juliemr
    Contributor

    Some early work done in 478c00a

    Please check it out and see if it works for your project! The big problem is that it does not include an adapter for assertions yet - so you will have to resolve promises manually.

  7. juliemr commented on Dec 28, 2013

    @juliemr
    Contributor

    After a little more research, got mocha working using Chai As Promised for assertions. Check out https://github.com/angular/protractor/blob/master/docs/using-mocha.md for info on how-to.

    Closing this issue - but please, give it a shot and open others if you find problems!

  8. jamestalmage commented on Dec 28, 2013

    @jamestalmage
  9. demisx commented on Sep 7, 2014

    @demisx

    The updated URL for using the awesome Mocha/Chai framework with protractor appears to be https://github.com/angular/protractor/blob/master/docs/frameworks.md#using-mocha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions