Skip to content

Commit

Permalink
Merge pull request #16 from vidbina/support-compilers
Browse files Browse the repository at this point in the history
Support `--compilers` arg
  • Loading branch information
jprichardson committed Oct 16, 2015
2 parents af212ab + 850c50e commit e17c8ba
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Usage: electron-mocha [options] [files]
-t, --timeout <ms> set test-case timeout in milliseconds [2000]
-u, --ui <name> specify user-interface (bdd|tdd|exports)
--check-leaks check for global variable leaks
--compilers use the given module(s) to compile files
--globals <names> allow the given comma-delimited global [names]
--inline-diffs display actual/expected differences inline within each string
--interfaces display available interfaces
Expand Down
1 change: 1 addition & 0 deletions args.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function parse (argv) {
.option('-t, --timeout <ms>', 'set test-case timeout in milliseconds [2000]')
.option('-u, --ui <name>', 'specify user-interface (bdd|tdd|exports)', 'bdd')
.option('--check-leaks', 'check for global variable leaks')
.option('--compilers <ext>:<module>,...', 'use the given module(s) to compile files', list, [])
.option('--globals <names>', 'allow the given comma-delimited global [names]', list, [])
.option('--inline-diffs', 'display actual/expected differences inline within each string')
.option('--interfaces', 'display available interfaces')
Expand Down
10 changes: 10 additions & 0 deletions mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ function createFromArgs (args) {
files = files.concat(utils.lookupFiles(arg, extensions, args.recursive))
})

args.compilers.forEach(function (c) {
var compiler = c.split(':')
var ext = compiler[0]
var mod = compiler[1]

if (mod[0] === '.') mod = path.join(process.cwd(), mod)
require(mod)
extensions.push(ext)
})

files = files.map(function (f) {
return path.resolve(f)
})
Expand Down
1 change: 0 additions & 1 deletion renderer/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ require('./console')
var ipc = require('ipc')
var mocha = require('../mocha')


// consider hooking up to mocha
/* window.onerror = function (message, filename, lineno, colno, err) {
console.log(err.message)
Expand Down

0 comments on commit e17c8ba

Please sign in to comment.