Skip to content

Commit

Permalink
test: fix the smoke test on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Oct 27, 2024
1 parent 9516f77 commit bbe216b
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions script/smoke-test.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,21 @@ root="${PWD}"

echo "Pack zeromq.js if needed"
version=$(node -e 'console.log(require("./package.json").version)')
pack_path="${root}/zeromq-${version}.tgz"
test -f "${pack_path}" || npm pack


init_smoke_test() {
local pm=$1
echo "Init Smoke Test Project ${pm}"

rm -rf "../zeromq-smoke-test-${pm}"
mkdir "../zeromq-smoke-test-${pm}"
cd "../zeromq-smoke-test-${pm}"
npm init -y
npm pkg set dependencies.zeromq="file:${pack_path}" || (jq ".dependencies.zeromq = \"file:${pack_path}\"" package.json >temp.json && mv temp.json package.json)
}
pack_name="zeromq-${version}.tgz"
test -f "./${pack_name}" || npm pack

package_managers=(npm pnpm yarn)

for pm in "${package_managers[@]}"; do
init_smoke_test "${pm}"
dir="../zeromq-smoke-test-${pm}"

echo "Init Smoke Test Project ${pm}"
rm -rf "${dir}"
mkdir "${dir}"
cp "./${pack_name}" "${dir}"
cd "${dir}"
npm init -y
npm pkg set dependencies.zeromq="file:./${pack_name}" || (jq ".dependencies.zeromq = \"file:./${pack_name}\"" package.json >temp.json && mv temp.json package.json)

echo "Install with ${pm}"
${pm} install
Expand All @@ -36,4 +32,4 @@ for pm in "${package_managers[@]}"; do
rm -rf "../zeromq-smoke-test-${pm}"
done

rm -f "${pack_path}"
rm -f "${pack_name}"

0 comments on commit bbe216b

Please sign in to comment.