Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Proposal: API change #1

Open
bajtos opened this issue Dec 11, 2013 · 2 comments
Open

Proposal: API change #1

bajtos opened this issue Dec 11, 2013 · 2 comments

Comments

@bajtos
Copy link
Contributor

bajtos commented Dec 11, 2013

I am proposing two changes:

  1. Make this module a collection of utilities, i.e. move the current implementation out of /index.js into lib/ folder, change the way how the module is used:

    var lt = require('loopback-testing').TestCaseHelper;
    lt.describe(/* ... */)
    
    // this way I can add my new code as
    var TestDataBuilder = require('loopback-testing').TestDataBuilder;
    
  2. Add a function that will merge install describe/it/etc. as globals, possibly extending symbols already defined by Mocha.

    require('loopback-testing').mocha('bdd');
    // now I can write
    //   describe.whenCalledRemotely
    //   given.model('Product', /*.. */)

    Later we can implement support for other interfaces than bdd and possibly other test frameworks like TAP.

@ritch what's you opinion? What was the reason why you decided to not amend mocha's global symbols, as we discussed in the other pull request?

Perhaps the second point should be implemented by a standalone module depending on loopback-testing, e.g. loopback-mocha?

@ritch
Copy link
Contributor

ritch commented Dec 11, 2013

I couldn't consistently modify the globals. Either mocha is resetting them for each test or my implantation was some how flawed. I'd rather do it that way, but not certain it is possible.

On Dec 11, 2013, at 7:04 AM, Miroslav Bajtoš notifications@github.com wrote:

I am proposing two changes:

Make this module a collection of utilities, i.e. move the current implementation out of /index.js into lib/ folder, change the way how the module is used:

var lt = require('loopback-testing').TestCaseHelper;
lt.describe(/* ... */)

// this way I can add my new code as
var TestDataBuilder = require('loopback-testing').TestDataBuilder;
Add a function that will merge install describe/it/etc. as globals, possibly extending symbols already defined by Mocha.

require('loopback-testing').mocha('bdd');
// now I can write
// describe.whenCalledRemotely
// given.model('Product', /*.. */)
Later we can implement support for other interfaces than bdd and possibly other test frameworks like TAP.

@ritch what's you opinion? What was the reason why you decided to not amend mocha's global symbols, as we discussed in the other pull request?

Perhaps the second point should be implemented by a standalone module depending on loopback-testing, e.g. loopback-mocha?


Reply to this email directly or view it on GitHub.

@bajtos
Copy link
Contributor Author

bajtos commented Dec 19, 2013

The first item was implemented by #2.

@altsang altsang removed the 0.1.0 label Sep 9, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants