-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mocha-compat: Initial fbp-spec-mocha tool
Can read a set of Mocha testcases, build them into fbp-spec test-suites, and act as a FBP runtime which can execute these tests and enforce the results. Needs a bit more work before being minimally useful References #36
- Loading branch information
Showing
8 changed files
with
452 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env node | ||
require('coffee-script/register'); | ||
require('../src/mochacompat').main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
chai = require 'chai' | ||
|
||
describe 'nested passing', -> | ||
console.log 'describe fired' | ||
|
||
describe 'sub topic', () -> | ||
console.log 'sub describe fired' | ||
|
||
it 'should pass', (done) -> | ||
chai.expect(42).to.equal 42 | ||
done(); | ||
|
||
describe 'sub sub topic', () -> | ||
it 'should pass', (done) -> | ||
chai.expect(42).to.equal 42 | ||
done(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
chai = require 'chai' | ||
|
||
describe 'simple failing', () -> | ||
it 'should fail', (done) -> | ||
chai.expect(42).to.equal 41 | ||
done(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
chai = require 'chai' | ||
|
||
describe 'simple passing', () -> | ||
it 'should pass', (done) -> | ||
chai.expect(42).to.equal 42 | ||
done(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
require '../src/mochacompat' # Register custom UI | ||
Mocha = require 'mocha' | ||
|
||
addTests = (mocha) -> | ||
fs = require 'fs' | ||
path = require 'path' | ||
|
||
testDir = path.join __dirname, 'fixtures/mochacases' | ||
|
||
fs.readdirSync(testDir).filter (filename) -> | ||
isJs = filename.substr(-3) == '.js'; | ||
isCoffee = filename.substr(-7) == '.coffee'; | ||
return isJs or isCoffee | ||
.forEach (filename) -> | ||
fullPath = path.join testDir, filename | ||
mocha.addFile fullPath | ||
|
||
main = () -> | ||
# See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically | ||
options = | ||
ui: 'fbp-spec' | ||
mocha = new Mocha options | ||
addTests mocha | ||
mocha.run (failures) -> | ||
process.on 'exit', () -> | ||
process.exit failures | ||
|
||
main() if not module.parent | ||
|
||
|
Oops, something went wrong.