mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-28 13:24:24 +08:00
* Make repeated unit test startup cheaper Check the cached Electron version and executable directly in the unit test launchers, while retaining an explicit forced prelaunch path for packaging changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Restore Windows test dependency bootstrap Keep the fresh-checkout npm install behavior before applying the faster Electron cache check. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Align Windows test dependency bootstrap Use npm install when node_modules is missing, matching the long-standing Unix unit-test launcher behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Keep unit test launchers dependency-neutral Restore the historical expectation that dependencies are installed before running tests, and use the shared npm Electron entry point on Windows and Unix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
49 lines
1.4 KiB
Bash
Executable File
49 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
|
|
ROOT=$(dirname $(dirname $(realpath "$0")))
|
|
else
|
|
ROOT=$(dirname $(dirname $(readlink -f $0)))
|
|
fi
|
|
|
|
cd $ROOT
|
|
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
NAME=`node -p "require('./product.json').nameLong"`
|
|
EXE_NAME=`node -p "require('./product.json').nameShort"`
|
|
CODE="./.build/electron/$NAME.app/Contents/MacOS/$EXE_NAME"
|
|
else
|
|
NAME=`node -p "require('./product.json').applicationName"`
|
|
CODE=".build/electron/$NAME"
|
|
fi
|
|
|
|
VSCODECRASHDIR=$ROOT/.build/crashes
|
|
|
|
# Node modules
|
|
test -d node_modules || npm i
|
|
|
|
# Get electron
|
|
if [[ -z "${VSCODE_SKIP_PRELAUNCH}" ]]; then
|
|
EXPECTED_ELECTRON_VERSION=$(sed -n 's/^target="\([^"]*\)"$/\1/p' .npmrc)
|
|
INSTALLED_ELECTRON_VERSION=$(cat .build/electron/version 2>/dev/null || true)
|
|
INSTALLED_ELECTRON_VERSION=${INSTALLED_ELECTRON_VERSION#v}
|
|
if [[ -n "${VSCODE_FORCE_PRELAUNCH:-}" || ! -x "$CODE" || "$INSTALLED_ELECTRON_VERSION" != "$EXPECTED_ELECTRON_VERSION" ]]; then
|
|
npm run electron
|
|
fi
|
|
fi
|
|
|
|
# Unit Tests
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
cd $ROOT ; ulimit -n 4096 ; \
|
|
ELECTRON_ENABLE_LOGGING=1 \
|
|
"$CODE" \
|
|
test/unit/electron/index.js --crash-reporter-directory=$VSCODECRASHDIR "$@"
|
|
else
|
|
cd $ROOT ; \
|
|
ELECTRON_ENABLE_LOGGING=1 \
|
|
"$CODE" \
|
|
test/unit/electron/index.js --crash-reporter-directory=$VSCODECRASHDIR "$@"
|
|
fi
|