UNPKG

2.66 kBJavaScriptView Raw
1'use strict';
2/*
3 * manuscript
4 * http://github.com/typesettin/manuscript
5 *
6 * Copyright (c) 2014 Yaw Joseph Etse. All rights reserved.
7 */
8
9const path = require('path');
10const fs = require('fs-extra');
11let testPaths = 'test/**/*.js';
12
13module.exports = function (grunt) {
14 grunt.initConfig({
15 mocha_istanbul: {
16 coveralls: {
17 src: testPaths, // multiple folders also works
18 options: {
19 coverageFolder: 'coverage', // will check both coverage folders and merge the coverage results
20 coverage:true, // this will make the grunt.event.on('coverage') event listener to be triggered
21 check: {
22 lines: 5,
23 branches: 5,
24 functions: 5,
25 statements: 5,
26 },
27 // root: './lib', // define where the cover task should consider the root of libraries that are covered by tests
28 reportFormats: ['cobertura','lcovonly'],
29 }
30 }
31 },
32 istanbul_check_coverage: {
33 default: {
34 options: {
35 coverageFolder: 'coverage', // will check both coverage folders and merge the coverage results
36 check: {
37 lines: 80,
38 branches: 80,
39 functions: 80,
40 statements: 80,
41 },
42 },
43 },
44 },
45 coveralls: {
46 // Options relevant to all targets
47 options: {
48 // When true, grunt-coveralls will only print a warning rather than
49 // an error, to prevent CI builds from failing unnecessarily (e.g. if
50 // coveralls.io is down). Optional, defaults to false.
51 force: false,
52 },
53
54 all: {
55 // LCOV coverage file (can be string, glob or array)
56 src: 'coverage/*.info',
57 options: {
58 // Any options for just this target
59 },
60 },
61 },
62 simplemocha: {
63 options: {
64 globals: ['should', 'navigator','x'],
65 timeout: 3000,
66 ignoreLeaks: true,
67 ui: 'bdd',
68 reporter: 'spec',
69 },
70 all: {
71 src: testPaths,
72 },
73 },
74 jsdoc: {
75 dist: {
76 src: ['adapters/**/*.js', 'index.js'],
77 options: {
78 destination: 'doc/html',
79 configure: 'jsdoc.json',
80 },
81 },
82 },
83 });
84
85 // Loading dependencies
86 for (var key in grunt.file.readJSON('package.json').devDependencies) {
87 if (key.indexOf('grunt') === 0 && key !== 'grunt') {
88 grunt.loadNpmTasks(key);
89 }
90 }
91 grunt.registerTask('doc', 'jsdoc');
92 grunt.registerTask('test', 'mocha_istanbul');
93 // grunt.registerTask('lint', 'jshint');
94 // grunt.registerTask('default', ['lint', 'browserify', 'doc', 'uglify', 'test', 'less']);
95};
\No newline at end of file