Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* create test harness * add testing framework that's transferable to contribution * use different versions of flow * add basic documentation in readme * write docs * correct md copy
- Loading branch information
1 parent
0086d66
commit d9e17af
Showing
5 changed files
with
67 additions
and
0 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
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
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,23 @@ | ||
# Test Harness | ||
|
||
A testing ground created to help you write and test flow definitions before contributing them back to our registry. | ||
|
||
After cloning the repository you can run `./test_harness.sh` in the root directory to create the `./harness` directory. Here you can write general flow code or definitions to verify functionality in real time with an IDE. | ||
|
||
``` bash | ||
# Sample usage | ||
./test_harness.sh | ||
./test_harness.sh 0.140.0 # creates the test harness with flow-bin set to `v0.140.0` | ||
``` | ||
|
||
The directory is git ignored so please feel free to add any settings to `.flowconfig`, dependencies to package.json or other library definitions to achieve your needs. | ||
|
||
Once you're done with development you can delete the directory or leave it for next time, the choice is yours. | ||
|
||
## Contributing back | ||
|
||
If you wrote a definition you'd like to now contribute back you can read our [contributing](contributing.md) guide and copy the definition over. The test harness is originally setup with a `definition.js` and `test_definition.js` for definition creation and testing respectively for this purpose. | ||
|
||
Once you have them copied, you can run our full test suite that runs them against various flow versions to ensure they're up to the standards we need for contribution. | ||
|
||
**Contrary to the test harness code written in the `definitions` directory can't be checked by flow in real time** |
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,38 @@ | ||
#!/bin/sh | ||
|
||
flowVersion=$1 | ||
if [ -z "$flowVersion" ] | ||
then | ||
lib="flow-bin@latest" | ||
else | ||
lib="flow-bin@$flowVersion" | ||
fi | ||
|
||
if [ -d "./harness" ] | ||
then | ||
cd harness | ||
npm i --save-dev $lib | ||
else | ||
mkdir harness | ||
cd harness | ||
npm init -y | ||
npm i --save-dev $lib | ||
npx flow-setup flow-typed-harness | ||
cp ../docs/harness.md README.md | ||
cat <<EOF > definition.js | ||
declare module "" { | ||
} | ||
EOF | ||
cat <<EOF > test_definition.js | ||
// @flow | ||
import { describe, it } from 'flow-typed-test'; | ||
// import lib from 'test'; | ||
describe('', () => { | ||
it('', () => { | ||
}); | ||
}); | ||
EOF | ||
fi |