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

Add ddescribe, iit for exclusive suites,specs #181

Closed
wants to merge 1 commit into from

Conversation

@vojtajina
Copy link

@vojtajina vojtajina commented Jan 23, 2012

When any ddescribe is registered, only specs withing these exclusive suites will be run

describe('normal', function() {
  ddescribe('exclusive', function() {
    // all specs here will be run
  });

  // nothing here will run
  it('should not run', function() {});
});

When any iit is registered, only these exclusive specs will be run (precedence over ddescribe)

it('should not run', function() {});
iit('should run', function() {});
it('should not run 2', function() {});
iit('should run as well', function() {});

We've been using this feature for quit a while during development of AngularJS.

It's part of Jasmine - JsTD adapter, I think it was originally an idea of @IgorMinar.

I really miss this feature when using jasmine-node or when using SlimJim.

I think, it really should be part of the core, so I did implement it.

@IgorMinar
Copy link

@IgorMinar IgorMinar commented Jan 23, 2012

Nice work!!! I totally support this. We've been using iit and ddescribe via Jasmine JSTD adapter for over a year now and it's been a huge productivity booster. The implementation looks good to me too.

@petejkim
Copy link

@petejkim petejkim commented Jan 26, 2012

perhaps fdescribe and fit instead (a la Cedar)? f stands for "focused".

@vojtajina
Copy link
Author

@vojtajina vojtajina commented Jan 26, 2012

I like ddescribe and iit better, but whatever you like guys... I don't care about the name, so I'm happy to change it...

@IgorMinar
Copy link

@IgorMinar IgorMinar commented Jan 26, 2012

the reason why we went with ddescribe and iit in the first place is that it visually looks very similar to the original, yet it's quite easy to spot because neither is an "real" word.

since fit is an actual word it can be easily confused as something not related to it. it can even be confused with some kind of acceptance testing stuff related to fitness.

@petejkim
Copy link

@petejkim petejkim commented Jan 26, 2012

idk... fdescribe and fit are what they use in Cedar

@marcenuc
Copy link

@marcenuc marcenuc commented Jan 27, 2012

I agree with @IgorMinar that fit is confusing.

@chikamichi
Copy link

@chikamichi chikamichi commented Feb 8, 2012

I kind of like ddescribe and iit too: doesn't mean anything but doesn't have to, for it's temporary. Self-explanatory though, it's like an emphasis. In RSpec, I'm used to a custom focus keyword, super useful while developing :)

Is it under consideration for merge?

@vojtajina
Copy link
Author

@vojtajina vojtajina commented Feb 8, 2012

Yep, I would prefer ddescribe and iit, but the name is not that important to me - I'm happy to change it to anything else.

But this feature is really crucial for development. Any input from core devs ?

ddescribe runs only these exclusive suties
iit runs only these exclusive specs
@IgorMinar
Copy link

@IgorMinar IgorMinar commented Mar 5, 2012

Ping. It's been quite a while. Anyone who tried to use iit/ddescribe with jasmine and a automatic runner like JSTD or slim-jim agrees that this is a killer feature. And even with manual (html) runner this feature increases the velocity of development. Can we get it in? Call it whatever you want, but please merge it in :-)

@vojtajina
Copy link
Author

@vojtajina vojtajina commented Mar 6, 2012

It's rebased to latest master now.

Anyway, for those who like this feature, here is a latest build of jasmine including this feature:
https://github.com/vojtajina/jasmine/tree/ddescribe-iit-build/lib/jasmine-core
https://raw.github.com/vojtajina/jasmine/ddescribe-iit-build/lib/jasmine-core/jasmine.js

@IgorMinar
Copy link

@IgorMinar IgorMinar commented Mar 6, 2012

great! jasmine developers please give it a shot to see how cool it is yourself.

@airportyh
Copy link

@airportyh airportyh commented Jul 22, 2012

This is the same functionality as my odescribe pull request #218 - so it's not just me! This is especially great when used with an autotest runner like jsTD or Testem.

@vojtajina
Copy link
Author

@vojtajina vojtajina commented Jul 22, 2012

This is totally must, for development, we use it all the time.
That's why I ship different build of jasmine with Testacular.
I think it would be great if pivotal folks re-think this - it's not that different from xit and xdescribe :-D

@wclr
Copy link

@wclr wclr commented Jul 22, 2012

Look how this problem can be solved with mocha tagging feature https://github.com/visionmedia/mocha/wiki/Tagging

@airportyh
Copy link

@airportyh airportyh commented Jul 23, 2012

That is good but not quite as nice because to narrow the test scope you have to update 2 places: the code and the runner, whereas with xdescribe and xit, you only have to change it in one - it's all about the workflow!

@vojtajina
Copy link
Author

@vojtajina vojtajina commented Jul 24, 2012

Agree, you wanna stay in your editor...

@IgorMinar
Copy link

@IgorMinar IgorMinar commented Jul 24, 2012

@whitecolor the mocha tagging feature is nothing like iit and ddescribe. The tags in mocha are meant for persistent grouping of tests, while iit and ddescribe are used just for transitive grouping. This transitive grouping is used only for development and is never meant to be committed into the source repo (for example).

that reminds me that names iit and ddescribe were picked not only for developer convenience, but also to make them unusual and easy to grep for in pre-submit scripts (to prevent their addition to source repo).

@robshep
Copy link

@robshep robshep commented Sep 28, 2012

+1 We have been using iit in our angularjs tests and now I come to use jasmine on a non-angularjs iit's not there. Please pull this.

@vojtajina
Copy link
Author

@vojtajina vojtajina commented Sep 29, 2012

Just FYI, Mocha already has that http://visionmedia.github.com/mocha/#exclusive-tests (even though, writing extra i is imho way easier than .only).

@airportyh
Copy link

@airportyh airportyh commented Sep 30, 2012

Also FYI, I wrote a blog post on this a short while ago :) http://tobyho.com/2012/09/12/better-tdd-workflow-via-exclusive-tests-in-jasmine-and-mocha/

@wclr
Copy link

@wclr wclr commented Sep 30, 2012

I still use "x" to exclude tests, adding and removing ".skip" is too tiresome.

@pkozlowski-opensource
Copy link

@pkozlowski-opensource pkozlowski-opensource commented Nov 27, 2012

+100

I wonder why this one wasn't considered / merged... iit and ddescribe totally rock in practice, make it so easy to focus on one test / spect when things start failing.

@gimmi
Copy link

@gimmi gimmi commented Dec 16, 2012

Given that this feature has been already used and found useful on a bunch of projects, I +1 it

@anthonygreen
Copy link

@anthonygreen anthonygreen commented Jan 7, 2013

I feel there is a touch too much cognitive overhead with the syntax as it stands.
My understanding is that this is a feature similar to Cucumber's tags to that allow one to run subsets of tests, the commonest one being wip. I think an implementation that followed that pattern with the ability to run a specific subset by use of a command line parameter would be more familiar to those from a test background.

@IgorMinar
Copy link

@IgorMinar IgorMinar commented Jan 7, 2013

@anthonygreen command line args take too long to set up and require context switching (from editor to command line) for every test run. this is what we are trying to avoid.

@pkozlowski-opensource
Copy link

@pkozlowski-opensource pkozlowski-opensource commented Jan 7, 2013

@anthonygreen just wanted to say that I'm using syntax proposed by @vojtajina on the daily basis and I'm absolutely loving it. It might look odd at first but works perfectly in practice. It is huge, huge time-saver.

@anthonygreen
Copy link

@anthonygreen anthonygreen commented Jan 8, 2013

@IgorMinar I disagree. Context switching is generally low and I've observed that the test community already handles it with various solutions in the case of Cucumber.
@pkozlowski-opensource I can only reiterate my point that separating a feature's value from it's implementation needs to be considered from a community POV. In this case I appreciate the value but the implementation could benefit from an alternative approach.

@basarat
Copy link

@basarat basarat commented Jul 9, 2013

Great that karma has this. Surprised that jasmine does not. +1

@vojtajina
Copy link
Author

@vojtajina vojtajina commented Jul 11, 2013

As Jasmine v2.0 is coming, I really think we should get this in.

I'm happy to update this PR.

@ksheedlo
Copy link

@ksheedlo ksheedlo commented Jul 11, 2013

+1

@jsjant
Copy link

@jsjant jsjant commented Jul 11, 2013

I will be happy to see this feature in the upcoming release so +1!

@eladmoshe
Copy link

@eladmoshe eladmoshe commented Jul 11, 2013

+1

2 similar comments
@PeterBoesenberg
Copy link

@PeterBoesenberg PeterBoesenberg commented Jul 11, 2013

+1

@sebald
Copy link

@sebald sebald commented Jul 11, 2013

+1

@passy
Copy link

@passy passy commented Jul 11, 2013

+1

There is already a grunt task to verify you don't accidentally commit this: https://github.com/btford/grunt-ddescribe-iit

@IgorMinar
Copy link

@IgorMinar IgorMinar commented Jul 11, 2013

+1

On Thu, Jul 11, 2013 at 6:29 AM, Pascal Hartig notifications@github.comwrote:

+1

There is already a grunt task to verify you don't accidentally commit
this: https://github.com/btford/grunt-ddescribe-iit


Reply to this email directly or view it on GitHubhttps://github.com//pull/181#issuecomment-20811097
.

@btford
Copy link

@btford btford commented Jul 11, 2013

+1

1 similar comment
@pkozlowski-opensource
Copy link

@pkozlowski-opensource pkozlowski-opensource commented Jul 11, 2013

+1

@aadsm
Copy link

@aadsm aadsm commented Jul 11, 2013

The sooner, the better!

@smathson
Copy link

@smathson smathson commented Jul 13, 2013

+1 use this every day in Karma

@eitanp461
Copy link

@eitanp461 eitanp461 commented Jul 14, 2013

+1

1 similar comment
@revolunet
Copy link

@revolunet revolunet commented Jul 15, 2013

+1

@infews
Copy link
Contributor

@infews infews commented Jul 15, 2013

I am closing this request. We are going to support this functionality in some manner in 2.0 - it's clearly important to people.

However this pull's implementation is not relevant for the 2.0 implementation. There is an active discussion on the mailing list for the approach.

@fiznool
Copy link

@fiznool fiznool commented Jun 20, 2014

For newcomers to this issue - was this something implemented in Jasmine 2.0 or has it not yet landed?

@maksimr
Copy link

@maksimr maksimr commented Jun 25, 2014

+1
It is sad that the jasmine team does not want to support it.

@nikku
Copy link

@nikku nikku commented Jun 25, 2014

iit is supported in my Jasmine 2.0 version. May be because it is AngularJS jasmine fork?

@fiznool
Copy link

@fiznool fiznool commented Jun 25, 2014

@nikku Yes, this has been patched by the Angular team into the version of Jasmine that ships with Karma. So, if you are using the karma runner, you will have access to iit and ddescribe.

Answering my own question - this feature isn't available in core Jasmine. I'm using jasmine-node to unit test my server side code and it would be really nice to have iit and ddescribe here.

@mwise
Copy link

@mwise mwise commented Jul 1, 2014

For those interested, I've created https://github.com/mwise/jasmine-focus to add a psuedo-plugin that you can use to run focused specs. It supports fdescribe and fit, as well as an rspec-style { focus: true } tag object optionally passed as the first argument to describe() and fit(). We're using it in a rails context by specifying a custom boot.js that incorporates the jasmine-focus stuff. Not ideal, but it works!

@travisperson
Copy link

@travisperson travisperson commented Feb 17, 2015

For anyone that found this thread and looking for if this was implemented:

#309 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet