grunt-contrib-jasmine 项目教程

grunt-contrib-jasmine 项目教程

grunt-contrib-jasmineRun jasmine specs headlessly through Headless Chrome项目地址:https://gitcode.com/gh_mirrors/gr/grunt-contrib-jasmine

1. 项目的目录结构及介绍

grunt-contrib-jasmine/
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── examples/
│   ├── custom-options/
│   ├── custom-template/
│   ├── node-unit/
│   ├── phantomjs-node/
│   ├── requirejs/
│   └── simple/
├──Gruntfile.js
├── package.json
├── tasks/
│   ├── jasmine.js
│   ├── options/
│   │   ├── junit.js
│   │   ├── phantomjs.js
│   │   ├── reporter.js
│   │   ├── src.js
│   │   ├── styles.js
│   │   └── template.js
│   └── util/
│       ├── args.js
│       ├── file.js
│       ├── junit.js
│       ├── logger.js
│       ├── phantom.js
│       ├── reporter.js
│       ├── server.js
│       └── template.js
└── test/
    ├── fixtures/
    │   ├── custom-template.html
    │   ├── junit.xml
    │   ├── simple.html
    │   └── simple.js
    ├── helpers/
    │   └── jasmine-2.0.0/
    ├── runner.html
    ├── spec/
    │   ├── custom-options-spec.js
    │   ├── custom-template-spec.js
    │   ├── node-unit-spec.js
    │   ├── phantomjs-node-spec.js
    │   ├── requirejs-spec.js
    │   └── simple-spec.js
    └── util/
        ├── args.js
        ├── file.js
        ├── junit.js
        ├── logger.js
        ├── phantom.js
        ├── reporter.js
        ├── server.js
        └── template.js

目录结构介绍

  • CHANGELOG.md: 项目更新日志。
  • CONTRIBUTING.md: 贡献指南。
  • LICENSE: 项目许可证。
  • README.md: 项目说明文档。
  • examples/: 示例目录,包含多种配置和使用场景的示例。
  • Gruntfile.js: Grunt 配置文件。
  • package.json: 项目依赖和元数据。
  • tasks/: 任务目录,包含 jasmine 任务和相关选项。
  • test/: 测试目录,包含测试用例和辅助文件。

2. 项目的启动文件介绍

Gruntfile.js

Gruntfile.js 是 Grunt 的配置文件,用于定义和配置任务。以下是一个简单的示例:

module.exports = function(grunt) {
  grunt.initConfig({
    jasmine: {
      pivotal: {
        src: 'src/**/*.js',
        options: {
          specs: 'spec/**/*.js',
          helpers: 'spec/helpers/**/*.js'
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-jasmine');
  grunt.registerTask('default', ['jasmine']);
};

启动文件介绍

  • grunt.initConfig({...}): 初始化配置,定义 jasmine 任务的源文件和选项。
  • grunt.loadNpmTasks('grunt-contrib-jasmine'): 加载 grunt-contrib-jasmine 插件。
  • grunt.registerTask('default', ['jasmine']): 注册默认任务,运行 jasmine 任务。

3. 项目的配置文件介绍

package.json

package.json 文件包含了项目的元数据和依赖项。以下是一个示例:

{
  "name": "grunt-contrib-jasmine",
  "version": "3.0.0",
  "description": "Run jasmine specs headlessly through PhantomJS.",
  "main": "tasks/jasmine.js",
  "scripts": {
    "test": "grunt test"
  },
  "repository": {
    "type": "git",
    "url": "git://github.com/gruntjs/grunt-contrib-jasmine.git"
  },
  "keywords": [
    "grunt",
    "plugin",
    "jasmine

grunt-contrib-jasmineRun jasmine specs headlessly through Headless Chrome项目地址:https://gitcode.com/gh_mirrors/gr/grunt-contrib-jasmine

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

岑风霖

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值