NodeJS and Io.js¶
Solano CI supports testing NodeJS and io.js applications.
For a concrete sample of a NodeJS application on Solano CI, see Intern JS code testing stack on of our Example Repositories page. Contact email@example.com with any questions about NodeJS and io.js support.
Supported Versions and Patch Levels¶
Solano CI natively supports several versions of NodeJS. For the most up to date list of versions or for assistance with another version, please contact firstname.lastname@example.org.
- node 0.6.18
- node 0.8.19
- node 0.10.18, 0.10.26, 0.10.31
- node 0.12.3, 0.12.4
- node 4.1.1, 4.2.1, 4.4.0
- node 5.0.0, 5.9.0, 5.10.1
- node 6.0.0, 6.1.0, 6.2.1, 6.3.1, 6.4.0 through 6.10.0
- node 7.7.1
npm install commands on versions of NodeJS earlier then
can intermittenly fail due to network connectivity issues.
Solano CI also supports several versions of io.js; note that later versions are now merged into nodejs:
- iojs 2.5.0
- iojs 3.0.0
You configure your tests and their environment in a file called
solano.yml. Note that by default you can only configure one of NodeJS
(or io.js) at a time. If you rely on NodeJS, We recommend specifying
a version explicitly to ensure a consistent build result.
The configuration file is in YAML and looks like this example:
nodejs: version: '5.10.1' hooks: pre_setup: npm install tests: - npm test
solano.yml file should be in your repository at the root of
the directory tree. The version of
npm used by default is specific
to each version of NodeJS specified, and is typically the version that
was available when the version of NodeJS was released. To update
during the build, you can install either the latest compatible version
or a specific version:
hooks: pre_setup: npm install npm[@x.y.z] && npm install
A typical Bower installation and cache configuration:
nodejs: version: '5.10.1' hooks: pre_setup: | set -e # Exit on error npm install # Next command presumes bower is in package.json bower install # <repo-root>/node_modules/.bin is early in $PATH # npm/bower specific cache settings cache: key_paths: - package.json - bower.json save_paths: - REPO/node_modules - REPO/bower_components
A recent version of Yarn is installed
on our workers. The solano.yml file in our express example repo
yarn instead of
npm to install packages and run tests,
specifying appropriate cache paths, as well as how to install a specific version
yarn if so desired.
If you want to configure io.js, use a configuration like this one:
# NOTE: iojs and nodejs have merged; use nodejs for latest versions nodejs: false iojs: version: '3.0.0' hooks: pre_setup: npm install tests: - npm test
tests key is followed by a list of tests. The simplest and
most general way to configure a test is as a shell command. For
tests: - npm test # Individual test command
Also it is possible to customize the test name displayed on a build
report web page by providing a
tests: - name: execute npm test command command: npm test
Detailed Test Results¶
For NodeJS test runners that can produce JUnit-compatible XML reports,
our JUnit parser can provide detailed
results if you annotate your test with the
type: junit and specify
where the report files are generated.
tests: - name: Mocha Tests type: junit command: mocha test --reporter mocha-junit-reporter report_files: - ./test-results.xml
node_modules/.bin is automatically included in
Punctuation and spacing is very meaningful to YAML. You can test it by
parsing your YAML online
import yaml; print yaml.load(foo) in Python.