You are misunderstanding what should be happening. The variables defined in your module are not shared. NodeJS scopes them.
You have to return it with module.exports.
a.js
module.exports = "Hello World";
b.js
var test = require('./a.js');
console.log(test);