bsatrom / Knockout.Unobtrusive

Unobtrusive View to ViewModel bindings for KnockoutJS
http://bsatrom.github.com/Knockout.Unobtrusive/
44 stars 1 forks source link

Tests now run under nodejs! #6

Closed aaronpowell closed 13 years ago

aaronpowell commented 13 years ago

I've continued the work to get the tests going under nodejs, today's progress sees:

What works under nodejs

So I've been having some problems with jQuery and nodejs (getting out of memory errors) so I've done the following:

Ultimately the look of the API should be almost the same under nodejs tests as when you run the 'real' tests

What doesn't work under nodejs

So I've had some problems with jQuery under nodejs meaning that any tests which rely on jQuery (the ones with template parsing) fail. These tests are wrapped in a check for jQuery and if it doesn't exist then it'll ignore them, otherwise they get run.

This means the browser will have greater coverage. Ultimately though I'd look to refactor it so there isn't a jQuery dependency within the Unobtrusive API instead.

bsatrom commented 13 years ago

Fantastic. I'll take a look and pull it in.

And yeah, I've been meaning to get the jQuery dependency out of the templating stuff anyway. My dom-templating branch is almost free of it, so I'll probably be rid of it once that piece is done. Even more motivation now that Node has issues with it... :D

-----Original Message----- From: aaronpowell [mailto:reply@reply.github.com] Sent: Thursday, August 18, 2011 8:29 AM To: Brandon Satrom Subject: [Knockout.Unobtrusive] Tests now run under nodejs! (#6)

I've continued the work to get the tests going under nodejs, today's progress sees:

What works under nodejs

So I've been having some problems with jQuery and nodejs (getting out of memory errors) so I've done the following:

Ultimately the look of the API should be almost the same under nodejs tests as when you run the 'real' tests

What doesn't work under nodejs

So I've had some problems with jQuery under nodejs meaning that any tests which rely on jQuery (the ones with template parsing) fail. These tests are wrapped in a check for jQuery and if it doesn't exist then it'll ignore them, otherwise they get run.

This means the browser will have greater coverage. Ultimately though I'd look to refactor it so there isn't a jQuery dependency within the Unobtrusive API instead.

Reply to this email directly or view it on GitHub: https://github.com/bsatrom/Knockout.Unobtrusive/pull/6

bsatrom commented 13 years ago

all of the tests pass under Node now. I removed any explicit need for jQuery from the plugin and the tests file.

bsatrom commented 13 years ago

Got the tests running in Cake, which is awesome! cake minify doesn't work for me though, and I don't seem to be missing any packages. Does it work for you? If so, I'll investigate...

aaronpowell commented 13 years ago

Have you got uglify-js included?

I've got the following modules:

bsatrom commented 13 years ago

Yeah, have all of those. I'll dig deeper into the error coming from uglify.

-----Original Message----- From: aaronpowell Sent: Sunday, August 21, 2011 5:54 PM To: Brandon Satrom Subject: Re: [Knockout.Unobtrusive] Tests now run under nodejs! (#6)

Have you got uglify-js included?

I've got the following modules:

Reply to this email directly or view it on GitHub: https://github.com/bsatrom/Knockout.Unobtrusive/pull/6#issuecomment-1865295

aaronpowell commented 13 years ago

What's the error?

bsatrom commented 13 years ago

The issue was actually with the minify task. it was pulling files from the lib directory and trying to minify them into the js directory. Fixed by changing line 34 of the Cakefile from

files = fs.readdirSync 'lib'

to

files = fs.readdirSync 'js'

aaronpowell commented 13 years ago

Oh. It shouldn't be hard-coded, it should be using the statics defined at the top of the file. My structure is generally src for the coffee files and lib for the generated ones ;)

bsatrom commented 13 years ago

ah, I see those at the top (output). must not have made their way into the tast. I'll fix.

aaronpowell commented 13 years ago

Yeah, copy/ paste fail. I better update some of my repos that will have that in it

bsatrom commented 13 years ago

No worries. All in all, it's awesome stuff. I added a little bit of growl goodness today too. Pretty nice to have this all running automatically.

-----Original Message----- From: aaronpowell [mailto:reply@reply.github.com] Sent: Monday, August 22, 2011 6:29 PM To: Brandon Satrom Subject: Re: [Knockout.Unobtrusive] Tests now run under nodejs! (#6)

Yeah, copy/ paste fail. I better update some of my repos that will have that in it

Reply to this email directly or view it on GitHub: https://github.com/bsatrom/Knockout.Unobtrusive/pull/6#issuecomment-1875647

aaronpowell commented 13 years ago

Yeah the whole edit-save-compile-test is awesome!