Skip to content

Commit 3c32db0

Browse files
authored
docs: update contribution guidelines (watson-developer-cloud#927)
also, provide build script as a way to only build the ts code
1 parent e949e9f commit 3c32db0

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

.github/CONTRIBUTING.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ or [Stack Overflow](http://stackoverflow.com/questions/ask?tags=ibm-watson).
77

88
# Code
99

10-
* Our style guide is based on [Google's](https://google.github.io/styleguide/jsguide.html), most of it is automaticaly enforced (and can be automatically applied with `npm run autofix`)
10+
* Our style guide is based on [Google's](https://google.github.io/styleguide/jsguide.html), most of it is automaticaly enforced (and can be automatically applied with `npm run tslint:fix` or `npm run eslint:fix`)
1111
* Commits should follow the [Angular commit message guidelines](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-guidelines). This is because our release tool uses this format for determining release versions and generating changelogs. To make this easier, we recommend using the [Commitizen CLI](https://github.com/commitizen/cz-cli) with the `cz-conventional-changelog` adapter.
1212

1313
# Issues
@@ -22,12 +22,16 @@ already encountered this issue.
2222
If you want to contribute to the repository, follow these steps:
2323

2424
1. Fork the repo.
25-
2. Develop and test your code changes: `npm install -d && npm test`.
25+
2. Install dependencies: `npm install`
26+
3. Build the code: `npm run build`
27+
4. Verify the build before beginning your changes: `npm run test-unit`
28+
2. Develop and test your code changes.
2629
3. Travis-CI will run the tests for all services once your changes are merged.
2730
4. Add a test for your changes. Only refactoring and documentation changes require no new tests.
2831
5. Make the test pass.
29-
6. Commit your changes.
32+
6. Commit your changes. Remember the follow the correct commit message guidelines.
3033
7. Push to your fork and submit a pull request.
34+
8. Be sure to sign the CLA.
3135

3236
# Developer's Certificate of Origin 1.1
3337

@@ -57,18 +61,15 @@ By making a contribution to this project, I certify that:
5761

5862
## Tests
5963

60-
Ideally, we'd like to see both unit and innervation tests on each method.
61-
(Unit tests do not actually connect to the Watson service, integration tests do.)
64+
Out of the box, `npm test` runs linting, unit tests, and integration tests (which require credentials). To run only the unit tests (sufficient for most cases), use `npm run test-unit`.
6265

63-
Out of the box, `npm test` runs linting and unit tests, but skips the integration tests,
64-
because they require credentials.
65-
66-
To run integration tests, copy `test/resources/auth.example.js` to `test/resources/auth.js` and fill in credentials for
67-
the service(s) you wish to test.
66+
To run integration tests, copy `test/resources/auth.example.js` to `test/resources/auth.js` and fill in credentials for the service(s) you wish to test.
6867

6968
Currently this enables integration tests for all services so, unless all credentials are supplied, some tests will fail.
7069
(This will be improved eventually.)
7170

72-
To run only specific tests, pass the file name to mocha. For example:
71+
To run only specific tests, pass the file name to `jest`. For example:
7372

74-
node ./node_modules/mocha/bin/_mocha test/integration/test.conversation.js
73+
`npm i -g jest`
74+
`jest test/integration/personality_insights.v3.test.js`
75+
See [this page](https://jestjs.io/docs/en/cli) for all the options you can use to further configure `jest`.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@
104104
"eslint:check": "eslint . --cache",
105105
"lint": "npm run eslint:check && npm run tslint:check && dependency-lint",
106106
"browserify": "browserify sdk.js --standalone Watson --outfile dist/watson.js",
107-
"build": "tsc && npm run browserify && npm run minify",
107+
"build": "tsc",
108108
"doc": "jsdoc -c scripts/jsdoc/config.json",
109109
"minify": "uglifyjs --compress --mangle --output dist/watson.min.js --preamble \"// Watson Developer Cloud\n// JavaScript SDK$npm_package_version\n// Generated at `date`\n// Copyright IBM ($npm_package_license)\n// $npm_package_homepage\" -- dist/watson.js",
110-
"prepublishOnly": "npm run build",
110+
"prepublishOnly": "npm run build && npm run browserify && npm run minify",
111111
"test-integration": "jest --silent --verbose test/integration",
112112
"test-unit": "jest --silent --verbose test/unit/",
113113
"test": "jest --silent --verbose test/",

0 commit comments

Comments
 (0)