Sha256: 777cda8533f5c2b8c4b991176f0f8a223512e963d7f0ecd43217fc910fd6c04d

Contents?: true

Size: 1.89 KB

Versions: 17

Compression:

Stored size: 1.89 KB

Contents

"use strict";
var vows = require('vows')
, assert = require('assert')
, path = require('path')
, sandbox = require('sandboxed-module');

vows.describe('log4js-abspath').addBatch({
  'options': {
    topic: function() {
      var appenderOptions,
      log4js = sandbox.require(
        '../lib/log4js',
        { requires:
          { './appenders/fake':
            { name: "fake",
              appender: function() {},
              configure: function(configuration, options) {
                appenderOptions = options;
                return function() {};
              }
            }
          }
        }
      ),
      config = {
        "appenders": [
          {
            "type" : "fake",
            "filename" : "cheesy-wotsits.log"
          }
        ]
      };
      
      log4js.configure(config, {
        cwd: '/absolute/path/to'
      });
      return appenderOptions;
    },
    'should be passed to appenders during configuration': function(options) {
      assert.equal(options.cwd, '/absolute/path/to');
    }
  },

  'file appender': {
    topic: function() {
      var fileOpened,
      fileAppender = sandbox.require(
        '../lib/appenders/file',
        { requires:
          { '../streams':
            { RollingFileStream: 
              function(file) {
                fileOpened = file;
                return {
                  on: function() {},
                  end: function() {}
                };
              }
            }
          }
        }
      );
      fileAppender.configure(
        { 
          filename: "whatever.log", 
          maxLogSize: 10 
        }, 
        { cwd: '/absolute/path/to' }
      );
      return fileOpened;
    },
    'should prepend options.cwd to config.filename': function(fileOpened) {
      var expected = path.sep + path.join("absolute", "path", "to", "whatever.log");
      assert.equal(fileOpened, expected);
    }
  },
}).export(module);

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
hooch-0.4.2 jasmine/node_modules/karma/node_modules/log4js/test/log-abspath-test.js
hooch-0.4.1 jasmine/node_modules/karma/node_modules/log4js/test/log-abspath-test.js
hooch-0.4.0 jasmine/node_modules/karma/node_modules/log4js/test/log-abspath-test.js
hooch-0.3.0 jasmine/node_modules/karma/node_modules/log4js/test/log-abspath-test.js
hooch-0.2.1 jasmine/node_modules/karma/node_modules/log4js/test/log-abspath-test.js
hooch-0.2.0 jasmine/node_modules/karma/node_modules/log4js/test/log-abspath-test.js
hooch-0.1.0 jasmine/node_modules/karma/node_modules/log4js/test/log-abspath-test.js
hooch-0.0.8 jasmine/node_modules/karma/node_modules/log4js/test/log-abspath-test.js
hooch-0.0.7 jasmine/node_modules/karma/node_modules/log4js/test/log-abspath-test.js
hooch-0.0.6 jasmine/node_modules/karma/node_modules/log4js/test/log-abspath-test.js
entangled-0.0.16 spec/dummy/public/node_modules/karma/node_modules/log4js/test/log-abspath-test.js
entangled-0.0.15 spec/dummy/public/node_modules/karma/node_modules/log4js/test/log-abspath-test.js
entangled-0.0.14 spec/dummy/public/node_modules/karma/node_modules/log4js/test/log-abspath-test.js
entangled-0.0.13 spec/dummy/public/node_modules/karma/node_modules/log4js/test/log-abspath-test.js
entangled-0.0.12 spec/dummy/public/node_modules/karma/node_modules/log4js/test/log-abspath-test.js
entangled-0.0.11 spec/dummy/public/node_modules/karma/node_modules/log4js/test/log-abspath-test.js
entangled-0.0.10 spec/dummy/public/node_modules/karma/node_modules/log4js/test/log-abspath-test.js