aboutsummaryrefslogtreecommitdiff
path: root/node_modules/normalize-package-data/test
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-04-20 03:09:25 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-04-24 16:14:29 +0200
commit82f2b76e25a4a67e01ec67e5ebe39d14ad771ea8 (patch)
tree965f6eb89b84d65a62b49008fd972c004832ccd1 /node_modules/normalize-package-data/test
parente6e0cbc387c2a77b48e4065c229daa65bf1aa0fa (diff)
Reorganize module loading.
We now use webpack instead of SystemJS, effectively bundling modules into one file (plus commons chunks) for every entry point. This results in a much smaller extension size (almost half). Furthermore we use yarn/npm even for extension run-time dependencies. This relieves us from manually vendoring and building dependencies. It's also easier to understand for new developers familiar with node.
Diffstat (limited to 'node_modules/normalize-package-data/test')
-rw-r--r--node_modules/normalize-package-data/test/consistency.js4
-rw-r--r--node_modules/normalize-package-data/test/dependencies.js4
-rw-r--r--node_modules/normalize-package-data/test/fixtures/async.json2
-rw-r--r--node_modules/normalize-package-data/test/fixtures/bcrypt.json2
-rw-r--r--node_modules/normalize-package-data/test/fixtures/coffee-script.json2
-rw-r--r--node_modules/normalize-package-data/test/fixtures/http-server.json8
-rw-r--r--node_modules/normalize-package-data/test/fixtures/movefile.json2
-rw-r--r--node_modules/normalize-package-data/test/fixtures/no-description.json2
-rw-r--r--node_modules/normalize-package-data/test/fixtures/node-module_exist.json2
-rw-r--r--node_modules/normalize-package-data/test/fixtures/npm.json2
-rw-r--r--node_modules/normalize-package-data/test/fixtures/request.json2
-rw-r--r--node_modules/normalize-package-data/test/fixtures/underscore.json2
-rw-r--r--node_modules/normalize-package-data/test/normalize.js6
-rw-r--r--node_modules/normalize-package-data/test/normalize.js~253
-rw-r--r--node_modules/normalize-package-data/test/typo.js2
15 files changed, 18 insertions, 277 deletions
diff --git a/node_modules/normalize-package-data/test/consistency.js b/node_modules/normalize-package-data/test/consistency.js
index 4082be25c..6bce17a16 100644
--- a/node_modules/normalize-package-data/test/consistency.js
+++ b/node_modules/normalize-package-data/test/consistency.js
@@ -13,7 +13,7 @@ tap.test("consistent normalization", function(t) {
fs.readdir (__dirname + "/fixtures", function (err, entries) {
// entries = ['coffee-script.json'] // uncomment to limit to a specific file
verifyConsistency = function(entryName, next) {
- warn = function(msg) {
+ warn = function(msg) {
// t.equal("",msg) // uncomment to have some kind of logging of warnings
}
filename = __dirname + "/fixtures/" + entryName
@@ -33,4 +33,4 @@ tap.test("consistent normalization", function(t) {
t.end()
})
}) // fs.readdir
-}) // tap.test \ No newline at end of file
+}) // tap.test
diff --git a/node_modules/normalize-package-data/test/dependencies.js b/node_modules/normalize-package-data/test/dependencies.js
index 3e493ab02..5a5aff5d7 100644
--- a/node_modules/normalize-package-data/test/dependencies.js
+++ b/node_modules/normalize-package-data/test/dependencies.js
@@ -15,7 +15,7 @@ tap.test("warn if dependency contains anything else but a string", function(t) {
devDependencies: { "b": 456},
optionalDependencies: { "c": 789}
}, warn)
-
+
var wanted1 = safeFormat(warningMessages.nonStringDependency, "a", 123)
var wanted2 = safeFormat(warningMessages.nonStringDependency, "b", 456)
var wanted3 = safeFormat(warningMessages.nonStringDependency, "c", 789)
@@ -34,7 +34,7 @@ tap.test("warn if bundleDependencies array contains anything else but strings",
normalize(a={
bundleDependencies: ["abc", 123, {foo:"bar"}]
}, warn)
-
+
var wanted1 = safeFormat(warningMessages.nonStringBundleDependency, 123)
var wanted2 = safeFormat(warningMessages.nonStringBundleDependency, {foo:"bar"})
var wanted2 = safeFormat(warningMessages.nonDependencyBundleDependency, "abc")
diff --git a/node_modules/normalize-package-data/test/fixtures/async.json b/node_modules/normalize-package-data/test/fixtures/async.json
index 5e652a6c6..9fa85b53e 100644
--- a/node_modules/normalize-package-data/test/fixtures/async.json
+++ b/node_modules/normalize-package-data/test/fixtures/async.json
@@ -33,4 +33,4 @@
"scripts": {
"test": "nodeunit test/test-async.js"
}
-} \ No newline at end of file
+}
diff --git a/node_modules/normalize-package-data/test/fixtures/bcrypt.json b/node_modules/normalize-package-data/test/fixtures/bcrypt.json
index 56e6d81b3..2cf3ba9e5 100644
--- a/node_modules/normalize-package-data/test/fixtures/bcrypt.json
+++ b/node_modules/normalize-package-data/test/fixtures/bcrypt.json
@@ -53,4 +53,4 @@
"Sean McArthur <sean.monstar@gmail.com> (https://github.com/seanmonstar)",
"Fanie Oosthuysen <fanie.oosthuysen@gmail.com> (https://github.com/weareu)"
]
-} \ No newline at end of file
+}
diff --git a/node_modules/normalize-package-data/test/fixtures/coffee-script.json b/node_modules/normalize-package-data/test/fixtures/coffee-script.json
index a0b60a9d3..6582289d1 100644
--- a/node_modules/normalize-package-data/test/fixtures/coffee-script.json
+++ b/node_modules/normalize-package-data/test/fixtures/coffee-script.json
@@ -32,4 +32,4 @@
"uglify-js": "~2.2",
"jison": ">=0.2.0"
}
-} \ No newline at end of file
+}
diff --git a/node_modules/normalize-package-data/test/fixtures/http-server.json b/node_modules/normalize-package-data/test/fixtures/http-server.json
index 90c28863a..2ea55eb9a 100644
--- a/node_modules/normalize-package-data/test/fixtures/http-server.json
+++ b/node_modules/normalize-package-data/test/fixtures/http-server.json
@@ -4,11 +4,11 @@
"version": "0.3.0",
"author": "Nodejitsu <support@nodejitsu.com>",
"description": "a simple zero-configuration command-line http server",
- "contributors": [
+ "contributors": [
{
"name": "Marak Squires",
"email": "marak@nodejitsu.com"
- }
+ }
],
"bin": {
"http-server": "./bin/http-server"
@@ -45,9 +45,9 @@
"bundledDependencies": [
"union",
"ecstatic"
- ],
+ ],
"license": "MIT",
"engines": {
"node": ">=0.6"
}
-} \ No newline at end of file
+}
diff --git a/node_modules/normalize-package-data/test/fixtures/movefile.json b/node_modules/normalize-package-data/test/fixtures/movefile.json
index 593387570..07af4acf4 100644
--- a/node_modules/normalize-package-data/test/fixtures/movefile.json
+++ b/node_modules/normalize-package-data/test/fixtures/movefile.json
@@ -18,4 +18,4 @@
"dependencies": {
"node-gyp": "~0.9.1"
}
-} \ No newline at end of file
+}
diff --git a/node_modules/normalize-package-data/test/fixtures/no-description.json b/node_modules/normalize-package-data/test/fixtures/no-description.json
index 9ea70b6bf..8c481e1af 100644
--- a/node_modules/normalize-package-data/test/fixtures/no-description.json
+++ b/node_modules/normalize-package-data/test/fixtures/no-description.json
@@ -1,4 +1,4 @@
{
"name": "foo-bar-package",
"version": "0.0.1"
-} \ No newline at end of file
+}
diff --git a/node_modules/normalize-package-data/test/fixtures/node-module_exist.json b/node_modules/normalize-package-data/test/fixtures/node-module_exist.json
index acc053825..b6786f430 100644
--- a/node_modules/normalize-package-data/test/fixtures/node-module_exist.json
+++ b/node_modules/normalize-package-data/test/fixtures/node-module_exist.json
@@ -23,4 +23,4 @@
"modules"
],
"license": "MIT"
-} \ No newline at end of file
+}
diff --git a/node_modules/normalize-package-data/test/fixtures/npm.json b/node_modules/normalize-package-data/test/fixtures/npm.json
index 2262b3139..b4c704df9 100644
--- a/node_modules/normalize-package-data/test/fixtures/npm.json
+++ b/node_modules/normalize-package-data/test/fixtures/npm.json
@@ -132,4 +132,4 @@
"url": "https://github.com/isaacs/npm/raw/master/LICENSE"
}
]
-} \ No newline at end of file
+}
diff --git a/node_modules/normalize-package-data/test/fixtures/request.json b/node_modules/normalize-package-data/test/fixtures/request.json
index 24189a551..4d58a95c2 100644
--- a/node_modules/normalize-package-data/test/fixtures/request.json
+++ b/node_modules/normalize-package-data/test/fixtures/request.json
@@ -36,4 +36,4 @@
"scripts": {
"test": "node tests/run.js"
}
-} \ No newline at end of file
+}
diff --git a/node_modules/normalize-package-data/test/fixtures/underscore.json b/node_modules/normalize-package-data/test/fixtures/underscore.json
index bfc8b3d26..e27cfd8c6 100644
--- a/node_modules/normalize-package-data/test/fixtures/underscore.json
+++ b/node_modules/normalize-package-data/test/fixtures/underscore.json
@@ -14,4 +14,4 @@
"test": "phantomjs test/vendor/runner.js test/index.html?noglobals=true"
},
"license" : "MIT"
-} \ No newline at end of file
+}
diff --git a/node_modules/normalize-package-data/test/normalize.js b/node_modules/normalize-package-data/test/normalize.js
index 3926938b6..0cd4baf49 100644
--- a/node_modules/normalize-package-data/test/normalize.js
+++ b/node_modules/normalize-package-data/test/normalize.js
@@ -101,8 +101,6 @@ tap.test("urls required", function(t) {
repository: "Hello."
}, warn)
- console.error(a)
-
var expect =
[ warningMessages.missingDescription,
warningMessages.missingRepository,
@@ -129,8 +127,6 @@ tap.test("homepage field must start with a protocol.", function(t) {
homepage: 'example.org'
}, warn)
- console.error(a)
-
var expect =
[ warningMessages.missingDescription,
warningMessages.missingRepository,
@@ -152,8 +148,6 @@ tap.test("license field should be a valid SPDX expression", function(t) {
license: 'Apache 2'
}, warn)
- console.error(a)
-
var expect =
[ warningMessages.missingDescription,
warningMessages.missingRepository,
diff --git a/node_modules/normalize-package-data/test/normalize.js~ b/node_modules/normalize-package-data/test/normalize.js~
deleted file mode 100644
index de6f1ce5b..000000000
--- a/node_modules/normalize-package-data/test/normalize.js~
+++ /dev/null
@@ -1,253 +0,0 @@
-var tap = require("tap")
-var fs = require("fs")
-var path = require("path")
-
-var globals = Object.keys(global)
-
-var normalize = require("../lib/normalize")
-var warningMessages = require("../lib/warning_messages.json")
-var safeFormat = require("../lib/safe_format")
-
-var rpjPath = path.resolve(__dirname,"./fixtures/read-package-json.json")
-
-tap.test("normalize some package data", function(t) {
- var packageData = require(rpjPath)
- var warnings = []
- normalize(packageData, function(warning) {
- warnings.push(warning)
- })
- // there's no readme data in this particular object
- t.equal( warnings.length, 1, "There's exactly one warning.")
- fs.readFile(rpjPath, function(err, data) {
- if(err) throw err
- // Various changes have been made
- t.notEqual(packageData, JSON.parse(data), "Output is different from input.")
- t.end()
- })
-})
-
-tap.test("runs without passing warning function", function(t) {
- var packageData = require(rpjPath)
- fs.readFile(rpjPath, function(err, data) {
- if(err) throw err
- normalize(JSON.parse(data))
- t.ok(true, "If you read this, this means I'm still alive.")
- t.end()
- })
-})
-
-tap.test("empty object", function(t) {
- var packageData = {}
- var expect =
- { name: '',
- version: '',
- readme: 'ERROR: No README data found!',
- _id: '@' }
-
- var warnings = []
- function warn(m) {
- warnings.push(m)
- }
- normalize(packageData, warn)
- t.same(packageData, expect)
- t.same(warnings, [
- warningMessages.missingDescription,
- warningMessages.missingRepository,
- warningMessages.missingReadme,
- warningMessages.missingLicense
- ])
- t.end()
-})
-
-tap.test("core module name", function(t) {
- var warnings = []
- function warn(m) {
- warnings.push(m)
- }
- var a
- normalize(a={
- name: "http",
- readme: "read yourself how about",
- homepage: 123,
- bugs: "what is this i don't even",
- repository: "Hello."
- }, warn)
-
- var expect = [
- safeFormat(warningMessages.conflictingName, 'http'),
- warningMessages.nonEmailUrlBugsString,
- warningMessages.emptyNormalizedBugs,
- warningMessages.nonUrlHomepage,
- warningMessages.missingLicense
- ]
- t.same(warnings, expect)
- t.end()
-})
-
-tap.test("urls required", function(t) {
- var warnings = []
- function warn(w) {
- warnings.push(w)
- }
- normalize({
- bugs: {
- url: "/1",
- email: "not an email address"
- }
- }, warn)
- var a
- normalize(a={
- readme: "read yourself how about",
- homepage: 123,
- bugs: "what is this i don't even",
- repository: "Hello."
- }, warn)
-
- console.error(a)
-
- var expect =
- [ warningMessages.missingDescription,
- warningMessages.missingRepository,
- warningMessages.nonUrlBugsUrlField,
- warningMessages.nonEmailBugsEmailField,
- warningMessages.emptyNormalizedBugs,
- warningMessages.missingReadme,
- warningMessages.missingLicense,
- warningMessages.nonEmailUrlBugsString,
- warningMessages.emptyNormalizedBugs,
- warningMessages.nonUrlHomepage,
- warningMessages.missingLicense]
- t.same(warnings, expect)
- t.end()
-})
-
-tap.test("homepage field must start with a protocol.", function(t) {
- var warnings = []
- function warn(w) {
- warnings.push(w)
- }
- var a
- normalize(a={
- homepage: 'example.org'
- }, warn)
-
- console.error(a)
-
- var expect =
- [ warningMessages.missingDescription,
- warningMessages.missingRepository,
- warningMessages.missingReadme,
- warningMessages.missingProtocolHomepage,
- warningMessages.missingLicense]
- t.same(warnings, expect)
- t.same(a.homepage, 'http://example.org')
- t.end()
-})
-
-tap.test("license field should be a valid SPDX expression", function(t) {
- var warnings = []
- function warn(w) {
- warnings.push(w)
- }
- var a
- normalize(a={
- license: 'Apache 2'
- }, warn)
-
- console.error(a)
-
- var expect =
- [ warningMessages.missingDescription,
- warningMessages.missingRepository,
- warningMessages.missingReadme,
- warningMessages.invalidLicense]
- t.same(warnings, expect)
- t.end()
-})
-
-tap.test("gist bugs url", function(t) {
- var d = {
- repository: "git@gist.github.com:123456.git"
- }
- normalize(d)
- t.same(d.repository, { type: 'git', url: 'git+ssh://git@gist.github.com/123456.git' })
- t.same(d.bugs, { url: 'https://gist.github.com/123456' })
- t.end();
-});
-
-tap.test("singularize repositories", function(t) {
- var d = {repositories:["git@gist.github.com:123456.git"]}
- normalize(d)
- t.same(d.repository, { type: 'git', url: 'git+ssh://git@gist.github.com/123456.git' })
- t.end()
-});
-
-tap.test("treat visionmedia/express as github repo", function(t) {
- var d = {repository: {type: "git", url: "visionmedia/express"}}
- normalize(d)
- t.same(d.repository, { type: "git", url: "git+https://github.com/visionmedia/express.git" })
- t.end()
-});
-
-tap.test("treat isaacs/node-graceful-fs as github repo", function(t) {
- var d = {repository: {type: "git", url: "isaacs/node-graceful-fs"}}
- normalize(d)
- t.same(d.repository, { type: "git", url: "git+https://github.com/isaacs/node-graceful-fs.git" })
- t.end()
-});
-
-tap.test("homepage field will set to github url if repository is a github repo", function(t) {
- var a
- normalize(a={
- repository: { type: "git", url: "https://github.com/isaacs/node-graceful-fs" }
- })
- t.same(a.homepage, 'https://github.com/isaacs/node-graceful-fs#readme')
- t.end()
-})
-
-tap.test("homepage field will set to github gist url if repository is a gist", function(t) {
- var a
- normalize(a={
- repository: { type: "git", url: "git@gist.github.com:123456.git" }
- })
- t.same(a.homepage, 'https://gist.github.com/123456')
- t.end()
-})
-
-tap.test("homepage field will set to github gist url if repository is a shorthand reference", function(t) {
- var a
- normalize(a={
- repository: { type: "git", url: "sindresorhus/chalk" }
- })
- t.same(a.homepage, 'https://github.com/sindresorhus/chalk#readme')
- t.end()
-})
-
-tap.test("don't mangle github shortcuts in dependencies", function(t) {
- var d = {dependencies: {"node-graceful-fs": "isaacs/node-graceful-fs"}}
- normalize(d)
- t.same(d.dependencies, {"node-graceful-fs": "github:isaacs/node-graceful-fs" })
- t.end()
-});
-
-tap.test("deprecation warning for array in dependencies fields", function(t) {
- var a
- var warnings = []
- function warn(w) {
- warnings.push(w)
- }
- normalize(a={
- dependencies: [],
- devDependencies: [],
- optionalDependencies: []
- }, warn)
- t.ok(~warnings.indexOf(safeFormat(warningMessages.deprecatedArrayDependencies, 'dependencies')), "deprecation warning")
- t.ok(~warnings.indexOf(safeFormat(warningMessages.deprecatedArrayDependencies, 'devDependencies')), "deprecation warning")
- t.ok(~warnings.indexOf(safeFormat(warningMessages.deprecatedArrayDependencies, 'optionalDependencies')), "deprecation warning")
- t.end()
-})
-
-tap.test('no new globals', function(t) {
- t.same(Object.keys(global), globals)
- t.end()
-})
diff --git a/node_modules/normalize-package-data/test/typo.js b/node_modules/normalize-package-data/test/typo.js
index 0cd3eb49d..9c2fd70a4 100644
--- a/node_modules/normalize-package-data/test/typo.js
+++ b/node_modules/normalize-package-data/test/typo.js
@@ -10,7 +10,7 @@ test('typos', function(t) {
function warn(m) {
warnings.push(m)
}
-
+
var typoMessage = safeFormat.bind(undefined, warningMessages.typo)
var expect =