Skip to content

Commit

Permalink
fix: clear req cache when unit start running
Browse files Browse the repository at this point in the history
  • Loading branch information
sigoden committed Jun 6, 2021
1 parent 08f3f40 commit cd66e1d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default class Session {
return this.cache.cursor;
}

public async getCtx(testcase: Case): Promise<VmContext> {
public async getCtx(testcase: Case, reset = false): Promise<VmContext> {
const idx = this.unitIds.findIndex(v => v === testcase.id);
const state = { env: _.clone(process.env) };
if (idx > -1) {
Expand All @@ -53,7 +53,7 @@ export default class Session {
if (local) Object.assign(state, local);
if (
!testcase.group &&
typeof _.get(state, ["req"]) === "undefined" &&
(typeof _.get(state, ["req"]) === "undefined" || reset) &&
(testcase as Unit).req.type === "Object") {
const req = {};
_.set(state, ["req"], req);
Expand Down

0 comments on commit cd66e1d

Please sign in to comment.