Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: skip mercurial tests when no hg installed #9840

Merged
merged 8 commits into from
Apr 21, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion e2e/__tests__/onlyChanged.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import {tmpdir} from 'os';
import * as path from 'path';
import which = require('which');
import runJest from '../runJest';
import {cleanup, run, writeFiles} from '../Utils';

Expand All @@ -17,6 +18,14 @@ const HG = 'hg --config ui.username=jest_test';
beforeEach(() => cleanup(DIR));
afterEach(() => cleanup(DIR));

// Certain environments (like CITGM and GH Actions) do not come with mercurial installed
const hgIsInstalled = which.sync('hg', {nothrow: true}) !== null;
SimenB marked this conversation as resolved.
Show resolved Hide resolved
const testIfHg = hgIsInstalled ? test : test.skip;

if (!hgIsInstalled) {
console.warn('Mercurial (hg) is not installed - skipping some tests');
}

test('run for "onlyChanged" and "changedSince"', () => {
writeFiles(DIR, {
'.watchmanconfig': '',
Expand Down Expand Up @@ -252,7 +261,7 @@ test('onlyChanged in config is overwritten by --all or testPathPattern', () => {
expect(stderr).toMatch(/PASS __tests__(\/|\\)file3.test.js/);
});

test('gets changed files for hg', async () => {
testIfHg('gets changed files for hg', async () => {
if (process.env.CI) {
// Circle and Travis have very old version of hg (v2, and current
// version is v4.2) and its API changed since then and not compatible
Expand Down