From cb8d6705f87a375364ed401eb92556abf22bdd5b Mon Sep 17 00:00:00 2001 From: chris Date: Sun, 31 Jul 2022 06:30:06 -0700 Subject: [PATCH 1/6] add subpath exports --- package.json | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 2e89aff9..af85fac6 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,16 @@ { "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" From 33d3d60ac5afd1f61b576c0e282dbd47e92cda2d Mon Sep 17 00:00:00 2001 From: chris Date: Sun, 31 Jul 2022 06:38:41 -0700 Subject: [PATCH 2/6] added percent sign to coverage value, remove un-needed parens --- .github/workflows/coverage.yml | 2 +- package.json | 1 - src/esmockLoader.js | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) 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/package.json b/package.json index af85fac6..39eb57f8 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,6 @@ "readmeFilename": "README.md", "description": "provides native ESM import mocking for unit tests", "author": "chris ", - "main": "src/esmockLoader.js", "exports": { "types": "./src/esmock.d.ts", "import": "./src/esmockLoader.js" 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) From 9bc2db0259d82474603e53fba299f78ab1855f0a Mon Sep 17 00:00:00 2001 From: chris Date: Sun, 31 Jul 2022 06:46:44 -0700 Subject: [PATCH 3/6] update README with note and link to wiki --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 571b24b0..de18b7ca 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,11 @@ await esmock( { ...globalmocks }) // mock definitions imported everywhere ``` +_note: `esmock` is unable [unable to mock some modules.][20]_ `esmock` is improving in this area and if you encounter a module that isn't mocked, please report that and, if possible, submit a demonstration PR with a failing test case. [See the wiki][20] for more details. + +[20]: https://github.com/iambumblehead/esmock/wiki#problems-module-resolution + + `esmock` examples ``` javascript import test from 'node:test' From e3402919700421c78d78e4992c56cda9a7d3e3aa Mon Sep 17 00:00:00 2001 From: chris Date: Sun, 31 Jul 2022 06:49:02 -0700 Subject: [PATCH 4/6] remove typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index de18b7ca..5890808a 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ await esmock( { ...globalmocks }) // mock definitions imported everywhere ``` -_note: `esmock` is unable [unable to mock some modules.][20]_ `esmock` is improving in this area and if you encounter a module that isn't mocked, please report that and, if possible, submit a demonstration PR with a failing test case. [See the wiki][20] for more details. +_note: `esmock` is [unable to mock some export expressions.][20]_ `esmock` is improving in this area and if you encounter a module that isn't mocked, please report that and, if possible, submit a demonstration PR with a failing test case. [See the wiki][20] for more details. [20]: https://github.com/iambumblehead/esmock/wiki#problems-module-resolution From 437a6be11548c70ff9435a8608bba45d0f435556 Mon Sep 17 00:00:00 2001 From: chris Date: Sun, 31 Jul 2022 06:50:50 -0700 Subject: [PATCH 5/6] use smaller note in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5890808a..1af6af4e 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ await esmock( { ...globalmocks }) // mock definitions imported everywhere ``` -_note: `esmock` is [unable to mock some export expressions.][20]_ `esmock` is improving in this area and if you encounter a module that isn't mocked, please report that and, if possible, submit a demonstration PR with a failing test case. [See the wiki][20] for more details. +_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#problems-module-resolution From b8e560f30c23d8c73416467348d1a78a80dca13b Mon Sep 17 00:00:00 2001 From: chris Date: Sun, 31 Jul 2022 06:53:25 -0700 Subject: [PATCH 6/6] change link to wiki --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1af6af4e..3355e3ca 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ await esmock( _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#problems-module-resolution +[20]: https://github.com/iambumblehead/esmock/wiki#user-content-problems-module-resolution `esmock` examples