UI for Zipcoin Blue

test.js 1.0KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /* global describe, it */
  2. var requireMainFilename = require('./')
  3. require('tap').mochaGlobals()
  4. require('chai').should()
  5. describe('require-main-filename', function () {
  6. it('returns require.main.filename in normal circumstances', function () {
  7. requireMainFilename().should.match(/test\.js/)
  8. })
  9. it('should use children[0].filename when running on iisnode', function () {
  10. var main = {
  11. filename: 'D:\\Program Files (x86)\\iisnode\\interceptor.js',
  12. children: [ {filename: 'D:\\home\\site\\wwwroot\\server.js'} ]
  13. }
  14. requireMainFilename({
  15. main: main
  16. }).should.match(/server\.js/)
  17. })
  18. it('should not use children[0] if no children exist', function () {
  19. var main = {
  20. filename: 'D:\\Program Files (x86)\\iisnode\\interceptor.js',
  21. children: []
  22. }
  23. requireMainFilename({
  24. main: main
  25. }).should.match(/interceptor\.js/)
  26. })
  27. it('should default to process.cwd() if require.main is undefined', function () {
  28. requireMainFilename({}).should.match(/require-main-filename/)
  29. })
  30. })