Skip to content

Commit

Permalink
add additional test importing main-ts.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
bumblehead committed Jul 13, 2024
1 parent a0b7de1 commit 4fb6be8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
"dependencies": {
"babelGeneratedDoubleDefault": "file:./babelGeneratedDoubleDefault",
"typescript": "^5.5.3",
"@swc-node/register": "1.10.2",
"@swc-node/register": "1.10.5",
"@swc/core": "^1.6.13",
"esmock": "2.6.6",
"tsx": "^4.15.5"
},
"scripts": {
Expand Down
12 changes: 12 additions & 0 deletions test.swc.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
import assert from 'node:assert'
import test from 'node:test'
import esmock from 'esmock'

test('should import babelGeneratedDoubleDefault, cjs deep', async () => {
const esmmain1 = await import ('./src/esmmain1.js')

assert.ok('babelGeneratedDoubleDefaultResult' in esmmain1.default)
})

test('should import ts when using tsx', async () => {
// const main = await import ('./src/main-ts.ts')
const main = await esmock('./src/main-ts.ts', {
path: {
basename: () => 'hellow'
}
})

assert.strictEqual(main.pathbasenamewrap(), 'hellow')
})
11 changes: 11 additions & 0 deletions test.tsx.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
import assert from 'node:assert'
import test from 'node:test'
import esmock from 'esmock'

test('should import babelGeneratedDoubleDefault, cjs deep', async () => {
const esmmain1 = await import ('./src/esmmain1.js')

assert.ok('babelGeneratedDoubleDefaultResult' in esmmain1.default)
})

test('should import ts when using tsx', async () => {
const main = await esmock('./src/main-ts.ts', {
path: {
basename: () => 'hellow'
}
})

assert.strictEqual(main.pathbasenamewrap(), 'hellow')
})

0 comments on commit 4fb6be8

Please sign in to comment.