wallaby.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. module.exports = function (wallaby) {
  2. return {
  3. files: [
  4. {
  5. pattern: 'package.json',
  6. instrument: false
  7. },
  8. {
  9. pattern: 'config.tpl.js',
  10. instrument: false
  11. },
  12. {
  13. pattern: 'test/unit/certificates/server.key',
  14. instrument: false
  15. },
  16. {
  17. pattern: 'test/unit/certificates/server.crt',
  18. instrument: false
  19. },
  20. {
  21. pattern: 'test/unit/**/*.spec.js',
  22. ignore: true
  23. },
  24. 'lib/**/*.js',
  25. 'test/unit/**/*.js',
  26. 'test/unit/mocha-globals.js'
  27. ],
  28. tests: [
  29. 'test/unit/**/*.spec.js'
  30. ],
  31. bootstrap: function (w) {
  32. var path = require('path')
  33. var mocha = w.testFramework
  34. mocha.suite.on('pre-require', function () {
  35. // always passing wallaby.js globals to mocks.loadFile
  36. var mocks = require('mocks')
  37. var loadFile = mocks.loadFile
  38. mocks.loadFile = function (filePath, mocks, globals, mockNested) {
  39. mocks = mocks || {}
  40. globals = globals || {}
  41. globals.$_$wp = global.$_$wp || {}
  42. globals.$_$wpe = global.$_$wpe || {}
  43. globals.$_$w = global.$_$w || {}
  44. globals.$_$wf = global.$_$wf || {}
  45. globals.$_$tracer = global.$_$tracer || {}
  46. return loadFile(filePath, mocks, globals, mockNested)
  47. }
  48. // loading mocha-globals for each run
  49. require(path.join(process.cwd(), 'test/unit/mocha-globals'))
  50. })
  51. },
  52. env: {
  53. type: 'node',
  54. params: {
  55. runner: '--harmony --harmony_arrow_functions'
  56. }
  57. }
  58. }
  59. }