Add CONTRIBUTING.md and update guides#4511
Conversation
tjvantoll
left a comment
There was a problem hiding this comment.
Love this. The unit testing stuff is especially 👌
I left a few notes here and there but they’re all relatively trivial.
| - `tns-core-modules` - Core ui, io and sensor modules | ||
| - `apps` - UI app used for manual testing and automation | ||
| - `tests` - Unit tests for the `tns-core-modules` | ||
| - `tns-platform-declarations` - Android and iOS native APIs supported in JavaScript |
There was a problem hiding this comment.
Might want to mention that these are TypeScript declaration files.
|
|
||
| The repository contains several packages and apps: | ||
| - `tns-platform-declarations` - Android and iOS native APIs supported in JavaScript | ||
| - `tns-core-modules` - Core ui, io and sensor modules |
There was a problem hiding this comment.
Not related to this PR, but this description is kind of meh. Maybe, “The core NativeScript TypeScript modules used to develop NativeScript apps”
| @@ -49,29 +55,55 @@ tsc --skipLibCheck -w | |||
| ``` | |||
|
|
|||
| The modules have `typescript` as devDependency so you should also be able to use locally installed TypeScript compiler from node_modules: | |||
There was a problem hiding this comment.
as a devDependency
use the locally installed TypeScript
| npm run setup | ||
|
|
||
| # After changes in the modules or the tests | ||
| After the [initial setup](#initial-setup) ypu can run the tests with: |
| # After changes in the modules or the tests | ||
| After the [initial setup](#initial-setup) ypu can run the tests with: | ||
| ```bash | ||
| # Make sure typescript is transpiled |
| ## Writing Test Module | ||
| The test modules are actually TypeScript modules which export unit tests and hooks as functions following this convention: | ||
|
|
||
| * All exported function which begin with `test` prefix are unit-tests. |
| * The `tearDownModule()` hook is called once - after all the tests in the module. | ||
|
|
||
| # Asserting | ||
| Test will fail if assert is not satisfied or if error is thrown during execution. |
There was a problem hiding this comment.
A test will fail if assert is not satisfied or if an error is thrown during execution.
|
|
||
| # Async Tests | ||
|
|
||
| Unit test can accept a single argument - a done callback. Test framework will wait for the `done()` callback to be called (or the test to timeout) before moving on. |
There was a problem hiding this comment.
Unit test --> Unit tests
The framework --> The test framework
| @@ -0,0 +1,75 @@ | |||
| # Contributing to NativeScript | |||
There was a problem hiding this comment.
Extremely trivial note: when this PR lands let me know I need to update a link I have to the current .github/CONTRIBUTING.md path on https://www.nativescript.org/contribute.
|
|
||
| * The fun part! Make your code changes | ||
|
|
||
| * Follow the [code conventions guide](CodeConvention.md) |
There was a problem hiding this comment.
Suggestion: maybe add numbers to these requirements to make these next few sentences a little easier to read and follow. Here’s a rough idea of what I’m thinking.
-
- Ensure your code follows the NativeScript code conventions guide.
-
- Write unit tests for your fix or feature...
-
- Rebase your changes to the latest version of the master branch of this repository.
-
- Make sure all unit tests are green for iOS and Android.
-
- Ensure your changes pass tslint validation.
When you’ve verified these changes to ahead and submit a PR...
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
In this PR:
Contributing.mdguideWritingUnitTests.mdguideCC @tjvantoll @jlooper