Fixes for use with requirejs #135

Merged
merged 6 commits into from Apr 10, 2012

Conversation

Projects
None yet
2 participants

mtscout6 commented Mar 5, 2012

Here are some fixes so that tests loaded with requirejs will work.I am planning to get some tests for this use case in the next week or two.

Owner

mhevery commented Mar 9, 2012

Sorry, this is not merging it cleanly, and there are no tests, Could you add some tests and fix the merge conflicts?

mtscout6 commented Apr 3, 2012

Here are the much desired tests for the requirejs stuff. There is currently only one test that is failing, and I don't know why yet. For some reason a test for object instanceof Date doesn't work. The value is being set, it's just that the instanceof isn't working. I'm looking into it, but for now I feel that is a minor bug in comparison to requirejs not working at all with what's currently on master. I will be looking into that bug again here in the near future when I have more time to investigate it in more detail.

Owner

mhevery commented Apr 3, 2012

When I merge your code I get this:

/usr/local/bin/node /Users/misko/work/jasmine-node/lib/jasmine-node/cli.js --coffee .

node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Object requirejs.sut has no method 'substring'
at Function._resolveLookupPaths (module.js:235:23)
at Function._resolveFilename (module.js:322:31)
at Function._load (module.js:279:25)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object. (/Users/misko/work/jasmine-node/spec-requirejs/requirejs.spec.js:1:63)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:31)
at Function._load (module.js:308:12)

Process finished with exit code 1

mtscout6 commented Apr 3, 2012

I believe that this is happening because I have not taken coffee script into account at all with the requirejs implementation. If you specify the spec directory specifically, then your tests will run. I was running the scripts/specs bash file to run the tests, which executes the tests separately from each other.

mtscout6 commented Apr 9, 2012

Have you had a chance to look at this yet. I've got a lot of people pinging me with questions regarding this.

mtscout6 commented Apr 9, 2012

Here are the people that have pinged me about this issue, @jmortensen, @MattClevenger, and @saip106. I'm mentioning them here so they get updates regarding this request.

Owner

mhevery commented Apr 9, 2012

Sorry about the delay, Lets get this thing merged in today.

but when I run my tests "./specs.sh ." which is my sanity i get this error

dhcp-172-19-43-205:jasmine-node misko$ ./specs.sh .

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
TypeError: Object requirejs.sut has no method 'substring'
    at Function._resolveLookupPaths (module.js:235:23)
    at Function._resolveFilename (module.js:322:31)
    at Function._load (module.js:279:25)
    at Module.require (module.js:354:17)
    at require (module.js:370:17)
    at Object.<anonymous> (/Users/misko/work/jasmine-node/spec-requirejs/requirejs.spec.js:1:63)
    at Module._compile (module.js:441:26)
    at Object..js (module.js:459:10)
    at Module.load (module.js:348:31)
    at Function._load (module.js:308:12)
dhcp-172-19-43-205:jasmine-node misko$ 

the expected output is:

dhcp-172-19-43-205:jasmine-node misko$ ./specs.sh .
......F.....F..............................

Failures:

  1) should be timed out
   Message:
     timeout: timed out after 500 msec waiting for MIRACLE
   Stacktrace:
     undefined

  2) should report failure (THIS IS EXPECTED)
   Message:
     Expected true to be falsy.
   Stacktrace:
     Error: Expected true to be falsy.
    at new <anonymous> (/Users/misko/work/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:102:32)
    at [object Object].toBeFalsy (/Users/misko/work/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1171:29)
    at [object Object].<anonymous> (/Users/misko/work/jasmine-node/spec/nested/uber-nested/UberNestedSpec.js:8:20)
    at [object Object].execute (/Users/misko/work/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1001:15)
    at [object Object].next_ (/Users/misko/work/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1790:31)
    at [object Object].start (/Users/misko/work/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1743:8)
    at [object Object].execute (/Users/misko/work/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:2070:14)
    at [object Object].next_ (/Users/misko/work/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1790:31)
    at [object Object].start (/Users/misko/work/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:1743:8)
    at [object Object].execute (/Users/misko/work/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js:2215:14)

Finished in 6 seconds
43 tests, 77 assertions, 2 failures

I had updated the scripts/specs bash file before not the root specs.sh file which I believe was part of the confusion. I updated the specs.sh bash file. It doesn't take arguments anymore as it runs the tests multiple times with different options. I believe this is a more exhaustive test of the runner itself as the parameters to jasmine-node provides various different routes through the utility. The problem with the old script and the reason you were getting the error above is because the requirejs option does not yet support coffeescript. Although this will be a goal going forward, and to avoid confusion, I don't believe that the lack of coffeescript support should be a deal-breaker right now.

Also, I would like to propose we remove the scripts/specs bash file to avoid confusion for others regarding how everyone should run the tests.

mhevery merged commit a35f9a8 into mhevery:master Apr 10, 2012

Owner

mhevery commented Apr 10, 2012

Thanks

No, thank you. I apologize for that not being very streamlined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment