tern-closure welcomes bug fixes and patches.
Before making changes that interface with the core Tern library, it might be a good idea to read the Tern reference manual and blog post, which together give a pretty good overview of how Tern works. The core Tern code is quite dense, and not the kind of code you grok on first read.
tern-closure has two kinds of tests:
-
Test cases written for Tern's nifty test framework. Cases are in the
test/cases
directory, and consist of sample code to parse interspersed with comments which serve as assertions on inference results. -
Regular old Mocha tests, using Chai for assertions, Sinon for spies/stubs, and sinon-chai for making them play together. These tests are in
test/*_test.js
files.
The Tern framework test cases are very useful for testing interactions with Tern's type inference system and server queries, while the Mocha tests are better for other functionality (like file and visibility management).
To run the Tern framework tests directly, run:
node test/runcases.js [file_filter_string]
To run all the Mocha tests, run
mocha
or, if you don't have Mocha installed globally
./node_modules/.bin/mocha
Mocha provides many amenities (-w
, --growl
, etc).
test/runcases_test.js
wraps the Tern framework tests in a Mocha test case, so
running all the Mocha tests also runs the Tern framework test cases.
You can also just run all the tests with
npm test
Pull requests with failing tests will not be accepted, and tests should be added for new behavior.
tern-closure favors the more roomy style of the Closure library over the compact style of the Tern core. We follow the Google JavaScript style guide, including JSDoc for methods.
You can lint your changes using and gjslint (the Google Closure linter) and JSHint:
gjslint --flagfile=.gjslintflags
jshint .
Simple gjslint
errors can be automatically fixed using fixjsstyle
:
fixjsstyle --flagfile=.gjslintflags
In all cases, contributors must sign a contributor license agreement with Google, either for an individual or corporation, before a patch/pull request can be accepted. Please fill out the agreement for an individual or a corporation, as appropriate.