-
Notifications
You must be signed in to change notification settings - Fork 641
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add tests to prevent updating to esm-only dependencies (#1051)
packages that no longer support commonjs use should never be installed (#1047). However, without a failing test, the dependabot PRs will just slip through, so we have to add a test that will fail when import/require of this package won't work.
- Loading branch information
1 parent
522b09e
commit fd95b9c
Showing
3 changed files
with
30 additions
and
7 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
failed=0 | ||
|
||
cjsCode='const {Client} = require("./dist/"); new Client();' | ||
esmCode='import {Client} from "./dist/index.js"; new Client();' | ||
|
||
echo "test loading as commonJS..." | ||
if ! node -e "${cjsCode}" ; then | ||
failed=1 | ||
echo 'Loading package as commomJS failed' >&2 | ||
fi | ||
|
||
echo "test loading as ESM..." | ||
if ! node --input-type module -e "${esmCode}" ; then | ||
failed=1 | ||
echo 'Loading package as ESM failed' >&2 | ||
fi | ||
|
||
if [ $failed -eq 1 ] ; then exit 1 ; fi |