Skip to content

Commit

Permalink
chore(test): make all tests install with npm ci (#11723)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys authored Dec 8, 2021
1 parent 20edab4 commit 657739f
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 61 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
with:
node-version: '14'
cache: 'npm'
- name: Install npm@7
run: npm i -g npm@7
- name: Install npm@8
run: npm i -g npm@8
- name: Install
run: npm ci --prefer-offline
- name: Build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- name: Install npm@7
run: npm i -g npm@7
- name: Install npm@8
run: npm i -g npm@8
- name: Install yarn
run: npm i -g yarn
- name: Install packages
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
with:
node-version: '14'
cache: 'npm'
- name: Install npm@7
run: npm i -g npm@7
- name: Install npm@8
run: npm i -g npm@8
- name: Install
run: npm ci --prefer-offline
- name: Alex
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines-test-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ jobs:
versionSpec: $(nodeVersion)
displayName: 'Install Node.js'

- script: npm i -g npm@7
displayName: 'Update npm to v7'
- script: npm i -g npm@8
displayName: 'Update npm to v8'

- script: npm ci
displayName: 'Run npm ci'
Expand Down
8 changes: 0 additions & 8 deletions tasks/e2e-behavior.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,6 @@ set -x
cd ..
root_path=$PWD

if hash npm 2>/dev/null
then
npm i -g --force npm@latest
fi

# Bootstrap monorepo
npm install

# ******************************************************************************
# First, publish the monorepo.
# ******************************************************************************
Expand Down
8 changes: 0 additions & 8 deletions tasks/e2e-installs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,6 @@ set -x
cd ..
root_path=$PWD

if hash npm 2>/dev/null
then
npm i -g npm@latest
fi

# Bootstrap monorepo
npm install

# ******************************************************************************
# First, publish the monorepo.
# ******************************************************************************
Expand Down
8 changes: 0 additions & 8 deletions tasks/e2e-kitchensink-eject.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,6 @@ if [ "$AGENT_OS" == 'Windows_NT' ]; then
root_path=$(cmd //c cd)
fi

if hash npm 2>/dev/null
then
npm i -g npm@latest
fi

# Bootstrap monorepo
npm install

# ******************************************************************************
# First, publish the monorepo.
# ******************************************************************************
Expand Down
8 changes: 0 additions & 8 deletions tasks/e2e-kitchensink.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,6 @@ if [ "$AGENT_OS" == 'Windows_NT' ]; then
root_path=$(cmd //c cd)
fi

if hash npm 2>/dev/null
then
npm i -g npm@latest
fi

# Bootstrap monorepo
npm install

# ******************************************************************************
# First, publish the monorepo.
# ******************************************************************************
Expand Down
8 changes: 0 additions & 8 deletions tasks/e2e-simple.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,6 @@ if [ "$EXPECTED" != "$ACTUAL" ]; then
exit 1
fi

if hash npm 2>/dev/null
then
npm i -g npm@latest
fi

# Bootstrap monorepo
npm install

# Start the local NPM registry
startLocalRegistry "$root_path"/tasks/verdaccio.yaml

Expand Down
28 changes: 15 additions & 13 deletions tasks/local-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

node_version=14
current_git_branch=`git rev-parse --abbrev-ref HEAD`
git_branch=${current_git_branch}
test_suite=all
interactive=false

function print_help {
echo "Usage: ${0} [OPTIONS]"
echo ""
echo "OPTIONS:"
echo " --node-version <version> the node version to use while testing [12]"
echo " --git-branch <branch> the git branch to checkout for testing [the current one]"
echo " --test-suite <suite> which test suite to use ('all', 'behavior', installs', 'kitchensink', 'kitchensink-eject', 'simple') ['all']"
echo " --interactive gain a bash shell after the test run"
echo " --node-version <version> the node version to use while testing [${node_version}]"
echo " --git-branch <branch> the git branch to checkout for testing [${current_git_branch}]"
echo " --test-suite <suite> which test suite to use ('all', 'behavior', installs', 'kitchensink', 'kitchensink-eject', 'simple') ['${test_suite}']"
echo " --interactive gain a bash shell after the test run [${interactive}]"
echo " --help print this message and exit"
echo ""
}

cd $(dirname $0)

node_version=14
current_git_branch=`git rev-parse --abbrev-ref HEAD`
git_branch=${current_git_branch}
test_suite=all
interactive=false

while [ "$1" != "" ]; do
case $1 in
"--node-version")
Expand Down Expand Up @@ -84,22 +84,24 @@ cd -
mv /var/create-react-app/patch .
git apply patch
rm patch
git add -A
git commit -m 'Apply local changes'
CMD

if [ ${git_branch} != ${current_git_branch} ]; then
apply_changes=''
fi

read -r -d '' command <<- CMD
echo "prefix=~/.npm" > ~/.npmrc
mkdir ~/.npm
export PATH=\$PATH:~/.npm/bin
npm install npm@8 -g
export PATH=\$(npm config get prefix -g)/bin:\$PATH
set -x
git clone /var/create-react-app create-react-app --branch ${git_branch}
cd create-react-app
${apply_changes}
node --version
npm --version
npm ci
set +x
${test_command}
result_code=\$?
Expand Down

0 comments on commit 657739f

Please sign in to comment.