Add ddescribe, iit for exclusive suites,specs #181

Closed
wants to merge 1 commit into from
@vojtajina

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

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

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

@vojtajina

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

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

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

@marcenuc

I agree with @IgorMinar that fit is confusing.

@chikamichi

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

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 ?

@vojtajina vojtajina Add ddescribe, iit for exclusive suites,specs
ddescribe runs only these exclusive suties
iit runs only these exclusive specs
750fcd5
@IgorMinar

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

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

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

@airportyh

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

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

@whitecolor

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

@airportyh

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

Agree, you wanna stay in your editor...

@IgorMinar

@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

+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

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

@whitecolor

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

@pkozlowski-opensource

+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.

This was referenced Dec 7, 2012
@gimmi

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

@anthonygreen

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

@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

@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

@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.

@mgcrea mgcrea referenced this pull request in mgcrea/angular-strap Jan 10, 2013
Closed

Real fix for the duplicate items in ng-repeat within bs-popover #18

@mgcrea

Thought this was already merged (hence the reference), I've been using this feature with testacular for the past few months and I just love it.

This is just too bad this has been pending for over a year, let's hope that your "alternative" approach comes around during the next decade...

@airportyh

FWIW, I've created another pull request #309 that renames ddescribe to describe.only and iit to it.only, following Mocha's syntax.

I personally don't feel strongly about either syntax, but the hope is that this alternative is more palatable for those who have opposed this feature thus far given that

  1. It doesn't introduce any new global variables
  2. The syntax is more meaningful
  3. It has prior art in Mocha
@paulirish

I like the proposal, but only with Toby's changes in #309 .
"ddescribe" is the kind of what-am-i-looking-at that requires reading the documentation as it carries no extra semantic value. Newcomers would always have to ask/look at what it means, which is something that jasmine has been very good at avoiding thus far with the assertion API.

@bensmithett

+1 with the .only syntax, this will be super handy.

@gimmi
@IgorMinar

one of the reasons why I picked "ddescribe" and "iit" names back in 2010 (yes I've been using this feature for that long) is that it requires typing just one character to switch into the "exclusive" mode. So selecting 4 specs to be exclusively executed is very fast. 1 character also rarely interferes with line wrapping rules, so you get to see the whole description without scrollbars if you have multiple windows open in your editor/ide side by side.

@paulirish I think it's wrong to think of this api as something you'll just come across in someone's codebase (unless you are pair programming) because this api is only used during development and it makes no sense to commit it into the repo. I actually suggest to people that use Testacular's Jasmine with iit and ddescribe that they should write a grep test for their CI server if iit or ddescribe are found in the source. both iit and ddescribe are unique and easy to grep for.

Let me also remind you that there is no describe.disabled or it.disabled but rather xit and xdescribe so from the api consistency point of view iit and ddescribe naturally match the existing apis.

@Wizek

+1 for double initial characters for the reasons @IgorMinar described.

If it is still decided against, I'll go with what I did in Mocha:

var ddescribe = describe.only
  , xdescribe = describe.skip
  , iit = it.only
  , xit = it.skip

That being said, the opposite also holds:

describe.only = ddescribe
describe.skip = xdescribe
it.only = iit
it.skip = xit

In addition, @airportyh, does prior art still hold if the double-initial version is in use since 2010?

But most importantly we need to have this feature merged in under whatever name you like best, and the other group can use the above technique to convert the syntax to the one they like.

@hakubo

Still open...

yet, I also would love to use it

@agsha

Wow, this discussion is over a year old. Any chance of ddescribe and the like being accepted? would really love to have it.

@jdeff

+1

@jdelight

I get round this by running Jasmine specs on Testacular/Karma - but would be great to have it as part of Jasmine!

@basarat

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

@vojtajina

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

I'm happy to update this PR.

@jsjant

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

@sebald

+1

@passy

+1

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

@IgorMinar
@btford

+1

@aadsm

The sooner, the better!

@smathson

+1 use this every day in Karma

@infews

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.

@infews infews closed this Jul 15, 2013
@fiznool

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

@maksimr

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

@nikku

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

@fiznool

@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

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

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

#309 (comment)

@brianmhunt brianmhunt referenced this pull request in knockout/knockout Apr 21, 2015
Closed

#1039 build for bower (& migration from Grunt to Gulp) #1360

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