Egg: 单元测试时如何临时的停用jwt

Created on 22 Jan 2018  ·  2Comments  ·  Source: eggjs/egg

  • Node Version:
    8.9.4
  • Egg Version:
    2.0
  • Plugin Name:
    egg-jwt
  • Plugin Version:
    [email protected]
  • Platform:
  • Mini Showcase Repository:


尝试使用mock
mm(app.config.jwt, "enable", false)
console.info(JSON.stringify(app.config.jwt))
确实生效了。
但是nodejs.UnauthorizedError: No authentication token found

Most helpful comment

你试下在 plugin.unittest.js 中设置

exports.jwt ={
  enable: false,
  package: 'egg-jwt'
};

All 2 comments

你试下在 plugin.unittest.js 中设置

exports.jwt ={
  enable: false,
  package: 'egg-jwt'
};

可以。 还能这么操作,太爽了。

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fengmk2 picture fengmk2  ·  44Comments

zlab picture zlab  ·  55Comments

atian25 picture atian25  ·  68Comments

itsky365 picture itsky365  ·  62Comments

musicode picture musicode  ·  55Comments