Skip to content

Commit

Permalink
Drop unnecessary VSTS_OVERWRITE_TEMP and fix failing tests. See jestj…
Browse files Browse the repository at this point in the history
  • Loading branch information
willsmythe committed Jan 14, 2019
1 parent 14f32c9 commit 30e1ce6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
4 changes: 1 addition & 3 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ jobs:
- job: Windows
pool:
vmImage: vs2017-win2016
variables:
VSTS_OVERWRITE_TEMP: true
steps:
- script: |
git config --global core.autocrlf false
Expand All @@ -25,7 +23,7 @@ jobs:
pool:
vmImage: macos-10.13
steps:
- script: brew install mercurial
- script: HOMEBREW_NO_AUTO_UPDATE=1 brew install mercurial
displayName: 'Install Mercurial'
- template: .azure-pipelines-steps.yml

Expand Down
8 changes: 5 additions & 3 deletions e2e/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,11 @@ export const createEmptyPackage = (
};

export const extractSummary = (stdout: string) => {
const match = stdout.replace(/(?:\\[rn])+/g, '\n').match(
/Test Suites:.*\nTests.*\nSnapshots.*\nTime.*(\nRan all test suites)*.*\n*$/gm,
);
const match = stdout
.replace(/(?:\\[rn])+/g, '\n')
.match(
/Test Suites:.*\nTests.*\nSnapshots.*\nTime.*(\nRan all test suites)*.*\n*$/gm,
);
if (!match) {
throw new Error(
`
Expand Down
3 changes: 2 additions & 1 deletion e2e/__tests__/hasteMapSize.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import os from 'os';
import path from 'path';
import HasteMap from 'jest-haste-map';
import {cleanup, writeFiles} from '../Utils';
import {sync as realpath} from 'realpath-native';

const DIR = path.resolve(os.tmpdir(), 'haste_map_size');
const DIR = path.resolve(realpath(os.tmpdir()), 'haste_map_size');

beforeEach(() => {
cleanup(DIR);
Expand Down
9 changes: 7 additions & 2 deletions packages/jest-config/src/getCacheDirectory.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,20 @@
const path = require('path');
const os = require('os');

import {sync as realpath} from 'realpath-native';

const getCacheDirectory = () => {
const {getuid} = process;
if (getuid == null) {
return path.join(os.tmpdir(), 'jest');
return path.join(realpath(os.tmpdir()), 'jest');
}
// On some platforms tmpdir() is `/tmp`, causing conflicts between different
// users and permission issues. Adding an additional subdivision by UID can
// help.
return path.join(os.tmpdir(), 'jest_' + getuid.call(process).toString(36));
return path.join(
realpath(os.tmpdir()),
'jest_' + getuid.call(process).toString(36),
);
};

export default getCacheDirectory;

0 comments on commit 30e1ce6

Please sign in to comment.