如何在Node.js中构buildTDD?

我有我的文件夹结构如下:

backend |-Process1 |-Process2 |-app |-config |-controllers |-models public |-css |-js 

我应该在哪里放置我的unit testing文件夹?

对于节点项目,通常在顶层有一个testing文件夹。 例如,对于我的项目,我通常有这些文件夹:

  • bin (箱)
  • lib (用于我的node.js库文件)
  • test (testing)
  • config (对于configuration文件,如有必要)
  • publicstatic (如果需要,用于静态资产)
  • node_modules (其中node_modules安装的模块最终会去)

在大多数情况下,只要组织好代码并且有明显的切入点,就不会太关键。 基本上,你应该可以input“npm test”,并通过从package.json读取命令来工作。

    Interesting Posts