Skip to content

Commit b479b47

Browse files
committed
Initial Azure Pipelines support (Linux, Windows, and macOS)
1 parent 9208ac6 commit b479b47

File tree

4 files changed

+85
-3
lines changed

4 files changed

+85
-3
lines changed

.azure-pipelines-steps.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#
2+
# CI build and test steps. See azure-pipelines.yml for job details.
3+
#
4+
5+
steps:
6+
- checkout: self
7+
8+
# Ensure Node.js 10 is active
9+
- task: NodeTool@0
10+
inputs:
11+
versionSpec: '10.x'
12+
displayName: 'Use Node.js 10'
13+
14+
# Ensure Python 2.7 is active
15+
- task: UsePythonVersion@0
16+
inputs:
17+
versionSpec: '2.7'
18+
displayName: 'Use Python 2.7'
19+
20+
# Workaround to move repo source files into a "jest" folder (see azure-pipelines.yml for details)
21+
- script: |
22+
cd /
23+
mv $(Build.Repository.LocalPath) $(JEST_DIR)
24+
mkdir $(Build.Repository.LocalPath)
25+
displayName: 'Move source into jest folder'
26+
27+
# Run yarn to install dependencies and build
28+
- script: yarn
29+
workingDirectory: $(JEST_DIR)
30+
displayName: 'Install dependencies and build'
31+
32+
# Run test-ci-partial
33+
- script: yarn run test-ci-partial
34+
workingDirectory: $(JEST_DIR)
35+
displayName: 'Run tests'
36+
37+
# Publish CI test results
38+
- task: PublishTestResults@2
39+
inputs:
40+
testResultsFiles: '**/reports/junit/*.xml'
41+
searchFolder: $(JEST_DIR)
42+
testRunTitle: 'CI Tests $(Agent.OS)'
43+
displayName: 'Publish test results'
44+
condition: succeededOrFailed()

.azure-pipelines.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#
2+
# Azure Pipelines CI configuration for Linux, Windows, and macOS.
3+
#
4+
5+
jobs:
6+
- job: Linux
7+
pool:
8+
vmImage: ubuntu-16.04
9+
steps:
10+
- template: .azure-pipelines-steps.yml
11+
12+
- job: Windows
13+
pool:
14+
vmImage: vs2017-win2016
15+
steps:
16+
- script: git config --global core.autocrlf false
17+
displayName: 'Clone with LF preserved'
18+
19+
- script: choco install hg
20+
displayName: 'Install Mercurial'
21+
22+
- template: .azure-pipelines-steps.yml
23+
24+
- job: macOS
25+
pool:
26+
vmImage: macos-10.13
27+
steps:
28+
- script: brew install mercurial
29+
displayName: 'Install Mercurial'
30+
31+
- template: .azure-pipelines-steps.yml
32+
33+
variables:
34+
# Ensures output produced by Jest for certain tests includes ANSI escape characters (needed to match snapshots)
35+
FORCE_COLOR: 1
36+
# Default checkout directory is "s", but inline snapshot tests will fail due to assumption that Jest is running under a "jest" folder
37+
# (see packages/jest-message-util/src/index.js PATH_JEST_PACKAGES)
38+
JEST_DIR: $(Agent.BuildDirectory)/jest

e2e/Utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export const createEmptyPackage = (
137137
};
138138

139139
export const extractSummary = (stdout: string) => {
140-
const match = stdout.match(
140+
const match = stdout.replace(/(?:\\[rn])+/g, '\n').match(
141141
/Test Suites:.*\nTests.*\nSnapshots.*\nTime.*(\nRan all test suites)*.*\n*$/gm,
142142
);
143143
if (!match) {

e2e/runJest.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default function runJest(
3131
args?: Array<string>,
3232
options: RunJestOptions = {},
3333
) {
34-
const isRelative = dir[0] !== '/';
34+
const isRelative = !path.isAbsolute(dir);
3535

3636
if (isRelative) {
3737
dir = path.resolve(__dirname, dir);
@@ -101,7 +101,7 @@ export const until = async function(
101101
text: string,
102102
options: RunJestOptions = {},
103103
) {
104-
const isRelative = dir[0] !== '/';
104+
const isRelative = !path.isAbsolute(dir);
105105

106106
if (isRelative) {
107107
dir = path.resolve(__dirname, dir);

0 commit comments

Comments
 (0)