egg-mock
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -39,3 +39,3 @@ 'use strict'; | ||
// 使用者自定义mock,可以覆盖上面的 mock | ||
for (let key in data) { | ||
for (const key in data) { | ||
mm(this.context, key, data[key]); | ||
@@ -117,3 +117,3 @@ } | ||
// 确保 mockProxy(name, proxyName, normalFunction) 也能够兼容 | ||
mm(obj, name, function*() { | ||
mm(obj, name, function* () { | ||
return fn.apply(this, arguments); | ||
@@ -129,3 +129,3 @@ }); | ||
if (is.generatorFunction(origin)) { | ||
mm(obj, name, function*() { | ||
mm(obj, name, function* () { | ||
if (data instanceof Error) { | ||
@@ -159,3 +159,3 @@ throw data; | ||
const headers = req.headers || {}; | ||
for (let key in req.headers) { | ||
for (const key in req.headers) { | ||
headers[key.toLowerCase()] = req.headers[key]; | ||
@@ -249,3 +249,3 @@ } | ||
this.mockCookies({ | ||
ctoken: ctoken, | ||
ctoken, | ||
}); | ||
@@ -333,3 +333,3 @@ this.mockHeaders({ | ||
req: { | ||
url: url, | ||
url, | ||
options: opt, | ||
@@ -372,3 +372,3 @@ size: mockResult.requestSize, | ||
*/ | ||
loadAgent: function() {}, | ||
loadAgent() {}, | ||
@@ -381,3 +381,3 @@ /** | ||
*/ | ||
mockEnv: function(env) { | ||
mockEnv(env) { | ||
mm(this.config, 'env', env); | ||
@@ -394,3 +394,3 @@ mm(this.config, 'serverEnv', env); | ||
key = key.toLowerCase(); | ||
for (let headerKey in headers) { | ||
for (const headerKey in headers) { | ||
if (key === headerKey.toLowerCase()) { | ||
@@ -397,0 +397,0 @@ return headers[headerKey]; |
0.0.5 / 2016-10-11 | ||
================== | ||
* feat: pass opt to coffee (#7) | ||
0.0.4 / 2016-08-16 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -7,3 +7,2 @@ 'use strict'; | ||
/** | ||
@@ -51,3 +50,3 @@ * @namespace mm | ||
* mock console level | ||
* @param {String} level | ||
* @param {String} level - logger level | ||
*/ | ||
@@ -54,0 +53,0 @@ consoleLevel(level) { |
@@ -21,3 +21,3 @@ 'use strict'; | ||
const agent = getAgent(options); | ||
const app = getApp(Object.assign({}, options, {agent})); | ||
const app = getApp(Object.assign({}, options, { agent })); | ||
merge(app, agent); | ||
@@ -24,0 +24,0 @@ |
@@ -47,8 +47,12 @@ 'use strict'; | ||
* - {String} customEgg - The directory of the egg framework | ||
* - {Boolean} [true] cache - Cache application based on baseDir | ||
* - {Boolean} [true] coverage - Swtich on process coverage, but it'll be slower | ||
* - {Boolean} [true] clean - Remove $baseDir/logs | ||
* - {Boolean} [cache=true] - Cache application based on baseDir | ||
* - {Boolean} [coverage=true] - Swtich on process coverage, but it'll be slower | ||
* - {Boolean} [clean=true] - Remove $baseDir/logs | ||
* - {Object} [opt] - opt pass to coffee, such as { execArgv: ['--debug'] } | ||
* ``` | ||
*/ | ||
constructor(options) { | ||
const opt = options.opt; | ||
delete options.opt; | ||
// incremental port | ||
@@ -60,3 +64,3 @@ options.port = ++masterPort; | ||
const args = [ JSON.stringify(options) ]; | ||
debug('fork %s, args: %s', serverBin, args.join(' ')); | ||
debug('fork %s, args: %s, opt: %j', serverBin, args.join(' '), opt); | ||
super({ | ||
@@ -66,2 +70,3 @@ method: 'fork', | ||
args, | ||
opt, | ||
}); | ||
@@ -93,2 +98,5 @@ | ||
break; | ||
default: | ||
// ignore it | ||
break; | ||
} | ||
@@ -95,0 +103,0 @@ }); |
@@ -8,3 +8,2 @@ 'use strict'; | ||
/** | ||
@@ -36,4 +35,3 @@ * format the options | ||
options.plugin = false; | ||
} | ||
else if (!options.customEgg) { | ||
} else if (!options.customEgg) { | ||
options.customEgg = getFrameworkOrEggPath(process.cwd()); | ||
@@ -40,0 +38,0 @@ } |
{ | ||
"name": "egg-mock", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"eggPlugin": { | ||
@@ -15,3 +15,3 @@ "name": "egg-mock" | ||
"scripts": { | ||
"lint": "eslint lib index.js test/*.test.js", | ||
"lint": "eslint lib app index.js test/*.test.js", | ||
"test": "npm run lint && npm run test-local", | ||
@@ -22,6 +22,7 @@ "test-local": "egg-bin test", | ||
"autod": "autod -w --prefix '^'", | ||
"autod-china": "autod --registry=https://registry.npm.taobao.org", | ||
"contributors": "ali-contributors" | ||
}, | ||
"dependencies": { | ||
"coffee": "^3.2.4", | ||
"coffee": "^3.2.5", | ||
"debug": "^2.2.0", | ||
@@ -32,13 +33,14 @@ "egg-utils": "^1.0.0", | ||
"merge-descriptors": "^1.0.1", | ||
"mm": "^1.5.0", | ||
"rimraf": "^2.5.3" | ||
"mm": "^2.0.0", | ||
"rimraf": "^2.5.4" | ||
}, | ||
"devDependencies": { | ||
"autod": "*", | ||
"egg-bin": "^1.0.0", | ||
"egg-ci": "^1.0.2", | ||
"eslint": "2", | ||
"eslint-config-egg": "2", | ||
"autod": "^2.7.1", | ||
"egg": "^0.1.1", | ||
"egg-bin": "^1.3.0", | ||
"egg-ci": "^1.0.3", | ||
"eslint": "^3.4.0", | ||
"eslint-config-egg": "^3.1.0", | ||
"should": "^8.3.0", | ||
"supertest": "^1.2.0" | ||
"supertest": "^2.0.0" | ||
}, | ||
@@ -45,0 +47,0 @@ "ci": { |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
31851
733
8
2
+ Addedany-promise@1.3.0(transitive)
+ Addedko-sleep@1.1.4(transitive)
+ Addedmm@2.5.0(transitive)
+ Addedmuk-prop@1.2.1(transitive)
+ Addedthenify@3.3.1(transitive)
- Removedco-sleep@0.0.1(transitive)
- Removedenable@3.3.0(transitive)
- Removedis-type-of@0.3.1(transitive)
- Removedmm@1.5.2(transitive)
- Removedmuk@0.5.3(transitive)
- Removednative-or-bluebird@1.2.0(transitive)
- Removedsemver@4.3.6(transitive)
- Removedthenify@3.1.1(transitive)
Updatedcoffee@^3.2.5
Updatedmm@^2.0.0
Updatedrimraf@^2.5.4