Skip to content

Commit

Permalink
ci: integration test of published tarball (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
broofa authored Dec 1, 2023
1 parent d59a2eb commit d1dd94d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"prepare": "npm run build",
"prepublishOnly": "npm run build && npm run build:types",
"release": "# `standard-version --dry-run --prerelease` is the command you're after",
"test": "node --test",
"test": "node --test && ./test/exports_test.sh",
"test:watch": "clear && node --enable-source-maps --test --watch test"
},
"keywords": [
Expand Down
25 changes: 25 additions & 0 deletions test/exports_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
TESTDIR="/tmp/mime_test"

echo -e "\n\nExports test"
\rm -fr $TESTDIR
mkdir -p $TESTDIR

echo "... building tarball"
cd $SCRIPT_DIR/..
npm pack --silent --pack-destination $TESTDIR > /dev/null 2>&1

echo ... installing tarball
cd $TESTDIR
npm install --silent mime*.tgz

echo "... testing imports"
node --input-type=module - << EOF
import mime from "mime";
import mimelite from "mime/lite";
console.log('okay');
EOF

0 comments on commit d1dd94d

Please sign in to comment.