source: Dev/trunk/node_modules/grunt-zip/test/grunt.js @ 484

Last change on this file since 484 was 484, checked in by hendrikvanantwerpen, 11 years ago

Commit node_modules, to make checkouts and builds more deterministic.

File size: 3.2 KB
Line 
1var path = require('path');
2module.exports = function (grunt) {
3
4  // Project configuration.
5  grunt.initConfig({
6    pkg: require('../package.json'),
7    clean: ['actual/'],
8    zip: {
9      single: {
10        src: ['test_files/file.js'],
11        dest: 'actual/single_zip/file.zip'
12      },
13      multi: {
14        src: ['test_files/file.js', 'test_files/file2.js'],
15        dest: 'actual/multi_zip/file.zip'
16      },
17      nested: {
18        src: 'test_files/nested/**/*',
19        dest: 'actual/nested_zip/file.zip'
20      },
21      image: {
22        src: 'test_files/smile.gif',
23        dest: 'actual/image_zip/file.zip'
24      },
25      router: {
26        src: ['test_files/nested/hello.js', 'test_files/nested/nested2/hello10.txt'],
27        dest: 'actual/router_zip/file.zip',
28        router: function (filepath) {
29          var filename = path.basename(filepath);
30          return filename;
31        }
32      },
33      cwd: {
34        src: ['test_files/nested/hello.js', 'test_files/nested/nested2/hello10.txt'],
35        dest: 'actual/cwd_zip/file.zip',
36        cwd: 'test_files/nested'
37      },
38      dot: {
39        src: ['test_files/dot/.test/hello.js', 'test_files/dot/test/.examplerc'],
40        dest: 'actual/dot_zip/file.zip',
41        dot: true
42      },
43      'skip-files': {
44        src: ['test_files/nested/hello.js', 'test_files/nested/nested2/hello10.txt'],
45        dest: 'actual/skip_files_zip/file.zip',
46        router: function (filepath) {
47          // Skip over txt files
48          return filepath.indexOf('.txt') === -1 ? filepath : null;
49        }
50      }
51    },
52    unzip: {
53      single: {
54        src: 'test_files/file.zip',
55        dest: 'actual/single_unzip'
56      },
57      nested: {
58        src: 'test_files/nested.zip',
59        dest: 'actual/nested_unzip'
60      },
61      router: {
62        src: 'test_files/nested.zip',
63        dest: 'actual/router_unzip',
64        router: function (filepath) {
65          var filename = path.basename(filepath);
66          return filename;
67        }
68      },
69      'skip-files': {
70        src: 'test_files/nested.zip',
71        dest: 'actual/skip_files_unzip',
72        router: function (filepath) {
73          // Skip over css files
74          return filepath.indexOf('.css') === -1 ? filepath : null;
75        }
76      },
77      'test-zip-nested': {
78        src: 'actual/nested_zip/file.zip',
79        dest: 'actual/nested_zip/unzip'
80      },
81      'test-zip-image': {
82        src: 'actual/image_zip/file.zip',
83        dest: 'actual/image_zip/unzip'
84      },
85      'test-zip-router': {
86        src: 'actual/router_zip/file.zip',
87        dest: 'actual/router_zip/unzip'
88      },
89      'test-zip-cwd': {
90        src: 'actual/cwd_zip/file.zip',
91        dest: 'actual/cwd_zip/unzip'
92      },
93      'test-zip-dot': {
94        src: 'actual/dot_zip/file.zip',
95        dest: 'actual/dot_zip/unzip'
96      },
97      'test-zip-skip-files': {
98        src: 'actual/skip_files_zip/file.zip',
99        dest: 'actual/skip_files_zip/unzip'
100      }
101    },
102    test: {
103      common: 'zip_test.js'
104    }
105  });
106
107  // Load local tasks.
108  grunt.loadTasks('../tasks');
109
110  // Load grunt contrib clean (chdir for 0.4)
111  process.chdir('..');
112  grunt.loadNpmTasks('grunt-contrib-clean');
113  process.chdir(__dirname);
114
115  // Run project task then tests.
116  grunt.registerTask('default', 'clean zip unzip test');
117};
Note: See TracBrowser for help on using the repository browser.