Skip to content

Commit

Permalink
chore: add runtime esm node test
Browse files Browse the repository at this point in the history
  • Loading branch information
kettanaito committed Apr 17, 2023
1 parent 2331179 commit e48f435
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/modules/esm-node.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,25 @@ console.log('msw/native:', await import.meta.resolve('msw/native'))
*/
})

it('runs ESM bundle in the ESM Node.js', async () => {
await fsMock.create({
'entry.mjs': `
import { rest } from 'msw'
import { setupServer } from 'msw/node'
const server = setupServer(
rest.get('/resource', () => new Response())
)
console.log(typeof server.listen)
`,
})

const runtimeStdio = await fsMock.exec('node ./entry.mjs')
expect(runtimeStdio.stderr).toBe('')
expect(runtimeStdio.stdout).toMatch(/function/m)
})

it('resolves exports in CJS Node.js', async () => {
await fsMock.create({
'index.cjs': `
Expand Down

0 comments on commit e48f435

Please sign in to comment.