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

higher level js api #265

Closed
tj opened this issue Feb 15, 2012 · 9 comments
Closed

higher level js api #265

tj opened this issue Feb 15, 2012 · 9 comments
Labels
type: feature enhancement proposal

Comments

@tj
Copy link
Contributor

tj commented Feb 15, 2012

would allow people to bypass mocha(1) if they wish, see #136 and a few others

@uipoet
Copy link

uipoet commented Mar 6, 2012

I have a jQuery plugin that runs its unit tests against each supported version of jQuery in a loop. I would love to replace my home-grown testrunner with mocha. Any idea how big the scope of enabling an API is? Hacking _mocha to import each version of jQuery is proving difficult. I'm sure require('mocha') with supported functions would work much better for my case.

@tj
Copy link
Contributor Author

tj commented Mar 6, 2012

wouldnt you want to run that the browser anyway

@uipoet
Copy link

uipoet commented Mar 6, 2012

I'm running a subset of the unit tests in jsdom continuously during development. Then manually running the full suite in browsers before a release.

@tj
Copy link
Contributor Author

tj commented Mar 7, 2012

ah I see. well can't you just have require('jquery1.0') require('jquery1.1') that sort of thing?

@tj
Copy link
Contributor Author

tj commented Mar 7, 2012

then maybe setup the makefile like:

test: test-1.0 test-2.0

test-1.0:
  $(MAKE) JQUERY_VERSION=1.0 test-unit

test-2.0:
  $(MAKE) JQUERY_VERSION=2.0 test-unit

test-unit:
  ./node_modules/.bin/mocha ... stuff here

@tj
Copy link
Contributor Author

tj commented Mar 7, 2012

^ gives you the benefit of concurrency as well make test -j4 etc

@uipoet
Copy link

uipoet commented Mar 7, 2012

Interesting. I'll give this a shot since I need a makefile's easy access to my scripts anyway. Thanks!

Mind you, this is part of a larger build system that does things like JSHint for syntax, compile Stylus and minify the source before running the tests. That's why having the whole thing written inside a Node.js module, using an API provided by mocha makes the most sense to me.

@tj
Copy link
Contributor Author

tj commented Mar 7, 2012

sure, but at least until there is a js api

@uipoet
Copy link

uipoet commented Mar 7, 2012

Agreed, and P.S. - I <3 the flexibility of this test framework. It's the least opinionated one by far.

@tj tj closed this as completed in 9125b84 Mar 16, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature enhancement proposal
Projects
None yet
Development

No branches or pull requests

2 participants