c9-core/node_modules/rusha/Gruntfile.js

174 wiersze
4.2 KiB
JavaScript
Czysty Zwykły widok Historia

2017-05-14 11:22:31 +00:00
module.exports = function (grunt) {
2018-01-04 20:45:33 +00:00
const browsers = ['ChromeHeadless', 'FirefoxHeadless'];
2017-05-14 11:22:31 +00:00
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n',
compress: false
},
build: {
2017-12-15 04:00:53 +00:00
src: 'dist/<%= pkg.name %>.js',
dest: 'dist/<%= pkg.name %>.min.js'
2017-05-14 11:22:31 +00:00
}
},
browserify: {
2017-12-15 04:00:53 +00:00
options: {
transform: ['strictify', 'sweetify', 'babelify'],
plugin: ['browserify-derequire'],
browserifyOptions: {
standalone: 'Rusha'
}
},
build: {
files: {
'dist/rusha.js': ['src/index.js']
}
2017-05-14 11:22:31 +00:00
}
},
2017-12-15 04:00:53 +00:00
karma: {
options: {
basePath: '',
singleRun: true,
logLevel: 'WARN',
files: [],
reporters: ['mocha'],
mochaReporter: {
showDiff: true
},
customLaunchers: {
FirefoxHeadless: {
base: 'Firefox',
flags: ['-headless'],
},
2017-05-14 11:22:31 +00:00
},
2017-12-15 04:00:53 +00:00
browserNoActivityTimeout: 60000
2017-05-14 11:22:31 +00:00
},
2017-12-15 04:00:53 +00:00
unit: {
2017-05-14 11:22:31 +00:00
options: {
2017-12-15 04:00:53 +00:00
frameworks: ['browserify', 'mocha', 'chai'],
files: ['test/unit/*.js'],
preprocessors: {
'test/unit/*.js': ['browserify']
},
2018-01-04 20:45:33 +00:00
browsers
2017-12-15 04:00:53 +00:00
}
},
fuzz: {
options: {
frameworks: ['browserify', 'mocha', 'chai'],
files: ['test/fuzz.js'],
preprocessors: {
'test/fuzz.js': ['browserify']
},
2018-01-04 20:45:33 +00:00
browsers
2017-12-15 04:00:53 +00:00
}
},
functional: {
options: {
frameworks: ['browserify', 'mocha', 'chai-as-promised', 'chai'],
files: ['test/functional/*.js'],
preprocessors: {
'test/functional/*.js': ['browserify']
},
browserify: {
transform: ['brfs']
},
2018-01-04 20:45:33 +00:00
browsers
2017-12-15 04:00:53 +00:00
}
},
compatibilityWithVanillaScript: {
options: {
frameworks: ['mocha', 'chai-as-promised', 'chai'],
files: [
'test/compat/vanilla_script.js',
'dist/rusha.min.js'
],
2018-01-04 20:45:33 +00:00
browsers
2017-12-15 04:00:53 +00:00
}
},
compatibilityWithVanillaWorker: {
options: {
frameworks: ['mocha', 'chai-as-promised', 'chai'],
files: [
'test/compat/vanilla_worker.js',
{pattern: 'dist/rusha.min.js', included: false, served: true}
],
2018-01-04 20:45:33 +00:00
browsers
2017-12-15 04:00:53 +00:00
}
},
compatibilityWithBrowserify: {
2017-05-14 11:22:31 +00:00
options: {
2017-12-15 04:00:53 +00:00
frameworks: ['mocha', 'chai-as-promised', 'chai', 'browserify'],
files: [
'test/compat/require.js',
],
preprocessors: {
'test/compat/require.js': ['browserify']
},
2018-01-04 20:45:33 +00:00
browsers
2017-12-15 04:00:53 +00:00
}
},
compatibilityWithWebpack: {
options: {
frameworks: ['mocha', 'chai-as-promised', 'chai'],
files: [
'test/compat/require.js',
],
preprocessors: {
'test/compat/require.js': ['webpack']
},
2018-01-04 20:45:33 +00:00
browsers
2017-12-15 04:00:53 +00:00
}
},
benchmark: {
options: {
frameworks: ['browserify', 'benchmark'],
reporters: ['benchmark'],
files: ['perf/benchmark.js'],
preprocessors: {
'perf/benchmark.js': ['browserify']
},
2018-01-04 20:45:33 +00:00
browsers
2017-05-14 11:22:31 +00:00
}
}
2017-12-15 04:00:53 +00:00
},
eslint: {
target: [
'src/*.js'
]
2017-05-14 11:22:31 +00:00
}
});
2017-12-15 04:00:53 +00:00
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-karma');
2017-05-14 11:22:31 +00:00
grunt.loadNpmTasks('grunt-browserify');
2017-12-15 04:00:53 +00:00
grunt.loadNpmTasks('grunt-contrib-uglify');
2017-05-14 11:22:31 +00:00
grunt.registerTask('test', [
2017-12-15 04:00:53 +00:00
'eslint',
2017-05-14 11:22:31 +00:00
'browserify',
2017-12-15 04:00:53 +00:00
'uglify',
'karma:unit',
'karma:fuzz',
'karma:functional',
'karma:compatibilityWithVanillaScript',
'karma:compatibilityWithVanillaWorker',
'karma:compatibilityWithBrowserify',
'karma:compatibilityWithWebpack'
2017-05-14 11:22:31 +00:00
]);
2017-12-15 04:00:53 +00:00
grunt.registerTask('test:unit', [
'eslint',
2017-05-14 11:22:31 +00:00
'browserify',
2017-12-15 04:00:53 +00:00
'uglify',
'karma:unit'
2017-05-14 11:22:31 +00:00
]);
2017-12-15 04:00:53 +00:00
grunt.registerTask('benchmark', ['browserify', 'uglify', 'karma:benchmark']);
grunt.registerTask('build', ['eslint', 'browserify', 'uglify']);
2017-05-14 11:22:31 +00:00
};