Uname:Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64

Base Dir : /var/www/html

User : gavin


403WebShell
403Webshell
Server IP : 68.183.124.220  /  Your IP : 216.73.217.137
Web Server : Apache/2.4.18 (Ubuntu)
System : Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64
User : gavin ( 1000)
PHP Version : 7.0.33-0ubuntu0.16.04.16
Disable Function : 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_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/gavin/workspace/readjs/node_modules/gulp-ng-annotate/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/gavin/workspace/readjs/node_modules/gulp-ng-annotate/test.js
"use strict";

var Readable = require("stream").Readable;
var assert = require("assert");
var gutil = require("gulp-util");
var ngAnnotate = require("./index");
var sourcemaps = require("gulp-sourcemaps");

var ORIGINAL = 'angular.module("test"); m.directive("foo", function($a, $b) {});';
var TRANSFORMED = 'angular.module("test"); m.directive("foo", ["$a", "$b", function($a, $b) {}]);';
var BAD_INPUT = 'angular.module("test").directive("foo", function$a, $b) {});';

describe("gulp-ng-annotate", function() {
  it("should annotate angular declarations", function (done) {
    var stream = ngAnnotate();

    stream.on("data", function (data) {
      assert.equal(data.contents.toString(), TRANSFORMED);
      done();
    });

    stream.write(new gutil.File({contents: new Buffer(ORIGINAL)}));
  });

  it("should not touch already annotated declarations", function (done) {
    var stream = ngAnnotate();

    stream.on("data", function (data) {
      assert.equal(data.contents.toString(), TRANSFORMED);
      done();
    });

    stream.write(new gutil.File({contents: new Buffer(TRANSFORMED)}));
  });

  it("should emit PluginError on bad input", function (done) {
    var stream = ngAnnotate();

    try {
      stream.write(new gutil.File({contents: new Buffer(BAD_INPUT)}));
    } catch (err) {
      assert(err instanceof gutil.PluginError);
      assert.equal(err.message.slice(0, 7), "error: ")
      done();
    }
  });

  it("should support passing ng-annotate options", function (done) {
    var stream = ngAnnotate({remove: true});

    stream.on("data", function (data) {
      assert.equal(data.contents.toString(), ORIGINAL);
      done();
    });

    stream.write(new gutil.File({contents: new Buffer(TRANSFORMED)}));
  });

  it("should show filename on error", function (done) {
    var stream = ngAnnotate();

    try {
      stream.write(new gutil.File({path: "1.js", contents: new Buffer(BAD_INPUT)}));
    } catch (err) {
      assert(err instanceof gutil.PluginError);
      assert.equal(err.message.slice(0, 13), "1.js: error: ")
      done();
    }
  });

  it("should support source maps", function (done) {
    var stream = sourcemaps.init()
    stream.write(new gutil.File({path: "1.js", contents: new Buffer(ORIGINAL)}));
    stream.pipe(ngAnnotate()).on("data", function (data) {
      assert.equal(data.contents.toString(), TRANSFORMED);
      assert.deepEqual(data.sourceMap.sourcesContent, [ORIGINAL]);
      assert.deepEqual(data.sourceMap.sources, ["1.js"]);
      done();
    });
  });

  it("should allow to skip source map generation", function (done) {
    var stream = sourcemaps.init()
    stream.write(new gutil.File({path: "1.js", contents: new Buffer(ORIGINAL)}));
    stream.pipe(ngAnnotate({map: false})).on("data", function (data) {
      assert.equal(data.sourceMap.mappings, "");
      done();
    });
  });

  it("should preserve file attribute in the sourcemap object", function (done) {
    var stream = sourcemaps.init()
    stream.write(new gutil.File({path: "1.js", contents: new Buffer(ORIGINAL)}));
    stream.pipe(ngAnnotate()).on("data", function (data) {
      assert.equal(data.sourceMap.file, "1.js");
      done();
    });
  });

  it("should support streams", function(done) {
    var stream = ngAnnotate();
    var contentsStream = new Readable();
    contentsStream.push(ORIGINAL);
    contentsStream.push(null);

    stream.on("data", function (file) {
      file.contents.on("data", function(data) {
        assert.equal(data, TRANSFORMED);
        done();
      });
    });

    stream.write(new gutil.File({contents: contentsStream}));
  });
});

Youez - 2016 - github.com/yon3zu
LinuXploit