Skip to content

Commit

Permalink
Merge pull request #22 from nhsevidence/NDS36-teamcity
Browse files Browse the repository at this point in the history
NDS-36 Added teamcity reporter for test:coverage
  • Loading branch information
mgallagher1980 committed Jan 15, 2018
2 parents 3f321da + 92ec3d7 commit aaf9b6e
Show file tree
Hide file tree
Showing 5 changed files with 2,075 additions and 1,997 deletions.
8 changes: 8 additions & 0 deletions .grunt-tasks/mochaTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,13 @@ module.exports = {
options: {
require: ["babel-core/register", "mocha-clean", "./test/_setup.js"]
}
},

teamcity: {
src: ["src/**/*.test.js", "test/**/*.test.js"],
options: {
reporter: "mocha-teamcity-reporter",
require: ["mocha-teamcity-reporter", "babel-core/register", "mocha-clean", "./test/_setup.js" ]
}
}
};
7 changes: 6 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,15 @@ module.exports = grunt => {
r("lint", ["sasslint", "eslint"]);

// Run JS unit tests
r("test", ["mochaTest"]);
r("test", ["mochaTest:test"]);

r("test:teamcity", ["mochaTest:teamcity"]);

// For building before publishing to NPM etc
r("dist", ["env:dist", "clean:dist", "lint", "test", "sass:dist", "postcss:dist", "cssmin:dist", "docs", "webpack"]);

r("dist:teamcity", ["env:dist", "clean:dist", "lint", "test:teamcity", "sass:dist", "postcss:dist", "cssmin:dist", "docs", "webpack"]);

//For building locally
r("default", ["env:dev", "clean:temp", "lint", "test", "sass:temp", "postcss:temp", "cssmin:temp", "watch"]);
};
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,19 @@ Run `npm start` and `npm run test:watch` for development. However, there are oth
| Task | Description |
| ---- | ----------- |
| `npm start` | Simply runs `grunt` under the hood |
| `npm run dist` | Builds the projects in distribution mode for release |
| `npm run dist:teamcity` | Builds the projects in distribution mode for release via teamcity |
| `npm test` | Runs JS tests |
| `npm test:teamcity` | Runs JS tests (with the [mocha-teamcity-reporter](https://www.npmjs.com/package/mocha-teamcity-reporter))|
| `npm run test:watch` | Runs JS test tests (with [min reporter](https://github.com/mochajs/mocha/blob/master/lib/reporters/min.js)) and watches for changes. Useful to run in development alongside grunt. |
| `npm run test:coverage` | Runs JS test tests and generates a coverage report with [Istanbul](https://istanbul.js.org/) into the *coverage* folder |
| `test:coverage:teamcity` | Runs JS test tests and generates a coverage report with [Istanbul](https://istanbul.js.org/) (using the [mocha-teamcity-reporter](https://www.npmjs.com/package/mocha-teamcity-reporter)). |
| `npm run lint` | Lints SASS and JS (uses `grunt lint` under the hood) |

| `npm run release` | Builds the assets in dist mode, increments package.json patch version, pushes a new git tag, creates a GitHub release (with release notes from commits since last release) and creates an npm release. |
| `npm run release:minor` | Does the same as release but with a minor version |


#### Grunt

Some of the npm scripts use Grunt tasks under the hood. These Grunt tasks (and aliases) can be run directly e.g. `grunt lint`. However, we recommend using the npm scripts themselves. See the task aliases in [Gruntfile.js#L35-L47](Gruntfile.js) for more information.
Expand Down

0 comments on commit aaf9b6e

Please sign in to comment.