From ecefd8d76a9808c2a38fb3db25081ddf237d7dc3 Mon Sep 17 00:00:00 2001 From: chris Date: Tue, 12 Sep 2023 20:13:17 -0700 Subject: [PATCH] rename main.ts to main-ts.ts, so that resolver does not return main.js --- tests/local/main.ts | 7 ------- tests/tests-FAIL-swc/esmock.node-swc.test.ts | 4 ++-- tests/tests-FAIL-tsx/esmock.node.tsx.test.ts | 2 +- tests/tests-nodets/esmock.node-ts.test.ts | 3 +-- tests/tests-tsm/esmock.node-tsm.test.ts | 4 ++-- 5 files changed, 6 insertions(+), 14 deletions(-) delete mode 100644 tests/local/main.ts diff --git a/tests/local/main.ts b/tests/local/main.ts deleted file mode 100644 index aeb80a38..00000000 --- a/tests/local/main.ts +++ /dev/null @@ -1,7 +0,0 @@ -import path from 'path' -import pg from 'pg' - -export default { - pathbasenamewrap: (n: any) => path.basename(n), - pgpoolwrap: (n: any) => pg.Pool(n) -} diff --git a/tests/tests-FAIL-swc/esmock.node-swc.test.ts b/tests/tests-FAIL-swc/esmock.node-swc.test.ts index 0248852f..9b739f08 100644 --- a/tests/tests-FAIL-swc/esmock.node-swc.test.ts +++ b/tests/tests-FAIL-swc/esmock.node-swc.test.ts @@ -7,7 +7,7 @@ import esmock from 'esmock' // when the typescript sytax are removed, tests pass test('should mock ts when using node-ts', async () => { - const main = await esmock('../local/main.ts', { + const main = await esmock('../local/main-ts.ts', { path: { basename: () => 'hellow' } @@ -17,7 +17,7 @@ test('should mock ts when using node-ts', async () => { }) test('should mock pg', async () => { - const main = await esmock('../local/main.ts', { + const main = await esmock('../local/main-ts.ts', { 'pg': { Pool: (config:any) => { return config || 'mocked pool' diff --git a/tests/tests-FAIL-tsx/esmock.node.tsx.test.ts b/tests/tests-FAIL-tsx/esmock.node.tsx.test.ts index 3211030f..ac032abd 100644 --- a/tests/tests-FAIL-tsx/esmock.node.tsx.test.ts +++ b/tests/tests-FAIL-tsx/esmock.node.tsx.test.ts @@ -15,7 +15,7 @@ test('should mock js when using tsx', async () => { // 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', { +// const main = await esmock('../local/main-ts.ts', { // path: { // basename: () => 'hellow' // } diff --git a/tests/tests-nodets/esmock.node-ts.test.ts b/tests/tests-nodets/esmock.node-ts.test.ts index cca5049b..45571d3c 100644 --- a/tests/tests-nodets/esmock.node-ts.test.ts +++ b/tests/tests-nodets/esmock.node-ts.test.ts @@ -3,7 +3,7 @@ import assert from 'assert' import esmock from 'esmock' test('should mock ts when using node-ts', { only: true }, async () => { - const main = await esmock('../local/main.ts', { + const main = await esmock('../local/main-ts.ts', { path: { basename: () => 'hellow' } @@ -26,4 +26,3 @@ test('should mock import global at import tree w/ mixed esm cjs', async () => { assert.equal(consolelog.mock.calls[0].arguments[0], 'foo') assert.equal(consolelog.mock.calls[1].arguments[0], 'foo') }) - diff --git a/tests/tests-tsm/esmock.node-tsm.test.ts b/tests/tests-tsm/esmock.node-tsm.test.ts index 9c8085d9..5d591ba2 100644 --- a/tests/tests-tsm/esmock.node-tsm.test.ts +++ b/tests/tests-tsm/esmock.node-tsm.test.ts @@ -3,7 +3,7 @@ import assert from 'assert' import esmock from 'esmock' test('should mock ts when using node-ts', async () => { - const main = await esmock('../local/main.ts', { + const main = await esmock('../local/main-ts.ts', { path: { basename: () => 'hellow' } @@ -14,7 +14,7 @@ test('should mock ts when using node-ts', async () => { }) test('should mock pg', async () => { - const main = await esmock('../local/main.ts', { + const main = await esmock('../local/main-ts.ts', { 'pg': { Pool: (config:any) => { return config || 'mocked pool'