-
Notifications
You must be signed in to change notification settings - Fork 784
jasmine-node #119
Comments
Try the |
@louisandkatherine did this work for you? Actually there is another problem with your istanbul command. You need to separate out the args you want to pass to the command from the args you want to pass to istanbul using a double-dash in between. i.e.
Note the |
Thanks so much for replying, this got it to run however the coverage is inaccurate unfortunately. It only analyses the unit test js files that don't pull in additional dependencies. I think it is to do with the little script I am using to mock out dependencies when testing a js file in isolation, here is the script that mocks everything else out: (could this be the problem?) var fs = require('fs'), path = require('path'), stacktrace = require('test/lib/stack-trace'), vm = require('vm'); define(function(require) { return function(module, mocks, globalVars) { mocks = mocks || {}; var resolve = function(module, base) { var exports = {}; var sandbox = { }; for (var globalVar in globalVars) { var filepath = resolve(module, caller); vm.runInNewContext(fs.readFileSync(filepath), sandbox); return sandbox.module.exports; From: Krishnan Anantheswaran [email protected] @louisandkatherine did this work for you? |
istanbul works by hooking |
Do u know of another way to load requirejs modules, mock out dependencies I.e. set them to be jasmine spies, inject global vars and get istanbul to work? Thanks again!!!! Sent from Yahoo Mail on Android |
Hi @gotwarlost , can you please give me a hint what might be wrong? I'm using Windows8 and here is what I get in console when I try to cover jasmine-node: > istanbul cover -v --hook-run-in-contex node_modules/jasmine-node/bin/jasmine-node -- --match "test" test
Using configuration
-------------------
verbose: true
instrumentation:
root: .
default-excludes: true
excludes: []
embed-source: false
variable: __coverage__
compact: true
preserve-comments: false
complete-copy: false
save-baseline: false
baseline-file: ./coverage/coverage-baseline.json
preload-sources: false
reporting:
print: summary
reports:
- lcov
dir: ./coverage
watermarks:
statements: [50, 80]
lines: [50, 80]
functions: [50, 80]
branches: [50, 80]
report-config:
clover: {file: clover.xml}
cobertura: {file: cobertura-coverage.xml}
json: {file: coverage-final.json}
json-summary: {file: coverage-summary.json}
lcovonly: {file: lcov.info}
teamcity: {file: null}
text: {file: null, maxCols: 0}
text-summary: {file: null}
hooks:
hook-run-in-context: true
post-require-hook: null
handle-sigint: false
-------------------
Running: node D:\sz\start-template\permissions\node_modules\jasmine-node\bin\jasmine-node --match test test
......
Finished in 0.006 seconds
6 Tests, 0 Failures, 0 Skipped
No coverage information was collected, exit without writing coverage information
If you want to try it yourself my package is |
@gotwarlost basically a usage issue and very old by that. Please close this to raise overall confidence in this nearly perfect tool again. |
Hi all,
Has anyone managed to get jasmine-node working with istanbul
At the moment when I run jasmine-node alone my tests pass:
jasmine-node --runWithRequireJs --captureExceptions --requireJsSetup test/require.config test/specs/*
However when I run it with istanbul:
istanbul cover jasmine-node --runWithRequireJs --captureExceptions --requireJsSetup test/require.config test/specs/*
I get this error:
{ [Error: Cannot find module 'requirejs'] code: 'MODULE_NOT_FOUND' }
Any ideas?
Sorry if I am doing it wrong
The text was updated successfully, but these errors were encountered: