Server IP : 127.0.0.2 / Your IP : 18.217.0.242 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,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,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/npm/node_modules/npm-package-arg/test/ |
Upload File : |
var npa = require("../npa.js") var path = require("path") require("tap").test("basic", function (t) { t.setMaxListeners(999) var tests = { "foo@1.2": { name: "foo", type: "range", spec: ">=1.2.0 <1.3.0", raw: "foo@1.2", rawSpec: "1.2" }, "@foo/bar": { raw: "@foo/bar", name: "@foo/bar", scope: "@foo", rawSpec: "", spec: "latest", type: "tag" }, "@foo/bar@": { raw: "@foo/bar@", name: "@foo/bar", scope: "@foo", rawSpec: "", spec: "latest", type: "tag" }, "@foo/bar@baz": { raw: "@foo/bar@baz", name: "@foo/bar", scope: "@foo", rawSpec: "baz", spec: "baz", type: "tag" }, "@f fo o al/ a d s ;f ": { raw: "@f fo o al/ a d s ;f", name: null, rawSpec: "@f fo o al/ a d s ;f", spec: path.resolve("@f fo o al/ a d s ;f"), type: "local" }, "foo@1.2.3": { name: "foo", type: "version", spec: "1.2.3", raw: "foo@1.2.3" }, "foo@=v1.2.3": { name: "foo", type: "version", spec: "1.2.3", raw: "foo@=v1.2.3", rawSpec: "=v1.2.3" }, "git+ssh://git@notgithub.com/user/foo#1.2.3": { name: null, type: "git", spec: "ssh://git@notgithub.com/user/foo#1.2.3", raw: "git+ssh://git@notgithub.com/user/foo#1.2.3" }, "git+file://path/to/repo#1.2.3": { name: null, type: "git", spec: "file://path/to/repo#1.2.3", raw: "git+file://path/to/repo#1.2.3" }, "git://notgithub.com/user/foo": { name: null, type: "git", spec: "git://notgithub.com/user/foo", raw: "git://notgithub.com/user/foo" }, "@foo/bar@git+ssh://notgithub.com/user/foo": { name: "@foo/bar", scope: "@foo", spec: "ssh://notgithub.com/user/foo", rawSpec: "git+ssh://notgithub.com/user/foo", raw: "@foo/bar@git+ssh://notgithub.com/user/foo" }, "/path/to/foo": { name: null, type: "local", spec: path.resolve(__dirname, "/path/to/foo"), raw: "/path/to/foo" }, "file:path/to/foo": { name: null, type: "local", spec: "path/to/foo", raw: "file:path/to/foo" }, "file:~/path/to/foo": { name: null, type: "local", spec: "~/path/to/foo", raw: "file:~/path/to/foo" }, "file:../path/to/foo": { name: null, type: "local", spec: "../path/to/foo", raw: "file:../path/to/foo" }, "file:///path/to/foo": { name: null, type: "local", spec: "/path/to/foo", raw: "file:///path/to/foo" }, "https://server.com/foo.tgz": { name: null, type: "remote", spec: "https://server.com/foo.tgz", raw: "https://server.com/foo.tgz" }, "foo@latest": { name: "foo", type: "tag", spec: "latest", raw: "foo@latest" }, "foo": { name: "foo", type: "tag", spec: "latest", raw: "foo" } } Object.keys(tests).forEach(function (arg) { var res = npa(arg) t.type(res, "Result", arg + " is result") t.has(res, tests[arg], arg + " matches expectations") }) // Completely unreasonable invalid garbage throws an error t.throws(function() { npa("this is not a \0 valid package name or url") }) t.throws(function() { npa("gopher://yea right") }, "Unsupported URL Type: gopher://yea right") t.end() })