Enhancing the Plugin API?

101 views
Skip to first unread message

Steven Velez

unread,
Feb 5, 2012, 4:24:41 PM2/5/12
to js-test...@googlegroups.com
Hi All,

As a new user of jstd and the jasmine adapter, I recently discovered that, unless you specify the "--reset" flag on the command line, old jasmine tests aren't purged when making changes to test files.

Investigating the code bases of both jstd and the jasmine adapter, it seems that on each source load, jstd removes stale test cases from the file being reloaded, but the jasmine adapter does not benefit from this logic because of some complexities in matching jasmine features to jstd features... I believe that if the test manager ( i think this is the class, not looking at the code right now) made a call back in to the currently registered plugins when a file is being loaded (passing along the url/path of the loaded file), then I think the adapter would be able to be enhanced to correctly purge stale tests in a more efficient manner than just doing a --reset on everything.

Would adding such an optional call back to plugins be accepted as a welcome contribution?  Also, how are contributions made in this project?  I didn't see any notes on the wiki.  Simply post a patch here?

Thanks,
Steven

Cory Smith

unread,
Feb 7, 2012, 2:13:49 PM2/7/12
to js-test...@googlegroups.com
First, sorry for the delay. I didn't get the groups notification
email, so there was a backlog.

In general, issues, feature requests and patches are best submitted
here: http://code.google.com/p/js-test-driver/issues/list

However, for patches, you'll need to fill out either a ICLA
(http://code.google.com/legal/individual-cla-v1.0.html) or a CLA
(http://code.google.com/legal/corporate-cla-v1.0.html) before they can
be merged in.

-c

> --
> You received this message because you are subscribed to the Google Groups
> "JsTestDriver" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/js-test-driver/-/FB4lBZxaFCMJ.
> To post to this group, send email to js-test...@googlegroups.com.
> To unsubscribe from this group, send email to
> js-test-drive...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/js-test-driver?hl=en.

Steven Velez

unread,
Feb 8, 2012, 2:51:55 PM2/8/12
to js-test...@googlegroups.com
No problem on the delay... I've got time :)

So, while trying to write an intelligent feature request, I noticed that the plugin API already supports a "loadSource" callback... which the default plugin hooks in to to do the load...and so on.  This is where testCaseManager_.removeTestCaseForFileName happens.

I bet the jasmine plugin could also handle loadSource to do what it needs to do in this case. As far as I understand dispatch and register, plugins are called in reverse registration order... so as long as the callback doesn't return true... all should continue to work.

Am I understanding things correctly?

Hopefully we can find a solution without involving our lawyers.  I don't have THAT much time.

Steven

Steven Velez

unread,
Feb 10, 2012, 8:08:56 PM2/10/12
to js-test...@googlegroups.com
Implementation proves that the solution almost works.

There is a problem in that the loadSource method of the plugin does not get called before the first set of tests are loaded, but it is called before each test file reload. 

Its almost as if while the first set of files from the config file are being loaded you are in a loop where any plugins registered aren't recognized until after the loop is complete.

Is this expected and correct behavior or is it defective?

Thanks,
Steven

Cory Smith

unread,
Mar 15, 2012, 6:00:30 PM3/15/12
to js-test...@googlegroups.com
Uh, bug. Are you specifying --preloadFiles?

Steven Velez

unread,
Mar 16, 2012, 9:24:51 AM3/16/12
to js-test...@googlegroups.com
Hrm... no.  I can try it though.  Is that specified on the server invocation or the test run request?

Thanks,
Steven

Steven Velez

unread,
Mar 16, 2012, 2:05:54 PM3/16/12
to js-test...@googlegroups.com
--preloadFiles doesn't appear to make a difference.

I will try to create an issue with an example exercising the problem.

Bret Little

unread,
Oct 19, 2012, 1:35:46 PM10/19/12
to js-test...@googlegroups.com
Steven, did you ever get that working?

Bret Little

unread,
Oct 19, 2012, 1:36:30 PM10/19/12
to js-test...@googlegroups.com
I am having a similar problem and I think it is a jsTestDriver bug. Looking through the jsTestDriver codebase and hopefully will come up with a fix...unless you already have :)

Cory Smith

unread,
Oct 19, 2012, 1:48:16 PM10/19/12
to js-test...@googlegroups.com
Well, I was never ever to reproduce the issue, so if you find
something, please let me know.
> --
> You received this message because you are subscribed to the Google Groups
> "JsTestDriver" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/js-test-driver/-/Lua5PSZE0uAJ.

Bret Little

unread,
Oct 19, 2012, 3:03:31 PM10/19/12
to js-test...@googlegroups.com
I have it failing 100% of the time, but it is in a large project structure. I will try to put together a small example. As a side note, how many devs are working on jsTestDriver these days? Are you looking for additional help on the project?

Bret Little

unread,
Oct 19, 2012, 5:38:01 PM10/19/12
to js-test...@googlegroups.com
Corey, see this repo: https://github.com/Grandrath/jstestdriver-requirejs

Try to run the tests with phantomjs as the client.


On Friday, October 19, 2012 11:48:37 AM UTC-6, Cory Smith wrote:
Reply all
Reply to author
Forward
0 new messages