Comparing version 3.15.1 to 3.16.0
@@ -62,3 +62,10 @@ 'use strict'; | ||
} | ||
mm(this.context, 'session', Object.assign({ save() {} }, data)); | ||
if (is.object(data) && !data.save) { | ||
Object.defineProperty(data, 'save', { | ||
value: () => {}, | ||
enumerable: false, | ||
}); | ||
} | ||
mm(this.context, 'session', data); | ||
return this; | ||
@@ -65,0 +72,0 @@ }, |
@@ -8,2 +8,3 @@ 'use strict'; | ||
if (process.env.EGG_BASE_DIR) options.baseDir = process.env.EGG_BASE_DIR; | ||
if (process.env.EGG_TYPESCRIPT) options.typescript = process.env.EGG_TYPESCRIPT; | ||
const app = mock.app(options); | ||
@@ -10,0 +11,0 @@ |
3.16.0 / 2018-03-28 | ||
=================== | ||
* feat: support ts (#70) | ||
* fix: mockSession save should not be enumerable (#69) | ||
3.15.1 / 2018-03-20 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -85,2 +85,7 @@ import { Application, Context } from 'egg'; | ||
clean?: boolean; | ||
/** | ||
* Enable typescript support | ||
*/ | ||
typescript?: boolean; | ||
} | ||
@@ -87,0 +92,0 @@ |
@@ -54,2 +54,3 @@ 'use strict'; | ||
* - {String} framework - The directory of the egg framework | ||
* - {Boolean} [typescript] - Enable TypeScript support | ||
* - {Boolean} [cache=true] - Cache application based on baseDir | ||
@@ -56,0 +57,0 @@ * - {Boolean} [coverage=true] - Swtich on process coverage, but it'll be slower |
{ | ||
"name": "egg-mock", | ||
"version": "3.15.1", | ||
"version": "3.16.0", | ||
"eggPlugin": { | ||
@@ -5,0 +5,0 @@ "name": "egg-mock" |
@@ -188,3 +188,3 @@ # egg-mock | ||
Environment list https://github.com/eggjs/egg-core/blob/master/lib/loader/egg_loader.js#L82 | ||
Environment list <https://github.com/eggjs/egg-core/blob/master/lib/loader/egg_loader.js#L82> | ||
@@ -196,3 +196,3 @@ ### mm.consoleLevel(level) | ||
```js | ||
// 不输出到终端 | ||
// DON'T log to terminal | ||
mm.consoleLevel('NONE'); | ||
@@ -270,2 +270,8 @@ ``` | ||
#### typescript {Boolean} | ||
Enable Typescript support, default is false. | ||
Support read from `process.env.EGG_TYPESCRIPT`. | ||
### app.httpRequest() | ||
@@ -347,3 +353,2 @@ | ||
### app.mockService(service, methodName, fn) | ||
@@ -356,3 +361,3 @@ | ||
}); | ||
const ctx = app.mockContext(); | ||
const ctx = app.mockContext(); | ||
yield ctx.service.user.getName(); | ||
@@ -370,3 +375,3 @@ }); | ||
### app.mockCsrf(); | ||
### app.mockCsrf() | ||
@@ -373,0 +378,0 @@ ```js |
@@ -193,3 +193,3 @@ # egg-mock | ||
具体值见 https://github.com/eggjs/egg-core/blob/master/lib/loader/egg_loader.js#L82 | ||
具体值见 <https://github.com/eggjs/egg-core/blob/master/lib/loader/egg_loader.js#L82> | ||
@@ -207,3 +207,2 @@ ### mm.consoleLevel(level) | ||
### mm.home(homePath) | ||
@@ -281,2 +280,8 @@ | ||
#### typescript {Boolean} | ||
开启 TypeScript 支持,默认关闭。 | ||
支持读取环境变量 `process.env.EGG_TYPESCRIPT`。 | ||
### app.httpRequest() | ||
@@ -367,3 +372,3 @@ | ||
}); | ||
const ctx = app.mockContext(); | ||
const ctx = app.mockContext(); | ||
yield ctx.service.user.getName(); | ||
@@ -381,3 +386,3 @@ }); | ||
### app.mockCsrf(); | ||
### app.mockCsrf() | ||
@@ -384,0 +389,0 @@ 模拟 csrf,不用传递 token |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73276
21
1403
444
17814
17
5