eslint-teamcity
Advanced tools
Comparing version 3.0.0 to 3.0.1
{ | ||
"extends": "airbnb-base", | ||
"env": { | ||
"node": true | ||
"node": true, | ||
"mocha": true | ||
}, | ||
@@ -6,0 +7,0 @@ "rules": { |
{ | ||
"name": "eslint-teamcity", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "An ESLint formatter plugin for TeamCity", | ||
@@ -8,3 +8,3 @@ "main": "index.js", | ||
"lint": "eslint .", | ||
"prettify": "prettier --write ./**/*.js", | ||
"prettify": "prettier --write \"./src/**/*.js\" --write \"./test/**/*.js\"", | ||
"test": "mocha \"./test/**/*.spec.js\"", | ||
@@ -11,0 +11,0 @@ "test:travis": "nyc npm test && nyc report --reporter=text-lcov | coveralls" |
# eslint-teamcity | ||
[![npm version](https://badge.fury.io/js/eslint-teamcity.svg)](https://www.npmjs.com/package/eslint-teamcity) | ||
@@ -10,3 +11,3 @@ [![Build Status](https://travis-ci.org/andreogle/eslint-teamcity.svg?branch=master)](https://travis-ci.org/andreogle/eslint-teamcity) | ||
[TeamCity](https://www.jetbrains.com/teamcity/) build error format. Tested with | ||
TeamCity 9.1.x/10.0.x/2017 and ESLint 1+ | ||
TeamCity 9.1.x/10.0.x/2017+ and ESLint 1+ | ||
@@ -24,17 +25,27 @@ ## Installation | ||
## Usage | ||
There are 3 ways to use eslint-teamcity: | ||
##### 1. As a regular ESLint formatter plugin: | ||
### 1. As a regular ESLint formatter plugin: | ||
```sh | ||
eslint --format ./node_modules/eslint-teamcity/index.js myfiletolint.js | ||
``` | ||
##### 2. Running against a generated ESLint JSON report: | ||
### 2. Running against a generated ESLint JSON report: | ||
Generate an ESLint JSON report: | ||
```sh | ||
eslint -f json -o result.json app/myjavascriptdirectory | ||
``` | ||
Run eslint-teamcity against your new report: | ||
```sh | ||
node ./node_modules/eslint-teamcity/index.js result.json | ||
``` | ||
##### 3. Requiring and running directly from inside your JavaScript code: | ||
### 3. Requiring and running directly from inside your JavaScript code: | ||
```javascript | ||
@@ -46,2 +57,3 @@ const eslintTeamcity = require('eslint-teamcity'); | ||
## Configuration | ||
As of version 2.0, there are two different formatters you can use to report with. They have no material | ||
@@ -58,5 +70,7 @@ impact on the output - they're just different ways of viewing the same data. The "Code Inspection" tab will only | ||
##### 1. As a second argument | ||
### 1. As a second argument | ||
If you run eslint-teamcity by requiring it in JavaScript, you can pass a second argument to the function: | ||
```javascript | ||
```js | ||
const eslintTeamcity = require('eslint-teamcity'); | ||
@@ -66,3 +80,3 @@ const options = { | ||
reportName: 'My ESLint Violations', // default: 'ESLint Violations' | ||
errorStatisticsName: 'My ESLint Error Count', // default: 'ESLint Error Count' | ||
errorStatisticsName: 'My ESLint Error Count', // default: 'ESLint Error Count' | ||
warningStatisticsName: 'My ESLint Warning Count', // default: 'ESLint Warning Count' | ||
@@ -73,4 +87,6 @@ }; | ||
##### 2. From your package.json | ||
### 2. From your package.json | ||
If you have a package.json file in the **current directory**, you can add an extra "eslint-teamcity" property to it: | ||
```json | ||
@@ -87,4 +103,5 @@ ..., | ||
##### 3. ENV variables | ||
```bash | ||
### 3. ENV variables | ||
```sh | ||
export ESLINT_TEAMCITY_REPORTER=inspections | ||
@@ -97,9 +114,10 @@ export ESLINT_TEAMCITY_REPORT_NAME="My Formatting Problems" | ||
You can also output your current settings to the log if you set: | ||
```bash | ||
```sh | ||
export ESLINT_TEAMCITY_DISPLAY_CONFIG=true | ||
``` | ||
## [gulp-eslint](https://github.com/adametry/gulp-eslint) integration | ||
## [gulp-eslint](https://github.com/adametry/gulp-eslint) integration | ||
```javascript | ||
```js | ||
const gulp = require('gulp'); | ||
@@ -116,2 +134,3 @@ const eslint = require('gulp-eslint'); | ||
``` | ||
See the [gulp-eslint](https://github.com/adametry/gulp-eslint#usage) docs for | ||
@@ -122,3 +141,5 @@ more info on setting up a linting task. | ||
## TeamCity Usage | ||
The simplest way to run eslint-teamcity is from an npm script in a build step. You could setup a script similar to this: | ||
```json | ||
@@ -135,4 +156,4 @@ "scripts": { | ||
## Extras | ||
## Extras | ||
eslint-teamcity will also output statistic values which you can use in TeamCity to track your progress in resolving errors! | ||
@@ -143,6 +164,15 @@ | ||
## Development | ||
## Development | ||
The quickest way to get a TeamCity server setup is to use Docker: | ||
```shell | ||
The quickest way to get a TeamCity server setup is to use [Docker](https://www.docker.com) and [ngrok](https://ngrok.com/): | ||
1. Run ngrok | ||
```sh | ||
ngrok http 8111 | ||
``` | ||
2. Start TeamCity server and an agent | ||
```sh | ||
docker run -itd --name teamcity-server \ | ||
@@ -154,14 +184,17 @@ -v <path to data directory>:/data/teamcity_server/datadir \ | ||
docker run -itd -e SERVER_URL="<your ip4 address>:8111" \ | ||
-v <path to agent config folder>:/data/teamcity_agent/conf \ | ||
docker run -itd --name teamcity-agent-1 \ | ||
-e SERVER_URL="http://<ngrok id>.ngrok.io" \ | ||
-v <path to agent data>:/data/teamcity_agent/conf \ | ||
jetbrains/teamcity-agent | ||
``` | ||
NOTE: You can't use `localhost` in SERVER_URL as it will refer to the container. | ||
If you fork the repo and are testing on your local TeamCity instance, it may help to run `rm -rf node_modules` in a | ||
build step as TeamCity seems to cache versions between commits. | ||
## Issues | ||
## Issues | ||
I will try keep this project up to date, but please log any issues | ||
[here](https://github.com/andreogle/eslint-teamcity/issues). | ||
Any pull requests are also welcome! |
@@ -18,3 +18,3 @@ const path = require('path'); | ||
results.forEach(result => { | ||
results.forEach((result) => { | ||
const { messages } = result; | ||
@@ -34,6 +34,8 @@ | ||
messages.forEach(messageObj => { | ||
messages.forEach((messageObj) => { | ||
const { line, column, message, ruleId, fatal, severity } = messageObj; | ||
const formattedMessage = `line ${line}, col ${column}, ${message} (${ruleId})`; | ||
const formattedMessage = `line ${line}, col ${column}, ${message}${ | ||
ruleId ? ` (${ruleId})` : '' | ||
}`; | ||
@@ -40,0 +42,0 @@ const isError = fatal || severity === 2; |
@@ -16,3 +16,3 @@ const path = require('path'); | ||
results.forEach(result => { | ||
results.forEach((result) => { | ||
const { messages } = result; | ||
@@ -27,12 +27,12 @@ | ||
messages.forEach(messageObj => { | ||
messages.forEach((messageObj) => { | ||
const { line, column, message, ruleId, fatal, severity } = messageObj; | ||
const isError = fatal || severity === 2; | ||
const escapedRuleId = utils.escapeTeamCityString(ruleId || '<none>'); | ||
const escapedMessage = utils.escapeTeamCityString(message); | ||
const escapedRule = utils.escapeTeamCityString(ruleId); | ||
const formattedMessage = `line ${line}, col ${column}, ${escapedMessage}`; | ||
outputList.push( | ||
`##teamcity[inspectionType id='${escapedRule}' category='${reportName}' name='${escapedRule}' description='${reportName}']` | ||
`##teamcity[inspectionType id='${escapedRuleId}' category='${reportName}' name='${escapedRuleId}' description='${reportName}']` | ||
); | ||
@@ -42,3 +42,3 @@ | ||
outputList.push( | ||
`##teamcity[inspection typeId='${escapedRule}' message='${formattedMessage}' ` + | ||
`##teamcity[inspection typeId='${escapedRuleId}' message='${formattedMessage}' ` + | ||
`file='${filePath}' line='${line}' SEVERITY='${severityLevel}']` | ||
@@ -45,0 +45,0 @@ ); |
@@ -25,3 +25,3 @@ const fs = require('fs'); | ||
*/ | ||
exports.escapeTeamCityString = str => { | ||
exports.escapeTeamCityString = (str) => { | ||
if (!str) { | ||
@@ -28,0 +28,0 @@ return ''; |
@@ -1,6 +0,4 @@ | ||
/* global it, context, describe, beforeEach, afterEach */ | ||
const sinon = require('sinon'); | ||
const { expect } = require('chai'); | ||
const { createDummyError } = require('./helpers/eslint-factory'); | ||
const { error } = require('./helpers/eslint-factory'); | ||
const utils = require('../src/utils/index'); | ||
@@ -14,3 +12,3 @@ const format = require('../src/formatter'); | ||
beforeEach(function () { | ||
eslintInput.push(createDummyError()); | ||
eslintInput.push(error); | ||
}); | ||
@@ -17,0 +15,0 @@ |
@@ -1,27 +0,15 @@ | ||
/* global it, describe, beforeEach, afterEach */ | ||
const { expect } = require('chai'); | ||
const formatErrors = require('../../src/formatters/errors'); | ||
const { | ||
createDummyError, | ||
createDummyWarning, | ||
createFatalError | ||
} = require('../helpers/eslint-factory'); | ||
const { error, warning, fatalError, unknownError } = require('../helpers/eslint-factory'); | ||
describe('error formatting', function() { | ||
describe('error formatting', function () { | ||
const reportConfig = { | ||
reportName: 'ESLint Violations', | ||
errorStatisticsName: 'ESLintErrorCount', | ||
warningStatisticsName: 'ESLintWarningCount' | ||
warningStatisticsName: 'ESLintWarningCount', | ||
}; | ||
let results = []; | ||
afterEach(function() { | ||
results = []; | ||
}); | ||
describe('test suite name', function() { | ||
it('should include the test suite name header', function() { | ||
expect(formatErrors(results, reportConfig)[0]).to.eql( | ||
describe('test suite name', function () { | ||
it('should include the test suite name header', function () { | ||
expect(formatErrors([], reportConfig)[0]).to.eql( | ||
"##teamcity[testSuiteStarted name='ESLint Violations']" | ||
@@ -31,4 +19,4 @@ ); | ||
it('should include the test suite name footer', function() { | ||
expect(formatErrors(results, reportConfig)[1]).to.eql( | ||
it('should include the test suite name footer', function () { | ||
expect(formatErrors([], reportConfig)[1]).to.eql( | ||
"##teamcity[testSuiteFinished name='ESLint Violations']" | ||
@@ -39,8 +27,17 @@ ); | ||
describe('fatal error output', function() { | ||
beforeEach(function() { | ||
results.push(createFatalError()); | ||
describe('unknown error output', function () { | ||
it('omits the ruleId if it is null', function () { | ||
const results = [unknownError]; | ||
expect(formatErrors(results, reportConfig)[1]).to.eql( | ||
"##teamcity[testStarted name='ESLint Violations: testfile-unknown.js']" | ||
); | ||
expect(formatErrors(results, reportConfig)[2]).to.eql( | ||
"##teamcity[testFailed name='ESLint Violations: testfile-unknown.js' message='line 1, col 1, Some unknown error']" | ||
); | ||
}); | ||
}); | ||
it('should include filename at the start of each file test', function() { | ||
describe('fatal error output', function () { | ||
it('should include filename at the start of each file test', function () { | ||
const results = [fatalError]; | ||
expect(formatErrors(results, reportConfig)[1]).to.eql( | ||
@@ -51,3 +48,4 @@ "##teamcity[testStarted name='ESLint Violations: testfile-fatal.js']" | ||
it('should include all errors within their respective file', function() { | ||
it('should include all errors within their respective file', function () { | ||
const results = [fatalError]; | ||
expect(formatErrors(results, reportConfig)[2]).to.eql( | ||
@@ -58,3 +56,4 @@ "##teamcity[testFailed name='ESLint Violations: testfile-fatal.js' message='line 1, col 1, Some fatal error (no-eval)']" | ||
it('should include filename at the end of each file test', function() { | ||
it('should include filename at the end of each file test', function () { | ||
const results = [fatalError]; | ||
expect(formatErrors(results, reportConfig)[3]).to.eql( | ||
@@ -66,8 +65,5 @@ "##teamcity[testFinished name='ESLint Violations: testfile-fatal.js']" | ||
describe('error output', function() { | ||
beforeEach(function() { | ||
results.push(createDummyError()); | ||
}); | ||
it('should include filename at the start of each file test', function() { | ||
describe('error output', function () { | ||
it('should include filename at the start of each file test', function () { | ||
const results = [error]; | ||
expect(formatErrors(results, reportConfig)[1]).to.eql( | ||
@@ -78,3 +74,4 @@ "##teamcity[testStarted name='ESLint Violations: testfile.js']" | ||
it('should include all errors within their respective file', function() { | ||
it('should include all errors within their respective file', function () { | ||
const results = [error]; | ||
expect(formatErrors(results, reportConfig)[2]).to.eql( | ||
@@ -85,3 +82,4 @@ "##teamcity[testFailed name='ESLint Violations: testfile.js' message='line 1, col 1, |'|n|r|x|l|p|||[|] (no-console)|nline 2, col 1, This is a test error. (no-unreachable)']" | ||
it('should include filename at the end of each file test', function() { | ||
it('should include filename at the end of each file test', function () { | ||
const results = [error]; | ||
expect(formatErrors(results, reportConfig)[3]).to.eql( | ||
@@ -93,10 +91,6 @@ "##teamcity[testFinished name='ESLint Violations: testfile.js']" | ||
describe('output with directory paths', function() { | ||
beforeEach(function() { | ||
results.push({ ...createFatalError(), filePath: 'path\\with\\backslash\\file.js' }); | ||
}); | ||
it('should render slashes in the service messages', function() { | ||
describe('output with directory paths', function () { | ||
it('should render slashes in the service messages', function () { | ||
const results = [{ ...fatalError, filePath: 'path\\with\\backslash\\file.js' }]; | ||
const outputList = formatErrors(results, reportConfig); | ||
expect(outputList[1]).to.eql( | ||
@@ -111,8 +105,5 @@ "##teamcity[testStarted name='ESLint Violations: path/with/backslash/file.js']" | ||
describe('warning output', function() { | ||
beforeEach(function() { | ||
results.push(createDummyWarning()); | ||
}); | ||
it('should include filename at the start of each file test', function() { | ||
describe('warning output', function () { | ||
it('should include filename at the start of each file test', function () { | ||
const results = [warning]; | ||
expect(formatErrors(results, reportConfig)[1]).to.eql( | ||
@@ -123,3 +114,4 @@ "##teamcity[testStarted name='ESLint Violations: testfile-warning.js']" | ||
it('should include all warnings within their respective file', function() { | ||
it('should include all warnings within their respective file', function () { | ||
const results = [warning]; | ||
expect(formatErrors(results, reportConfig)[2]).to.eql( | ||
@@ -130,3 +122,4 @@ "##teamcity[testStdOut name='ESLint Violations: testfile-warning.js' out='warning: line 1, col 1, Some warning (eqeqeq)|nline 2, col 2, This is a test warning. (complexity)']" | ||
it('should include filename at the end of each file test', function() { | ||
it('should include filename at the end of each file test', function () { | ||
const results = [warning]; | ||
expect(formatErrors(results, reportConfig)[3]).to.eql( | ||
@@ -138,9 +131,5 @@ "##teamcity[testFinished name='ESLint Violations: testfile-warning.js']" | ||
describe('build statistics', function() { | ||
beforeEach(function() { | ||
results.push(createDummyWarning()); | ||
results.push(createDummyError()); | ||
}); | ||
it('should contain total error count', function() { | ||
describe('build statistics', function () { | ||
it('should contain total error count', function () { | ||
const results = [warning, error]; | ||
expect(formatErrors(results, reportConfig)[8]).to.eql( | ||
@@ -151,3 +140,4 @@ "##teamcity[buildStatisticValue key='ESLintErrorCount' value='2']" | ||
it('should contain total warning count', function() { | ||
it('should contain total warning count', function () { | ||
const results = [warning, error]; | ||
expect(formatErrors(results, reportConfig)[9]).to.eql( | ||
@@ -154,0 +144,0 @@ "##teamcity[buildStatisticValue key='ESLintWarningCount' value='2']" |
@@ -1,12 +0,6 @@ | ||
/* global it, describe, beforeEach, afterEach */ | ||
const { expect } = require('chai'); | ||
const formatInspections = require('../../src/formatters/inspections'); | ||
const { | ||
createDummyError, | ||
createDummyWarning, | ||
createFatalError | ||
} = require('../helpers/eslint-factory'); | ||
const { error, warning, fatalError, unknownError } = require('../helpers/eslint-factory'); | ||
describe('inspection formatting', function() { | ||
describe('inspection formatting', function () { | ||
const reportConfig = { | ||
@@ -16,16 +10,26 @@ reportName: 'ESLint Violations', | ||
errorStatisticsName: 'ESLintErrorCount', | ||
warningStatisticsName: 'ESLintWarningCount' | ||
warningStatisticsName: 'ESLintWarningCount', | ||
}; | ||
let results = []; | ||
afterEach(function() { | ||
results = []; | ||
}); | ||
describe('unknown error output', function () { | ||
it('sets id and name to <none> if ruleId is null', function () { | ||
const results = [unknownError]; | ||
const outputList = formatInspections(results, reportConfig); | ||
expect(outputList[0]).to.eql( | ||
"##teamcity[inspectionType id='<none>' category='ESLint Violations' name='<none>' description='ESLint Violations']" | ||
); | ||
}); | ||
describe('fatal error output', function() { | ||
beforeEach(function() { | ||
results.push(createFatalError()); | ||
it('sets typeId to <none> if ruleId is null', function () { | ||
const results = [unknownError]; | ||
const outputList = formatInspections(results, reportConfig); | ||
expect(outputList[1]).to.eql( | ||
"##teamcity[inspection typeId='<none>' message='line 1, col 1, Some unknown error' file='testfile-unknown.js' line='1' SEVERITY='ERROR']" | ||
); | ||
}); | ||
}); | ||
it('should include the inspection types', function() { | ||
describe('fatal error output', function () { | ||
it('should include the inspection types', function () { | ||
const results = [fatalError]; | ||
const outputList = formatInspections(results, reportConfig); | ||
@@ -37,3 +41,4 @@ expect(outputList[0]).to.eql( | ||
it('should include the inspections', function() { | ||
it('should include the inspections', function () { | ||
const results = [fatalError]; | ||
const outputList = formatInspections(results, reportConfig); | ||
@@ -46,8 +51,5 @@ expect(outputList[1]).to.contain( | ||
describe('error output', function() { | ||
beforeEach(function() { | ||
results.push(createDummyError()); | ||
}); | ||
it('should include the inspection types', function() { | ||
describe('error output', function () { | ||
it('should include the inspection types', function () { | ||
const results = [error]; | ||
const outputList = formatInspections(results, reportConfig); | ||
@@ -62,3 +64,4 @@ expect(outputList[0]).to.eql( | ||
it('should include the inspections', function() { | ||
it('should include the inspections', function () { | ||
const results = [error]; | ||
const outputList = formatInspections(results, reportConfig); | ||
@@ -74,10 +77,6 @@ expect(outputList[1]).to.eql( | ||
describe('output with directory paths', function() { | ||
beforeEach(function() { | ||
results.push({ ...createFatalError(), filePath: 'path\\with\\backslash\\file.js' }); | ||
}); | ||
it('should render slashes in the service messages', function() { | ||
describe('output with directory paths', function () { | ||
it('should render slashes in the service messages', function () { | ||
const results = [{ ...fatalError, filePath: 'path\\with\\backslash\\file.js' }]; | ||
const outputList = formatInspections(results, reportConfig); | ||
expect(outputList[1]).to.eql( | ||
@@ -89,8 +88,5 @@ "##teamcity[inspection typeId='no-eval' message='line 1, col 1, Some fatal error' file='path/with/backslash/file.js' line='1' SEVERITY='ERROR']" | ||
describe('warning output', function() { | ||
beforeEach(function() { | ||
results.push(createDummyWarning()); | ||
}); | ||
it('should include the inspection types', function() { | ||
describe('warning output', function () { | ||
it('should include the inspection types', function () { | ||
const results = [warning]; | ||
const outputList = formatInspections(results, reportConfig); | ||
@@ -105,3 +101,4 @@ expect(outputList[0]).to.eql( | ||
it('should include the inspections', function() { | ||
it('should include the inspections', function () { | ||
const results = [warning]; | ||
const outputList = formatInspections(results, reportConfig); | ||
@@ -117,9 +114,5 @@ expect(outputList[1]).to.eql( | ||
describe('build statistics', function() { | ||
beforeEach(function() { | ||
results.push(createDummyWarning()); | ||
results.push(createDummyError()); | ||
}); | ||
it('should contain total error count', function() { | ||
describe('build statistics', function () { | ||
it('should contain total error count', function () { | ||
const results = [warning, error]; | ||
const outputList = formatInspections(results, reportConfig); | ||
@@ -131,3 +124,4 @@ expect(outputList[8]).to.eql( | ||
it('should contain total warning count', function() { | ||
it('should contain total warning count', function () { | ||
const results = [warning, error]; | ||
const outputList = formatInspections(results, reportConfig); | ||
@@ -134,0 +128,0 @@ expect(outputList[9]).to.eql( |
@@ -1,2 +0,2 @@ | ||
exports.createFatalError = () => ({ | ||
exports.unknownError = { | ||
messages: [ | ||
@@ -7,10 +7,25 @@ { | ||
column: 1, | ||
message: 'Some unknown error', | ||
// For example, if the ecmaVersion is set to 5 and ES6+ syntax is used, then ESLint | ||
// would fail to parse the file | ||
ruleId: null, | ||
}, | ||
], | ||
filePath: 'testfile-unknown.js', | ||
}; | ||
exports.fatalError = { | ||
messages: [ | ||
{ | ||
fatal: true, // usually omitted, but will be set to true if there's a parsing error | ||
line: 1, | ||
column: 1, | ||
message: 'Some fatal error', | ||
ruleId: 'no-eval' | ||
} | ||
ruleId: 'no-eval', | ||
}, | ||
], | ||
filePath: 'testfile-fatal.js' | ||
}); | ||
filePath: 'testfile-fatal.js', | ||
}; | ||
exports.createDummyError = () => ({ | ||
exports.error = { | ||
messages: [ | ||
@@ -22,3 +37,3 @@ { | ||
message: "'\n\r\u0085\u2028\u2029|[]", | ||
ruleId: 'no-console' | ||
ruleId: 'no-console', | ||
}, | ||
@@ -30,9 +45,9 @@ { | ||
message: 'This is a test error.', | ||
ruleId: 'no-unreachable' | ||
} | ||
ruleId: 'no-unreachable', | ||
}, | ||
], | ||
filePath: 'testfile.js' | ||
}); | ||
filePath: 'testfile.js', | ||
}; | ||
exports.createDummyWarning = () => ({ | ||
exports.warning = { | ||
messages: [ | ||
@@ -44,3 +59,3 @@ { | ||
message: 'Some warning', | ||
ruleId: 'eqeqeq' | ||
ruleId: 'eqeqeq', | ||
}, | ||
@@ -52,6 +67,6 @@ { | ||
message: 'This is a test warning.', | ||
ruleId: 'complexity' | ||
} | ||
ruleId: 'complexity', | ||
}, | ||
], | ||
filePath: 'testfile-warning.js' | ||
}); | ||
filePath: 'testfile-warning.js', | ||
}; |
@@ -1,3 +0,1 @@ | ||
/* global it, describe, beforeEach, afterEach */ | ||
const { expect } = require('chai'); | ||
@@ -7,3 +5,3 @@ const sh = require('shelljs'); | ||
const fs = require('fs-extra'); | ||
const { createDummyError } = require('./helpers/eslint-factory'); | ||
const { error } = require('./helpers/eslint-factory'); | ||
@@ -19,3 +17,3 @@ const basePath = path.resolve(__dirname, '..'); | ||
beforeEach(function () { | ||
esLintOutput.push(createDummyError()); | ||
esLintOutput.push(error); | ||
}); | ||
@@ -22,0 +20,0 @@ |
@@ -1,3 +0,1 @@ | ||
/* global it, describe, context */ | ||
const fs = require('fs'); | ||
@@ -8,6 +6,6 @@ const { expect } = require('chai'); | ||
describe('utils', function() { | ||
describe('utils', function () { | ||
describe('loadPackageJson', () => { | ||
context('success', function() { | ||
it('returns a string representation of package.json', function() { | ||
context('success', function () { | ||
it('returns a string representation of package.json', function () { | ||
sinon.stub(fs, 'readFileSync').callsFake(() => 'package.json contents'); | ||
@@ -19,4 +17,4 @@ expect(utils.loadPackageJson()).to.eql('package.json contents'); | ||
context('failure', function() { | ||
it('returns an empty object representation', function() { | ||
context('failure', function () { | ||
it('returns an empty object representation', function () { | ||
sinon.stub(fs, 'readFileSync').throws(); | ||
@@ -29,8 +27,8 @@ expect(utils.loadPackageJson()).to.eql('{}'); | ||
describe('escapeTeamCityString', function() { | ||
it('returns empty strings', function() { | ||
describe('escapeTeamCityString', function () { | ||
it('returns empty strings', function () { | ||
expect(utils.escapeTeamCityString(null)).to.eql(''); | ||
}); | ||
it('replaces TeamCity special characters', function() { | ||
it('replaces TeamCity special characters', function () { | ||
expect(utils.escapeTeamCityString("'\n\r\u0085\u2028\u2029|[]")).to.eql("|'|n|r|x|l|p|||[|]"); | ||
@@ -37,0 +35,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39579
768
188