Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup Travis CI and Jest test suite for React Native.
- Loading branch information
1 parent
d6e0b78
commit cad15ea
Showing
6 changed files
with
2,026 additions
and
38 deletions.
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 @@ | ||
{ | ||
"presets": ["react-native"] | ||
} |
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,14 @@ | ||
|
||
# | ||
# Travis CI config | ||
# https://docs.travis-ci.com/user/customizing-the-build/ | ||
# | ||
|
||
language: node_js | ||
|
||
node_js: | ||
- "7" | ||
|
||
cache: | ||
directories: | ||
- "node_modules" |
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,14 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Travis CI Test renders correctly 1`] = ` | ||
<View> | ||
<Text | ||
accessible={true} | ||
allowFontScaling={true} | ||
disabled={false} | ||
ellipsizeMode="tail" | ||
> | ||
Test | ||
</Text> | ||
</View> | ||
`; |
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,42 @@ | ||
|
||
// Load dependencies | ||
import should from 'should'; | ||
import React from 'react'; | ||
import 'react-native'; | ||
import { View, Text } from 'react-native'; | ||
|
||
// Note: test renderer must be required after react-native. | ||
import renderer from 'react-test-renderer'; | ||
|
||
// Ensure Travis CI tests are working. | ||
describe('Travis CI Test', function() { | ||
|
||
it('should execute a test.', () => { | ||
const expectedObject = { | ||
test: 'value' | ||
}; | ||
|
||
expectedObject.should.deepEqual({ | ||
test: 'value' | ||
}); | ||
}); | ||
|
||
it('renders correctly', () => { | ||
|
||
const tree = renderer.create( | ||
<View> | ||
<Text>Test</Text> | ||
</View> | ||
); | ||
expect(tree).toMatchSnapshot(); //If UI changes, this snapshot must be updated. See comment below. | ||
|
||
/** | ||
The next time you run the tests, the rendered output will be compared to the previously created snapshot. | ||
The snapshot should be committed along code changes. When a snapshot test fails, you need to inspect whether it is an intended or unintended change. | ||
If the change is expected you can invoke Jest with npm test -- -u to overwrite the existing snapshot. | ||
*/ | ||
|
||
}); | ||
|
||
|
||
}); |
Oops, something went wrong.