Skip to content

Commit

Permalink
update test to use esmock, to pass lint, to give credit
Browse files Browse the repository at this point in the history
  • Loading branch information
bumblehead committed Jul 16, 2024
1 parent 493997f commit 4c58d6c
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions tests/tests-swc/esmock.node-swc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import test from 'node:test'
import assert from 'assert'
import esmock from 'esmock'

// ⚠ https://github.com/swc-project/swc-node/issues/710
// swc tests fail when encountering typescript syntax
// when the typescript sytax are removed, tests pass

// credit @Brooooooklyn https://github.com/swc-project/swc-node/issues/788
test('should mock js when using swc', async () => {
const main = await esmock('../local/main.js', {
path: {
Expand All @@ -17,17 +14,11 @@ 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')
})

0 comments on commit 4c58d6c

Please sign in to comment.