Search code examples
javascriptcygwinyuinode.jsyeti

Need help with how to start using YUI YETI in Cygwin for JS testing


I'm new to a lot of things that YETI requires to run, and I've made it through most of the steps to get it to work. I have installed cygwin so I can run node.js and npm (I used these instructions). Once done, I ran npm install yeti, and yeti installed. Now I can type things like this:

enter image description here

This is where I'm having problems. I can't figure out how to get yeti to run the tests in demo.html. I can open up my browser to file:///C:/test/demo.html and I can see the tests run (it's a YUI Test) so I know that the problem is not demo.html being broken. Also, when I try to run yeti as a server (yeti --server), It sits there after the line "to run and report the results" and doesn't let me do anything unless I exit with ctrl-c, although I can go to localhost:8000 and see this:

enter image description here

If I try opening up a new cygwin console and doing this:

enter image description here

It gives me a bunch of errors that I don't understand.

Help!


Solution

  • How I did it on ubuntu:

    • First install node dependencies. Only install dependencies using apt-get

    • Next install node/npm the correct way on ubuntu.

      echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
      . ~/.bashrc
      mkdir ~/local
      mkdir ~/node-latest-install
      cd ~/node-latest-install
      curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
      ./configure --prefix=~/local
      make install # ok, fine, this step probably takes more than 30 seconds...

    close terminal and open it again

    curl http://npmjs.org/install.sh | sh
    
    • After that install yeti issuing: $ npm install yeti@stable
    • Run yeti issuing from terminal:

      alfred@alfred-laptop:~/node/stackoverflow/4833633$ yeti Yeti will only serve files inside /home/alfred/node/stackoverflow/4833633 Visit http://localhost:8000, then run: yeti to run and report the results.

    • start the browsers you like. Point the browsers to => http://localhost:8000

    • inside the folder you started yeti write your tests.

      alfred@alfred-laptop:~/node/stackoverflow/4833633$ ls -al
      total 16
      drwxr-xr-x 2 alfred alfred 4096 2011-01-29 01:47 .
      drwxr-xr-x 6 alfred alfred 4096 2011-01-29 01:27 ..
      -rw-r--r-- 1 alfred alfred 6140 2011-01-29 01:47 simple.html

      See gist for a really simple example. I just copied to example from http://developer.yahoo.com/yui/3/examples/test/test-simple-example_clean.html but removed the <!--MyBlogLog instrumentation--> crap. I also told it not to render console by commenting line 196 => //r.render('#testLogger');(That last is not even necessary, but I think tests will run faster that way because it does need to render the console).

    • Finally I just ran:

    alfred@alfred-laptop:~/node/stackoverflow/4833633$ yeti simple.html
    Waiting for results. When you're done, hit Ctrl-C to exit.
    ✔ Example Suite on Chrome (8.0.552.237) / Linux
       6 passed, 0 failed

    ✔ Example Suite on Firefox (3.6.13) / Linux
       6 passed, 0 failed

    Success :)

    Some extra information about my distro

    alfred@alfred-laptop:~/node/stackoverflow/4833633$ cat /etc/issue
    Ubuntu 10.10 \n \l
    
    alfred@alfred-laptop:~/node/stackoverflow/4833633$ python --version
    Python 2.6.6
    
    alfred@alfred-laptop:~/node/stackoverflow/4833633$ node -v
    v0.2.6
    
    alfred@alfred-laptop:~/node/stackoverflow/4833633$ npm -v
    0.2.15
    
    alfred@alfred-laptop:~/node/stackoverflow/4833633$ npm ls installed | grep yeti
    npm info it worked if it ends with ok
    npm info using [email protected]
    npm info using [email protected]
    [email protected]               The YUI Easy Testing Interface    =reid active installed remote stable YUI web app YUITest TDD BDD yui3 test
    npm ok