Skip to content

Commit 4d75956

Browse files
authored
Build: CI with Azure Pipelines (#11845)
1 parent 1db3462 commit 4d75956

13 files changed

Lines changed: 193 additions & 140 deletions

File tree

.azure-pipelines/job.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
parameters:
2+
name: ""
3+
displayName: ""
4+
vmImage: ""
5+
nodeVersion: ""
6+
7+
jobs:
8+
- job: ${{parameters.name}}
9+
displayName: ${{parameters.displayName}}
10+
pool:
11+
vmImage: ${{parameters.vmImage}}
12+
steps:
13+
- task: NodeTool@0
14+
displayName: Install Node.js
15+
inputs:
16+
versionSpec: ${{parameters.nodeVersion}}
17+
18+
- script: npm install
19+
displayName: Install Packages
20+
21+
- script: npm test
22+
displayName: Test
23+
24+
- task: PublishTestResults@2
25+
displayName: Process Test Results
26+
condition: succeededOrFailed()
27+
inputs:
28+
testRunner: JUnit
29+
testResultsFiles: $(System.DefaultWorkingDirectory)/test-results.xml
30+
31+
- task: PublishCodeCoverageResults@1
32+
displayName: Process Coverage Results
33+
condition: succeededOrFailed()
34+
inputs:
35+
codeCoverageTool: Cobertura
36+
summaryFileLocation: $(System.DefaultWorkingDirectory)/coverage/cobertura-coverage.xml
37+
reportDirectory: $(System.DefaultWorkingDirectory)/coverage

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ versions.json
1717
.sublimelinterrc
1818
.eslint-release-info.json
1919
.nyc_output
20+
/test-results.xml

.nycrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
],
77
"reporter": [
88
"lcov",
9-
"text-summary"
9+
"text-summary",
10+
"cobertura"
1011
],
1112
"sourceMap": true
1213
}

.travis.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

Makefile.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,10 @@ target.test = function() {
544544

545545
echo("Running unit tests");
546546

547-
lastReturn = exec(`${getBinFile("nyc")} -- ${MOCHA} -R progress -t ${MOCHA_TIMEOUT} -c ${TEST_FILES}`);
547+
// In CI (Azure Pipelines), use JUnit reporter.
548+
const reporter = process.env.TF_BUILD ? "mocha-junit-reporter" : "progress";
549+
550+
lastReturn = exec(`${getBinFile("nyc")} -- ${MOCHA} -R ${reporter} -t ${MOCHA_TIMEOUT} -c ${TEST_FILES}`);
548551
if (lastReturn.code !== 0) {
549552
errors++;
550553
}

README.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[![NPM version][npm-image]][npm-url]
2-
[![build status][travis-image]][travis-url]
3-
[![Build status][appveyor-image]][appveyor-url]
2+
[![Build Status](https://dev.azure.com/eslint/eslint/_apis/build/status/eslint.eslint?branchName=master)](https://dev.azure.com/eslint/eslint/_build/latest?definitionId=1&branchName=master)
43
[![Downloads][downloads-image]][downloads-url]
54
[![Bountysource](https://www.bountysource.com/badge/tracker?tracker_id=282608)](https://www.bountysource.com/trackers/282608-eslint?utm_source=282608&utm_medium=shield&utm_campaign=TRACKER_BADGE)
65
[![Join the chat at https://gitter.im/eslint/eslint](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/eslint/eslint?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
@@ -271,11 +270,5 @@ The following companies, organizations, and individuals support ESLint's ongoing
271270

272271
[npm-image]: https://img.shields.io/npm/v/eslint.svg?style=flat-square
273272
[npm-url]: https://www.npmjs.com/package/eslint
274-
[travis-image]: https://img.shields.io/travis/eslint/eslint/master.svg?style=flat-square
275-
[travis-url]: https://travis-ci.org/eslint/eslint
276-
[appveyor-image]: https://ci.appveyor.com/api/projects/status/iwxmiobcvbw3b0av/branch/master?svg=true
277-
[appveyor-url]: https://ci.appveyor.com/project/nzakas/eslint/branch/master
278-
[coveralls-image]: https://img.shields.io/coveralls/eslint/eslint/master.svg?style=flat-square
279-
[coveralls-url]: https://coveralls.io/r/eslint/eslint?branch=master
280273
[downloads-image]: https://img.shields.io/npm/dm/eslint.svg?style=flat-square
281274
[downloads-url]: https://www.npmjs.com/package/eslint

appveyor.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

azure-pipelines.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
trigger:
2+
- master
3+
4+
jobs:
5+
- template: .azure-pipelines/job.yml
6+
parameters:
7+
name: test_on_linux_node12
8+
displayName: Test on Node.js 12 (Linux)
9+
vmImage: Ubuntu-16.04
10+
nodeVersion: 12.x
11+
12+
- template: .azure-pipelines/job.yml
13+
parameters:
14+
name: test_on_linux_node10
15+
displayName: Test on Node.js 10 (Linux)
16+
vmImage: Ubuntu-16.04
17+
nodeVersion: 10.x
18+
19+
- template: .azure-pipelines/job.yml
20+
parameters:
21+
name: test_on_linux_node8
22+
displayName: Test on Node.js 8 (Linux)
23+
vmImage: Ubuntu-16.04
24+
nodeVersion: 8.x
25+
26+
- template: .azure-pipelines/job.yml
27+
parameters:
28+
name: test_on_windows_node12
29+
displayName: Test on Node.js 12 (Windows)
30+
vmImage: Windows-2019
31+
nodeVersion: 12.x
32+
33+
- template: .azure-pipelines/job.yml
34+
parameters:
35+
name: test_on_macos_node12
36+
displayName: Test on Node.js 12 (macOS)
37+
vmImage: macOS-10.14
38+
nodeVersion: 12.x

lib/rule-tester/rule-tester.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,18 @@ function freezeDeeply(x) {
123123
}
124124
}
125125

126+
/**
127+
* Replace control characters by `\u00xx` form.
128+
* @param {string} text The text to sanitize.
129+
* @returns {string} The sanitized text.
130+
*/
131+
function sanitize(text) {
132+
return text.replace(
133+
/[\u0000-\u001f]/gu, // eslint-disable-line no-control-regex
134+
c => `\\u${c.codePointAt(0).toString(16).padStart(4, "0")}`
135+
);
136+
}
137+
126138
//------------------------------------------------------------------------------
127139
// Public Interface
128140
//------------------------------------------------------------------------------
@@ -613,15 +625,15 @@ class RuleTester {
613625
RuleTester.describe(ruleName, () => {
614626
RuleTester.describe("valid", () => {
615627
test.valid.forEach(valid => {
616-
RuleTester.it(typeof valid === "object" ? valid.code : valid, () => {
628+
RuleTester.it(sanitize(typeof valid === "object" ? valid.code : valid), () => {
617629
testValidTemplate(valid);
618630
});
619631
});
620632
});
621633

622634
RuleTester.describe("invalid", () => {
623635
test.invalid.forEach(invalid => {
624-
RuleTester.it(invalid.code, () => {
636+
RuleTester.it(sanitize(invalid.code), () => {
625637
testInvalidTemplate(invalid);
626638
});
627639
});

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
"gensite": "node Makefile.js gensite",
2121
"webpack": "node Makefile.js webpack",
2222
"perf": "node Makefile.js perf",
23-
"profile": "beefy tests/bench/bench.js --open -- -t brfs -t ./tests/bench/xform-rules.js -r espree",
24-
"coveralls": "cat ./coverage/lcov.info | coveralls"
23+
"profile": "beefy tests/bench/bench.js --open -- -t brfs -t ./tests/bench/xform-rules.js -r espree"
2524
},
2625
"gitHooks": {
2726
"pre-commit": "lint-staged"
@@ -93,7 +92,6 @@
9392
"cheerio": "^0.22.0",
9493
"common-tags": "^1.8.0",
9594
"core-js": "^3.1.3",
96-
"coveralls": "^3.0.3",
9795
"dateformat": "^3.0.3",
9896
"ejs": "^2.6.1",
9997
"eslint": "file:.",
@@ -118,6 +116,7 @@
118116
"markdownlint-cli": "^0.15.0",
119117
"metro-memory-fs": "^0.53.1",
120118
"mocha": "^6.1.2",
119+
"mocha-junit-reporter": "^1.23.0",
121120
"npm-license": "^0.3.3",
122121
"nyc": "^13.3.0",
123122
"proxyquire": "^2.0.1",

0 commit comments

Comments
 (0)