diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index a3c36c5f..b8b843ad 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -28,7 +28,7 @@ jobs: - run: npm run build --if-present - run: | { PER=$(npm run test-cover | tee /dev/fd/3 | grep -oP "All\ files[^\d]*(\d\d?\.?\d?\d?)" | grep -oP "(\d\d?\.?\d?\d?)$"); } 3>&1 - echo "COVERAGE=$PER" >> $GITHUB_ENV + echo "COVERAGE=$PER%" >> $GITHUB_ENV # var REF = 'refs/pull/27/merge.json'; REF=${{ github.ref }} # console.log('github.ref: ' + REF); diff --git a/README.md b/README.md index 571b24b0..3355e3ca 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,11 @@ await esmock( { ...globalmocks }) // mock definitions imported everywhere ``` +_note: `esmock` is [unable to mock some export expressions.][20]_ `esmock` is improving in this area. [See the wiki][20] for more details. + +[20]: https://github.com/iambumblehead/esmock/wiki#user-content-problems-module-resolution + + `esmock` examples ``` javascript import test from 'node:test' diff --git a/package.json b/package.json index 2e89aff9..39eb57f8 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,15 @@ { "name": "esmock", - "version": "1.9.0", + "type": "module", + "version": "1.9.1", "license": "ISC", "readmeFilename": "README.md", "description": "provides native ESM import mocking for unit tests", "author": "chris ", - "main": "src/esmockLoader.js", - "module": "src/esmockLoader.js", - "type": "module", - "types": "src/esmock.d.ts", + "exports": { + "types": "./src/esmock.d.ts", + "import": "./src/esmockLoader.js" + }, "repository": { "type": "git", "url": "https://github.com/iambumblehead/esmock.git" diff --git a/src/esmockLoader.js b/src/esmockLoader.js index c3280978..3a9a5cd2 100644 --- a/src/esmockLoader.js +++ b/src/esmockLoader.js @@ -46,7 +46,7 @@ const resolve = async (specifier, context, nextResolve) => { // later versions of node v16 include 'node-addons' const resolved = context.parentURL && ( context.conditions.slice(-1)[0] === 'node-addons' - || (context.importAssertions || isLT1612)) + || context.importAssertions || isLT1612) ? await nextResolve(specifier, context) : await nextResolve(specifier)