test.working-dir.js 450 B

123456789101112131415161718192021222324252627
  1. /**
  2. * Module dependencies.
  3. */
  4. var cluster = require('../')
  5. , http = require('http');
  6. require('./common');
  7. var server = http.createServer(function(req, res){
  8. res.writeHead(200);
  9. res.end('Hello World');
  10. });
  11. cluster = cluster(server)
  12. .set('working directory', '/')
  13. .listen(3000);
  14. if (cluster.isWorker) {
  15. process.cwd().should.equal('/');
  16. }
  17. cluster.on('listening', function(){
  18. process.cwd().should.equal('/');
  19. cluster.close();
  20. });