diff --git a/tests/tests-workspaces/workspaces-ts/ts-b/index.ts b/tests/tests-workspaces/workspaces-ts/ts-b/index.ts index 103d63b0..426e23a3 100644 --- a/tests/tests-workspaces/workspaces-ts/ts-b/index.ts +++ b/tests/tests-workspaces/workspaces-ts/ts-b/index.ts @@ -1,5 +1,8 @@ import {foo} from 'ts-a' +import localfile from './local-file.js' export default function test () { return foo() } + +export const localfilewrap = () => localfile() diff --git a/tests/tests-workspaces/workspaces-ts/ts-b/local-file.ts b/tests/tests-workspaces/workspaces-ts/ts-b/local-file.ts new file mode 100644 index 00000000..6fd75c5f --- /dev/null +++ b/tests/tests-workspaces/workspaces-ts/ts-b/local-file.ts @@ -0,0 +1 @@ +export default () => 'local-value' diff --git a/tests/tests-workspaces/workspaces-ts/ts-b/test.ts b/tests/tests-workspaces/workspaces-ts/ts-b/test.ts index f0d6d3f0..6eb6f968 100644 --- a/tests/tests-workspaces/workspaces-ts/ts-b/test.ts +++ b/tests/tests-workspaces/workspaces-ts/ts-b/test.ts @@ -9,3 +9,11 @@ test('works ootb', async () => { assert.equal(sut(), 'bar') }) + +test('also mocks local file', async () => { + const { localfilewrap } = await esmock('./index.js', { + './local-file.js': () => 'local-value-mocked' + }) + + assert.equal(localfilewrap(), 'local-value-mocked') +})