How to read path from relative path via the library used in meteor


#1

I am trying to use anyNpmPackage in meteor project on test.

I have done meteor npm install anyNpmPackage

In my package.js i have

Package.onTest(function(api) {
    api.use([
      'anyNpmPackage'
    ]);
    api.addFiles('tests/server/methods.js', 'server');
});

Now anyNpmPackage uses anyOtherNpmPackage internally

On of the line of anyOtherNpmPackage is

myModule = fs.readFileSync(require.resolve("../include/module.js"));

And when i do the meteor test

I get error Error: Cannot find module '../include/module.js'

And when i debugged just above that line

console.log(fs.readdirSync('../../')) the result was [ 'server', 'web.browser' ] and console.log(__dirname) was resulting to /node_modules/jsonpath/lib

where jsonpath is anyOtherNpmPackage

Any workaround for this issue?