Skip to content

Commit 657739f

Browse files
authoredDec 8, 2021
chore(test): make all tests install with npm ci (#11723)
1 parent 20edab4 commit 657739f

10 files changed

+23
-61
lines changed
 

‎.github/workflows/build.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
with:
1212
node-version: '14'
1313
cache: 'npm'
14-
- name: Install npm@7
15-
run: npm i -g npm@7
14+
- name: Install npm@8
15+
run: npm i -g npm@8
1616
- name: Install
1717
run: npm ci --prefer-offline
1818
- name: Build

‎.github/workflows/integration.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
with:
2323
node-version: ${{ matrix.node }}
2424
cache: 'npm'
25-
- name: Install npm@7
26-
run: npm i -g npm@7
25+
- name: Install npm@8
26+
run: npm i -g npm@8
2727
- name: Install yarn
2828
run: npm i -g yarn
2929
- name: Install packages

‎.github/workflows/lint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
with:
1212
node-version: '14'
1313
cache: 'npm'
14-
- name: Install npm@7
15-
run: npm i -g npm@7
14+
- name: Install npm@8
15+
run: npm i -g npm@8
1616
- name: Install
1717
run: npm ci --prefer-offline
1818
- name: Alex

‎azure-pipelines-test-job.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ jobs:
3131
versionSpec: $(nodeVersion)
3232
displayName: 'Install Node.js'
3333

34-
- script: npm i -g npm@7
35-
displayName: 'Update npm to v7'
34+
- script: npm i -g npm@8
35+
displayName: 'Update npm to v8'
3636

3737
- script: npm ci
3838
displayName: 'Run npm ci'

‎tasks/e2e-behavior.sh

-8
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,6 @@ set -x
6161
cd ..
6262
root_path=$PWD
6363

64-
if hash npm 2>/dev/null
65-
then
66-
npm i -g --force npm@latest
67-
fi
68-
69-
# Bootstrap monorepo
70-
npm install
71-
7264
# ******************************************************************************
7365
# First, publish the monorepo.
7466
# ******************************************************************************

‎tasks/e2e-installs.sh

-8
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,6 @@ set -x
8383
cd ..
8484
root_path=$PWD
8585

86-
if hash npm 2>/dev/null
87-
then
88-
npm i -g npm@latest
89-
fi
90-
91-
# Bootstrap monorepo
92-
npm install
93-
9486
# ******************************************************************************
9587
# First, publish the monorepo.
9688
# ******************************************************************************

‎tasks/e2e-kitchensink-eject.sh

-8
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,6 @@ if [ "$AGENT_OS" == 'Windows_NT' ]; then
6969
root_path=$(cmd //c cd)
7070
fi
7171

72-
if hash npm 2>/dev/null
73-
then
74-
npm i -g npm@latest
75-
fi
76-
77-
# Bootstrap monorepo
78-
npm install
79-
8072
# ******************************************************************************
8173
# First, publish the monorepo.
8274
# ******************************************************************************

‎tasks/e2e-kitchensink.sh

-8
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,6 @@ if [ "$AGENT_OS" == 'Windows_NT' ]; then
6969
root_path=$(cmd //c cd)
7070
fi
7171

72-
if hash npm 2>/dev/null
73-
then
74-
npm i -g npm@latest
75-
fi
76-
77-
# Bootstrap monorepo
78-
npm install
79-
8072
# ******************************************************************************
8173
# First, publish the monorepo.
8274
# ******************************************************************************

‎tasks/e2e-simple.sh

-8
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,6 @@ if [ "$EXPECTED" != "$ACTUAL" ]; then
7676
exit 1
7777
fi
7878

79-
if hash npm 2>/dev/null
80-
then
81-
npm i -g npm@latest
82-
fi
83-
84-
# Bootstrap monorepo
85-
npm install
86-
8779
# Start the local NPM registry
8880
startLocalRegistry "$root_path"/tasks/verdaccio.yaml
8981

‎tasks/local-test.sh

+15-13
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@
44
# This source code is licensed under the MIT license found in the
55
# LICENSE file in the root directory of this source tree.
66

7+
node_version=14
8+
current_git_branch=`git rev-parse --abbrev-ref HEAD`
9+
git_branch=${current_git_branch}
10+
test_suite=all
11+
interactive=false
12+
713
function print_help {
814
echo "Usage: ${0} [OPTIONS]"
915
echo ""
1016
echo "OPTIONS:"
11-
echo " --node-version <version> the node version to use while testing [12]"
12-
echo " --git-branch <branch> the git branch to checkout for testing [the current one]"
13-
echo " --test-suite <suite> which test suite to use ('all', 'behavior', installs', 'kitchensink', 'kitchensink-eject', 'simple') ['all']"
14-
echo " --interactive gain a bash shell after the test run"
17+
echo " --node-version <version> the node version to use while testing [${node_version}]"
18+
echo " --git-branch <branch> the git branch to checkout for testing [${current_git_branch}]"
19+
echo " --test-suite <suite> which test suite to use ('all', 'behavior', installs', 'kitchensink', 'kitchensink-eject', 'simple') ['${test_suite}']"
20+
echo " --interactive gain a bash shell after the test run [${interactive}]"
1521
echo " --help print this message and exit"
1622
echo ""
1723
}
1824

1925
cd $(dirname $0)
2026

21-
node_version=14
22-
current_git_branch=`git rev-parse --abbrev-ref HEAD`
23-
git_branch=${current_git_branch}
24-
test_suite=all
25-
interactive=false
26-
2727
while [ "$1" != "" ]; do
2828
case $1 in
2929
"--node-version")
@@ -84,22 +84,24 @@ cd -
8484
mv /var/create-react-app/patch .
8585
git apply patch
8686
rm patch
87+
git add -A
88+
git commit -m 'Apply local changes'
8789
CMD
8890

8991
if [ ${git_branch} != ${current_git_branch} ]; then
9092
apply_changes=''
9193
fi
9294

9395
read -r -d '' command <<- CMD
94-
echo "prefix=~/.npm" > ~/.npmrc
95-
mkdir ~/.npm
96-
export PATH=\$PATH:~/.npm/bin
96+
npm install npm@8 -g
97+
export PATH=\$(npm config get prefix -g)/bin:\$PATH
9798
set -x
9899
git clone /var/create-react-app create-react-app --branch ${git_branch}
99100
cd create-react-app
100101
${apply_changes}
101102
node --version
102103
npm --version
104+
npm ci
103105
set +x
104106
${test_command}
105107
result_code=\$?

0 commit comments

Comments
 (0)
Please sign in to comment.