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

Running a single test #65

Closed
dsawardekar opened this issue Jan 22, 2014 · 10 comments
Closed

Running a single test #65

dsawardekar opened this issue Jan 22, 2014 · 10 comments

Comments

@dsawardekar
Copy link

Is there a way to make Frisby run only a single test. I would like to run an isolated test when debugging a specific error. Something like,

frisby.create.only('foo') // followed by the chain and toss.

I'm not terribly familiar with the jasmine layer underneath. Would this be possible with Frisby/Jasmine?

Thanks for this project. The json matchers in particular are well thought out and very handy!

@vlucas
Copy link
Owner

vlucas commented Jan 22, 2014

As far as I know, there is no easy way to do this with the jasmine-node test runner and Frisby.js, but it is something I too have always wanted.

@dsawardekar
Copy link
Author

I did some further investigation into this. I found jasmine-only which does the job. It adds a describe.only and it.only like mocha, which runs only that test.

I noticed that Frisby writes dynamic describe and it calls. The next step is to make frisby also support the only syntax. I'm thinking if toss is passed 'only' as an argument it writes with a dynamic it.only or describe.only instead.

I'd be happy to make this PR, just need a couple of clarifications. In frisby.js, I was hoping to add an else check for retry == 'only' and then it = it.only or describe = describe.only. The it.results and current.it is confusing me.

Or maybe there is a better way. Can you clarify what would be the simplest way to pull this off?

@vlucas
Copy link
Owner

vlucas commented Jan 22, 2014

Is there anything in Jasmine 2 that supports this? I will have to upgrade eventually anyways.

@dsawardekar
Copy link
Author

I don't think so. There are a couple of PR's that address this #309 and #181 but are unmerged. My feeling is this is seen as something that is to be provided by external plugins and is unlikely to make jasmine core.

@vlucas
Copy link
Owner

vlucas commented Jan 24, 2014

Okay. Are we going to have to switch test runners away from jasmine-node as well to make this work?

@dsawardekar
Copy link
Author

@vlucas No. jasmine-node works fine with jasmine-only.

From Frisby's POV an extra jasmine-only dependency needs to be added to package.json to support this feature. Frisby could require jasmine-only within itself, so any test can use describe.only and it.only without manually requiring it in every test.

The issue is Frisby's dynamic describe and it declarations which need to be modified to conditionally use the only variants. My suggestion above was to do this via toss('only')

@vlucas
Copy link
Owner

vlucas commented Jan 25, 2014

Right. That sounds like something that can be easily handled though. The dynamic creation of describe and it statements doesn't happen until the toss call, so yes - that would be the ideal place to put it.

@katerberg
Copy link

@dsawardekar @vlucas Are you implementing this or is this an issue that is still unresolved?

@dsawardekar
Copy link
Author

@diablomarcus It's resolved for me at the moment. I ended up not needing single runs for the project I was working on at the time.

@vlucas vlucas closed this as completed in fd8909a May 27, 2015
vlucas added a commit that referenced this issue May 27, 2015
Fix #65: Add ttoss() to support run single tests.
@katerberg
Copy link

Thanks @vlucas!

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

No branches or pull requests

3 participants