Skip to content

Commit

Permalink
use latest swc to resolve errors
Browse files Browse the repository at this point in the history
  • Loading branch information
bumblehead committed Jul 16, 2024
1 parent 3dd8fad commit 493997f
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
8 changes: 7 additions & 1 deletion tests/tests-swc/esmock.node-swc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
2 changes: 1 addition & 1 deletion tests/tests-swc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit 493997f

Please sign in to comment.