Last active
March 15, 2016 19:23
-
-
Save cirocosta/2292f88e54d40ba3e936 to your computer and use it in GitHub Desktop.
Testing mocha with flow annotations
This file contains hidden or 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
'use strict'; | |
var fs = require('fs'); | |
var ReactTools = require('react-tools'); | |
var fn = module.exports = function () { | |
require.extensions['.js'] = function (module, filename) { | |
module._compile( | |
ReactTools.transform( | |
fs.readFileSync(filename, 'utf8'), | |
{stripTypes: true, harmony: true}), | |
filename) | |
}; | |
}; | |
fn(); |
This file contains hidden or 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
// example of a flow globals file | |
declare var SC: Object; | |
type StatesType = {[key: string]: { | |
value: any; | |
elem: HTMLElement; | |
attach: ?{ | |
[key: string]: (s: StatesType, e: Event) => void}; | |
draw: (elem: HTMLElement, value: any) => void; | |
}}; |
This file contains hidden or 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
{ | |
"name": "something-cool", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "mocha --compilers js:es6-flow-transform && flow check --lib flow/globals.js" | |
}, | |
"author": "Ciro S. Costa <[email protected]> (http://cirocosta.github.io/)", | |
"license": "MIT", | |
"devDependencies": { | |
"react-tools": "^0.12.2", | |
"mocha": "^2.1.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment