Q: How to read path from relative path via the library used in meteor 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?

A: You should use Npm.depends when your Meteor package depends on a npm package.
EDIT:
I created the following package inside a Meteor app and it works:
package.js
Package.describe({
  name: 'npmtest',
  version: '0.0.1',
  // Brief, one-line summary of the package.
  summary: '',
  // URL to the Git repository containing the source code for this package.
  git: '',
  // By default, Meteor will default to using README.md for documentation.
  // To avoid submitting documentation, set this field to null.
  documentation: 'README.md'
});

Package.onUse(function(api) {
  api.versionsFrom('1.5.1');
  api.use('ecmascript');
  api.mainModule('npmtest.js');

});

Package.onTest(function(api) {
  api.use('ecmascript');
  api.use('tinytest');
  api.use('npmtest');
  api.mainModule('npmtest-tests.js');
});

Npm.depends({
    'jsonpath':'1.0.0'
})

npmtest-tests.js
// Import Tinytest from the tinytest Meteor package.
import { Tinytest } from "meteor/tinytest";

// Import and rename a variable exported by npmtest.js.
import { name as packageName } from "meteor/npmtest";
const jp = Npm.require("jsonpath");
// Write your tests here!
// Here is an example.
Tinytest.add('npmtest - example', function (test) {
  console.log("here")
  const cities = [
    { name: "London", "population": 8615246 },
    { name: "Berlin", "population": 3517424 },
    { name: "Madrid", "population": 3165235 },
    { name: "Rome",   "population": 2870528 }
  ];
  const names = jp.query(cities, '$..name');

  test.equal(names[0], "London");
});

EDIT2:
Note : I never used npm install
