HEX
Server: Apache/2.4.61 (Ubuntu)
System: Linux hosting106 7.0.12-1-pve #1 SMP PREEMPT_DYNAMIC PMX 7.0.12-1 (2026-06-09T21:07Z) x86_64
User: clinicadentalargarate.com (1193)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/cursos.ril.es/node_modules/laravel-elixir/node_modules/partialify/test/index.js
var partialify = require('../');
var customPartialify = require('../custom');

var test = require('tape');
var browserify = require('browserify');

var vm = require('vm');
var fs = require('fs');
var path = require('path');

var html = fs.readFileSync(__dirname + '/fixtures/fixture.html', 'utf8');
var css = fs.readFileSync(__dirname + '/fixtures/fixture.css', 'utf8');
var json = fs.readFileSync(__dirname + '/fixtures/fixture.json', 'utf8');
var xml = fs.readFileSync(__dirname + '/fixtures/fixture.xml', 'utf8');
var csv = fs.readFileSync(__dirname + '/fixtures/fixture.csv', 'utf8');
var tplhtml = fs.readFileSync(__dirname + '/fixtures/fixture.tpl.html', 'utf8');

test('require() an HTML file', function (t) {
  t.plan(1);

  var b = browserify();
  b.add(__dirname + '/runners/html.js');
  b.transform(partialify);

  b.bundle(function (err, src) {
    if (err) t.fail(err);
    vm.runInNewContext(src, { console: { log: log } });
  });

  function log (msg) {
    t.equal(msg, html);
  }

});

test('require() a CSS file', function (t) {
  t.plan(1);

  var b = browserify();
  b.add(__dirname + '/runners/css.js');
  b.transform(partialify);

  b.bundle(function (err, src) {
    if (err) t.fail(err);
    vm.runInNewContext(src, { console: { log: log } });
  });

  function log (msg) {
    t.equal(msg, css);
  }

});

test('Default behavior accepts HTML and CSS', function (t) {
  t.plan(2);

  var output = {};

  var b = browserify();
  b.add(__dirname + '/runners/defaults.js');
  b.transform(partialify);

  b.bundle(function (err, src) {
    if (err) t.fail(err);
    vm.runInNewContext(src, { output: output, finish: finish });
  });

  function finish () {
    t.equal(output.html, html);
    t.equal(output.css, css);
  }

});

test('Support for extra file types can be added', function (t) {
  t.plan(4);

  var output = {};

  var b = browserify();
  b.add(__dirname + '/runners/extras.js');
  b.transform(customPartialify.alsoAllow('json', 'xml'));

  b.bundle(function (err, src) {
    if (err) t.fail(err);
    vm.runInNewContext(src, { output: output, finish: finish });
  });

  function finish () {
    t.equal(output.html, html);
    t.equal(output.css, css);
    t.equal(output.json, json);
    t.equal(output.xml, xml);
  }

});

test('Support for extra file types can be added via options', function (t) {
  t.plan(2);

  var output = {};

  var b = browserify();
  b.add(__dirname + '/runners/opts.js');
  b.transform({ alsoAllow: ['xml'] }, partialify);

  b.bundle(function (err, src) {
    if (err) t.fail(err);
    vm.runInNewContext(src, { output: output, finish: finish });
  });

  function finish () {
    t.equal(output.html, html);
    t.equal(output.xml, xml);
  }

});

test('Supported file types list can be completely custom', function (t) {
  t.plan(2);

  var output = {};

  var b = browserify();
  b.add(__dirname + '/runners/unique.js');
  b.transform(customPartialify.onlyAllow(['xml', 'csv']));

  b.bundle(function (err, src) {
    if (err) t.fail(err);
    vm.runInNewContext(src, { output: output, finish: finish });
  });

  function finish () {
    t.equal(output.xml, xml);
    t.equal(output.csv, csv);
  }

});

test('Supported file types list can be completely customized via options', function (t) {
  t.plan(2);

  var output = {};

  var b = browserify();
  b.add(__dirname + '/runners/unique.js');
  b.transform(partialify, {onlyAllow: ['xml', 'csv']});

  b.bundle(function (err, src) {
    if (err) t.fail(err);
    vm.runInNewContext(src, { output: output, finish: finish });
  });

  function finish () {
    t.equal(output.xml, xml);
    t.equal(output.csv, csv);
  }

});

test('Compound file extensions are supported', function (t) {
  t.plan(1);

  var b = browserify();
  b.add(__dirname + '/runners/tpl.html.js');
  b.transform(customPartialify.onlyAllow(['tpl.html']));

  b.bundle(function (err, src) {
    if (err) t.fail(err);
    vm.runInNewContext(src, { console: { log: log } });
  });

  function log (msg) {
    t.equal(msg, tplhtml);
  }

});