Skip to content

Commit 4c58d6c

Browse files
committed
update test to use esmock, to pass lint, to give credit
1 parent 493997f commit 4c58d6c

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

tests/tests-swc/esmock.node-swc.test.ts

+2-11
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ import test from 'node:test'
22
import assert from 'assert'
33
import esmock from 'esmock'
44

5-
// ⚠ https://github.com/swc-project/swc-node/issues/710
6-
// swc tests fail when encountering typescript syntax
7-
// when the typescript sytax are removed, tests pass
8-
5+
// credit @Brooooooklyn https://github.com/swc-project/swc-node/issues/788
96
test('should mock js when using swc', async () => {
107
const main = await esmock('../local/main.js', {
118
path: {
@@ -17,17 +14,11 @@ test('should mock js when using swc', async () => {
1714
})
1815

1916
test('should mock ts when using swc', async () => {
20-
const main = await import('../local/main-ts.ts')
21-
/*
2217
const main = await esmock('../local/main-ts.ts', {
2318
path: {
2419
basename: () => 'hellow'
2520
}
2621
})
27-
*/
28-
assert.strictEqual(
29-
main.default.pathbasenamewrap('/path/to/hellow'),
30-
'hellow')
31-
// assert.strictEqual(main.pathbasenamewrap(), 'hellow')
3222

23+
assert.strictEqual(main.pathbasenamewrap(), 'hellow')
3324
})

0 commit comments

Comments
 (0)