A few Questions...

2 views
Skip to first unread message

Andy Beeching

unread,
Apr 23, 2008, 8:53:44 AM4/23/08
to JavaScript Project Generator
Hi Dr Nic,

many thanks for this nifty tool, certainly a nice addition to JS land,
especially with JsUnit out of date, not too mention the project
generators and pretty results tables you can get!

So I have a few queries really so here goes:

- Any chance of adding in the ability for the distributed file to be
linted and compressed, then unit tested? I realise we can do this
manually (I'm no command-line ninja), but what about a few flags for
the rake dist generator, to execute linting and/or compressiong as
requested?

- In the jsunittest file there is no assertType method, though it is
mentioned by Thomas Fulchs in his talk. Is there a reason for this?
assertInstanceOf isn't quite up to type checking for objects, and
although it's easy to use just assert or assertEquals for the same
thing I quite like the idea of having a separate method to stop type
coercion.

How about this?

assertType: function(expected, actual, message) {
message = this.buildMessage(message || 'assertInstanceOf', '<?>
was not an instance of the expected type', actual);
this.assertBlock(message, function() { return actual.constructor
=== expected });
}

Seems to work in the following cases:

assertType(Object, {}, "True" );
assertType(Array, [], "True" );
assertType(Object, [], "False" );

- Finally a question about continuous integration (http://
en.wikipedia.org/wiki/Continuous_Integration)

The dev team where I work are hoping to integrate unit tests of JS
files into their continuous integration process. Do you think this is
possible with the output from running rake test_functionals?

Many thanks for your work on this, looking forward to future
updates :-)

Nic Williams

unread,
May 4, 2008, 1:17:07 AM5/4/08
to javascript-pro...@googlegroups.com
Gmail is a cruel servant - it says 10 days have passed since I got this email. Sorry about that!

If know the tools + cmd lines required for linting + compression, then they can be added as rake tasks. Any assets required can go in lib/ and tasks can go in tasks/*.rake.

Activating them via "rake dist" would probably be via environment variables. Then you can set them across all your projects.

The assertType looks nice - perhaps you can write some cool tests to go with it in the test/unit/assertion_test.html file. Unlike normal unit tests, you still need to run "rake dist" before running jsunittest's unit tests.

Continuous integration integration sounds cool. I wish I'd done CI on a project then I could toy with it. If you need explicit feed back on the success/failure of each test, perhaps look at the rake task + support code that runs the test webrick server to receive the feedback. This code comes from prototypejs project, so any questions you about about CI for jsunittest can be validly put to the prototypejs guys, perhaps specifically Tobie Langel (tobie....@gmail.com).

You ok to add the code for the first 2 points to a fork of the project + ping me?

Cheers
Nic
--
Dr Nic Williams
http://drnicacademy.com - Ruby/Rails training/dev around the world
http://drnicwilliams.com - Ruby/Rails/Javascript/Web2.0
(skype) nicwilliams
(p) +61 412 002 126 / +61 7 3113 3033
(mail) PO Box 583 Ashgrove 4060 QLD Aus
Reply all
Reply to author
Forward
0 new messages