Skip to content

Commit

Permalink
added note about tsx to README
Browse files Browse the repository at this point in the history
  • Loading branch information
bumblehead committed Jul 28, 2023
1 parent dbd475a commit f59f725
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

* 2.3.3 _Jul.27.2023_
* [do not error when processing node hashbang](https://github.com/iambumblehead/esmock/pull/217) scripts from @tommy-mitchell
* [add note explaining](https://github.com/iambumblehead/esmock/pull/211) why tsx [does not work](https://github.com/esbuild-kit/tsx/issues/264)
* 2.3.2 _Jul.22.2023_
* [restore ava unit-test](https://github.com/iambumblehead/esmock/pull/213) process at node20 test pipeline
* [investigate problems](https://github.com/iambumblehead/esmock/issues/209) using tsx from @tommy-mitchell
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"test-uvu": "NODE_OPTIONS=--loader=esmock uvu spec",
"test-tsm": "node --loader=tsm --loader=esmock --test *ts",
"test-ts": "node --loader=ts-node/esm --loader=esmock --test *ts",
"test-jest": "NODE_OPTIONS=--loader=esmock jest"
"test-jest": "NODE_OPTIONS=--loader=esmock jest",
"test-tsx": "⚠ https://github.com/esbuild-kit/tsx/issues/264"
},
"jest": {
"runner": "jest-light-runner"
Expand Down
20 changes: 11 additions & 9 deletions tests/tests-tsx/esmock.node.tsx.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ test('should mock js when using tsx', async () => {
assert.strictEqual(main.pathbasenamewrap(), 'hellow')
})

test('should mock ts when using tsx - unknown file extension', async () => {
const main = await esmock('../local/main.ts', {
path: {
basename: () => 'hellow'
}
})

assert.strictEqual(main.pathbasenamewrap(), 'hellow')
})
// tsx fails :/ https://github.com/esbuild-kit/tsx/issues/264
//
// test('should mock ts when using tsx - unknown file extension', async () => {
// const main = await esmock('../local/main.ts', {
// path: {
// basename: () => 'hellow'
// }
// })
//
// assert.strictEqual(main.pathbasenamewrap(), 'hellow')
// })
2 changes: 1 addition & 1 deletion tests/tests-tsx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"tsx": "^3.12.7"
},
"scripts": {
"test": "node --loader=tsx --loader=esmock --test esmock.ava.tsx.test.ts"
"test": "node --loader=tsx --loader=esmock --test esmock.node.tsx.test.ts"
}
}

0 comments on commit f59f725

Please sign in to comment.