-Suppose I have a file in the root of my project called \"file.xml\"
-Suppose I have a test file in tests/ called \"test.js\" and it has
const file =
You can resolve the path relative the location of the source file - rather than the current directory - using path.resolve:
const path = require("path"); const file = fs.readFileSync(path.resolve(__dirname, "../file.xml"));