node.js - node karma fs object empty -


i'm trying run tests on node using karma. i'm running using both phantom , real browsers.

whichever way run error on fs read file functions.

 'undefined' not object (evaluating 'fs.existssync') 

this if have simple file like:

var fs = require('fs'); console.error(fs); var text = fs.readfile('data.txt', 'utf8'); 

the first console writes out object {}. second 1 gives me above error. i'm assuming object empty.

i'm using latest version of karma , dependencies.

can point me in right direction why fs object empty/not working.

karma client side js test runner cannot use node file system on it. test server side js suggest use different test runner mocha. if use mocha server js namely nodejs able use node filesystem.

there way read file client using xmlhttprequest(). refer question javascript - read local text file


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -