Skip to content

Commit

Permalink
Add test for Node ESM conditional exports
Browse files Browse the repository at this point in the history
  • Loading branch information
vikerman committed Apr 30, 2020
1 parent 0f20aa2 commit 4603f22
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ package-lock.json
dist
mini
yarn.lock
htm.tgz
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@
"build:babel": "cd packages/babel-plugin-htm && npm run build",
"build:babel-transform-jsx": "cd packages/babel-plugin-transform-jsx-to-htm && npm run build",
"build:mjsalias": "cp dist/htm.module.js dist/htm.mjs && cp mini/index.module.js mini/index.mjs && cp preact/index.module.js preact/index.mjs && cp preact/standalone.module.js preact/standalone.mjs && cp react/index.module.js react/index.mjs",
"test": "eslint src/**/*.mjs test/**/*.mjs && npm run build && jest test",
"test": "eslint src/**/*.mjs test/**/*.mjs --ignore-path .gitignore && npm run build && jest test",
"test:perf": "v8 test/__perftest.mjs",
"test:dist": "npm pack && mv htm*.tgz test/fixtures/esm/htm.tgz && cd test/fixtures/esm && npm install && node index.js",
"release": "npm t && git commit -am \"$npm_package_version\" && git tag $npm_package_version && git push && git push --tags && npm publish"
},
"files": [
Expand Down
5 changes: 5 additions & 0 deletions test/fixtures/esm/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import "htm";
import "htm/preact";
import "htm/preact/standalone";
// TODOD: Enable once react distro is ESM compatible.
// import "htm/react";
10 changes: 10 additions & 0 deletions test/fixtures/esm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "htm_dist_test",
"type": "module",
"private": true,
"description": "A package to test importing htm as ES modules in Node",
"dependencies": {
"htm": "file:htm.tgz",
"preact": "^10.4.1"
}
}

0 comments on commit 4603f22

Please sign in to comment.