#!/usr/bin/env bash # Copyright 2026 @quantus/crypto authors & contributors # SPDX-License-Identifier: Apache-2.0 # Runs the consumer test against a staged node_modules rather than in-place. # # In this repo `node_modules/@polkadot/wasm-util` symlinks to the package *source* # directory, whose package.json carries no `exports` map — only the build output # does. So a deep import like `@polkadot/wasm-util/base64` resolves for a real # consumer and fails here, which would make the in-place test wrong in a way that # has nothing to do with our package. Staging the built artifacts the way an # install lays them out tests module resolution too, which is half of what can # break in a published package. set -e PKG=packages/quantus-crypto STAGE=$PKG/build-test rm -rf $STAGE mkdir -p $STAGE/node_modules/@quantus $STAGE/node_modules/@polkadot cp -r $PKG/build $STAGE/node_modules/@quantus/crypto cp -r packages/wasm-util/build $STAGE/node_modules/@polkadot/wasm-util echo '{ "name": "quantus-crypto-consumer-test", "type": "module", "version": "0.0.0" }' > $STAGE/package.json cp $PKG/test/consumer.mjs $STAGE/consumer.mjs node $STAGE/consumer.mjs rm -rf $STAGE