From 30e1ce6e42bf7cd44c9b4f0b8246ab20affaf0c2 Mon Sep 17 00:00:00 2001 From: Will Smythe Date: Thu, 10 Jan 2019 08:09:53 -0500 Subject: [PATCH] Drop unnecessary VSTS_OVERWRITE_TEMP and fix failing tests. See #7598 --- .azure-pipelines.yml | 4 +--- e2e/Utils.js | 8 +++++--- e2e/__tests__/hasteMapSize.test.js | 3 ++- packages/jest-config/src/getCacheDirectory.js | 9 +++++++-- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 5b560a96707b..f87035abb706 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -12,8 +12,6 @@ jobs: - job: Windows pool: vmImage: vs2017-win2016 - variables: - VSTS_OVERWRITE_TEMP: true steps: - script: | git config --global core.autocrlf false @@ -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 diff --git a/e2e/Utils.js b/e2e/Utils.js index 47dca4e0360b..5588bb9d235e 100644 --- a/e2e/Utils.js +++ b/e2e/Utils.js @@ -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( ` diff --git a/e2e/__tests__/hasteMapSize.test.js b/e2e/__tests__/hasteMapSize.test.js index 8daf564d28d2..160bf08e0db6 100644 --- a/e2e/__tests__/hasteMapSize.test.js +++ b/e2e/__tests__/hasteMapSize.test.js @@ -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); diff --git a/packages/jest-config/src/getCacheDirectory.js b/packages/jest-config/src/getCacheDirectory.js index 36bae7092d15..7298a15a5465 100644 --- a/packages/jest-config/src/getCacheDirectory.js +++ b/packages/jest-config/src/getCacheDirectory.js @@ -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;