调试与测试
Debug & Test
Chrome Debugger
在模拟器中使用console.log
的记录从而方便调试,正如调试

Type-Checking with Flow
在安装
flow check
一般情况下默认的应用中都会包含一个
[ignore]
.*/node_modules/.*
最终检查的时候就可以直接运行:
$ flow check
$ Found 0 errors.
Testing with Jest
npm install jest-cli --save-dev
可以将
{
...
"scripts": {
"test": "jest"
}
...
}
直接使用
"use strict";
describe("a silly test", function() {
it("expects true to be true", function() {
expect(true).toBe(true);
});
});
而对于一些复杂的应用可以查看
**
* Taken from https://github.com/facebook/react-native/blob/master/Examples/Movies/__tests__/getImageSource-test.js
*/
'use strict';
jest.dontMock('../getImageSource');
var getImageSource = require('../getImageSource');
describe('getImageSource', () => {
it('returns null for invalid input', () => {
expect(getImageSource().uri).toBe(null);
});
...
});
因为
Reactotron:Control, monitor, and instrument your React DOM and React Native apps
