GithubHelp home page GithubHelp logo

nyc-expresss-coverage-demo's Introduction

这里使用的例子其实是istanbul-middleware test目录的例子,只是我将其中关于instalbul-middleware库的引用都去掉了,增加了nyc的引用

  1. npm install 安装依赖库
  2. npm run instrument 对服务的代码进行插桩,生成一个插桩后的目录 server-instrument
  3. node index 启动服务, 这个时候服务引用的文件其实是server-instrunment的文件了,因为我在index.js里面将内容做了指定了。
  4. 直接访问 http://localhost:8888 即可看到服务网页的内容,其实就是开始我们的测试了。
  5. 再访问 http://localhost:8888/coverageData 就可以得到覆盖率数据
  6. 我们先麻烦点,将对应的数据放置到根目录的 .nyc_output的a.json 文件中,这里的文件名称可以随意。
  7. nyc run report 就会看到在coverage目录下生成了一个覆盖率的报告了。

nyc-expresss-coverage-demo's People

Contributors

sxyy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.