forked from p-baleine/grunt-knex-migrate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
69 lines (55 loc) · 1.66 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
'use strict';
var matchdep = require('matchdep');
module.exports = function(grunt) {
matchdep.filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.initConfig({
jshint: {
all: [
'Gruntfile.js',
'tasks/*.js'
],
options: {
jshintrc: '.jshintrc'
}
},
mochacli: {
all: ['test/**/*.test.js', '!test/tmp/**/*.js']
},
clean: {
example: ['example/**/db/migrate/*.js', 'example/**/db/*.db'],
test: ['test/tmp']
},
mkdir: {
test: {
options: {
create: [
'test/tmp/simple/db',
'test/tmp/staticfile/db',
'test/tmp/function/db'
]
}
}
}
});
grunt.registerTask('swapTestConfig:simple', 'swap `knexmigrate` config', function() {
grunt.config.set('knexmigrate.config', require('./test/simple'));
});
grunt.registerTask('swapTestConfig:staticfile', 'swap `knexmigrate` config', function() {
grunt.config.set('knexmigrate.config', './test/staticfile.json');
});
grunt.registerTask('swapTestConfig:function', 'swap `knexmigrate` config', function() {
grunt.config.set('knexmigrate.config', function(cb) { return cb(null, require('./test/function')); });
});
grunt.registerTask('testrun', 'Test run for knexmigrate', function() {
grunt.task.run([
'swapTestConfig:simple',
'knexmigrate:make:create_posts',
'swapTestConfig:staticfile',
'knexmigrate:make:create_posts',
'swapTestConfig:function',
'knexmigrate:make:create_posts'
]);
});
grunt.loadTasks('tasks');
grunt.registerTask('test', ['clean:test', 'mkdir:test', 'testrun', 'mochacli']);
};