Skip to content

Commit

Permalink
Merge pull request #211 from iambumblehead/resolve-tsx-failing-test
Browse files Browse the repository at this point in the history
try resolve tsx failing test
  • Loading branch information
iambumblehead authored Jul 28, 2023
2 parents a9ac615 + f7019cd commit b712b10
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 63 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# changelog

* 2.3.3 _Jul.27.2023_
* 2.3.3 _Jul.28.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)
* [pin node 18.16.x](https://github.com/iambumblehead/esmock/pull/217) to ci test matrix, re node [!48948](https://github.com/nodejs/node/issues/48948)
* 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
32 changes: 0 additions & 32 deletions tests/tests-ava-tsx/esmock.ava.tsx.test.ts

This file was deleted.

29 changes: 0 additions & 29 deletions tests/tests-ava-tsx/package.json

This file was deleted.

25 changes: 25 additions & 0 deletions tests/tests-tsx/esmock.node.tsx.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import test from 'node:test'
import assert from 'assert'
import esmock from 'esmock'

test('should mock js when using tsx', async () => {
const main = await esmock('../local/main.js', {
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')
// })
15 changes: 15 additions & 0 deletions tests/tests-tsx/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"type": "module",
"description": "esmock unit tests, tsx with node",
"repository": {
"type": "git",
"url": "https://github.com/iambumblehead/esmock.git"
},
"dependencies": {
"esmock": "file:..",
"tsx": "^3.12.7"
},
"scripts": {
"test": "node --loader=tsx --loader=esmock --test esmock.node.tsx.test.ts"
}
}
File renamed without changes.

0 comments on commit b712b10

Please sign in to comment.