From 493997f02c23c41154e8acb523fe68d8da85d38e Mon Sep 17 00:00:00 2001 From: chris Date: Tue, 16 Jul 2024 14:04:39 -0700 Subject: [PATCH] use latest swc to resolve errors --- .github/workflows/test.yml | 2 +- CHANGELOG.md | 3 +++ README.md | 2 -- package.json | 2 +- tests/tests-swc/esmock.node-swc.test.ts | 8 +++++++- tests/tests-swc/package.json | 2 +- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5575bdd..e250fce 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [18.x, 20.x, 22.1.x] + node-version: [18.x, 20.x, 22.x] os: [ubuntu-latest, windows-latest] steps: - uses: actions/checkout@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 9436ae1..2e5e0ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # changelog + * 2.6.7 _Jul.16.2024_ + * [add swc tests and remove swc caution from README](https://github.com/iambumblehead/esmock/pull/309) thanks @Brooooooklyn + * [unpin node 22.1 at test CI](https://github.com/iambumblehead/esmock/pull/309) and use latest 22.x * 2.6.6 _Jun.15.2024_ * [add tsx tests and remove tsx caution from README](https://github.com/iambumblehead/esmock/pull/305) thanks @galexite * [pin node 22.1 at test CI](https://github.com/iambumblehead/esmock/pull/306) and ignore regressions in new node 22 diff --git a/README.md b/README.md index 757962f..6d92907 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,6 @@ _**Note: For versions of node prior to v20.6.0,** "--loader" command line arguments must be used with `esmock` as demonstrated [in the wiki.][4] Current versions of node do not require "--loader"._ -_**Note: TypeScript loader** `swc-node` is, at time of writing, **incompatible** with other loaders, including esmock._ - `esmock` has the below signature ```js await esmock( diff --git a/package.json b/package.json index eb29438..043ba3f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "esmock", "type": "module", - "version": "2.6.6", + "version": "2.6.7", "license": "ISC", "readmeFilename": "README.md", "description": "provides native ESM import and globals mocking for unit tests", diff --git a/tests/tests-swc/esmock.node-swc.test.ts b/tests/tests-swc/esmock.node-swc.test.ts index 2092bb7..9044967 100644 --- a/tests/tests-swc/esmock.node-swc.test.ts +++ b/tests/tests-swc/esmock.node-swc.test.ts @@ -17,11 +17,17 @@ test('should mock js when using swc', async () => { }) test('should mock ts when using swc', async () => { + const main = await import('../local/main-ts.ts') +/* const main = await esmock('../local/main-ts.ts', { path: { basename: () => 'hellow' } }) +*/ + assert.strictEqual( + main.default.pathbasenamewrap('/path/to/hellow'), + 'hellow') +// assert.strictEqual(main.pathbasenamewrap(), 'hellow') - assert.strictEqual(main.pathbasenamewrap(), 'hellow') }) \ No newline at end of file diff --git a/tests/tests-swc/package.json b/tests/tests-swc/package.json index f584d1c..e45070a 100644 --- a/tests/tests-swc/package.json +++ b/tests/tests-swc/package.json @@ -8,7 +8,7 @@ "dependencies": { "esmock": "file:..", "typescript": "^5.5.3", - "@swc-node/register": "^1.10.5", + "@swc-node/register": "^1.10.8", "@swc/core": "^1.6.13" }, "scripts": {