bench.js 579 B

12345678910111213141516171819202122232425262728293031
  1. /**
  2. * Run benchmarks in Node
  3. */
  4. module.exports = function (grunt) {
  5. grunt.registerTask('bench', function (target) {
  6. // polyfill window/document for old Vue
  7. global.window = {
  8. setTimeout: setTimeout,
  9. console: console
  10. }
  11. global.document = {
  12. documentElement: {}
  13. }
  14. if (target) {
  15. run(target)
  16. } else {
  17. require('fs')
  18. .readdirSync('./benchmarks')
  19. .forEach(run)
  20. }
  21. function run (mod) {
  22. if (mod === 'browser.js' || mod === 'runner.html') return
  23. require('../benchmarks/' + mod)
  24. }
  25. })
  26. }