1 | module.exports = function (grunt) {
|
2 | grunt.initConfig({
|
3 | pkgFile: 'package.json',
|
4 | clean: {
|
5 | default: ['build'],
|
6 | test: ['.allure-results']
|
7 | },
|
8 | babel: {
|
9 | options: {
|
10 | sourceMap: false,
|
11 | optional: ['runtime']
|
12 | },
|
13 | dist: {
|
14 | files: [{
|
15 | expand: true,
|
16 | cwd: './lib',
|
17 | src: ['**/*.js'],
|
18 | dest: 'build',
|
19 | ext: '.js'
|
20 | }]
|
21 | }
|
22 | },
|
23 | eslint: {
|
24 | options: {
|
25 | parser: 'babel-eslint'
|
26 | },
|
27 | target: ['lib/**/*.js', 'test/**/*.js']
|
28 | },
|
29 | contributors: {
|
30 | options: {
|
31 | commitMessage: 'update contributors'
|
32 | }
|
33 | },
|
34 | bump: {
|
35 | options: {
|
36 | commitMessage: 'v%VERSION%',
|
37 | pushTo: 'upstream'
|
38 | }
|
39 | },
|
40 | watch: {
|
41 | dist: {
|
42 | files: './lib/**/*.js',
|
43 | tasks: ['babel:dist']
|
44 | }
|
45 | },
|
46 | mochaTest: {
|
47 | test: {
|
48 | options: {
|
49 | require: ['babel/register'],
|
50 | reporter: 'spec',
|
51 | quiet: false,
|
52 | timeout: 8000
|
53 | },
|
54 | src: 'test/specs/*.js'
|
55 | }
|
56 | },
|
57 | connect: {
|
58 | testpage: {
|
59 | options: {
|
60 | port: 8080,
|
61 | base: './test/fixtures'
|
62 | }
|
63 | }
|
64 | }
|
65 | })
|
66 |
|
67 | require('load-grunt-tasks')(grunt)
|
68 | grunt.registerTask('default', ['eslint', 'build'])
|
69 | grunt.registerTask('build', 'Build wdio-allure-reporter', function () {
|
70 | grunt.task.run([
|
71 | 'clean',
|
72 | 'babel'
|
73 | ])
|
74 | })
|
75 | grunt.registerTask('release', 'Bump and tag version', function (type) {
|
76 | grunt.task.run([
|
77 | 'build',
|
78 | 'contributors',
|
79 | 'bump:' + (type || 'patch')
|
80 | ])
|
81 | })
|
82 | grunt.registerTask('test', 'Integration Tests', [
|
83 | 'connect',
|
84 | 'mochaTest'
|
85 | ])
|
86 | }
|