tsup/test/graphql.test.ts
三咲智子 Kevin Deng e8c6079cdf
refactor: lint
eslint --fix by @sxzz/eslint-config

- add `node:` protocol
- sort imports
- ...
2024-07-17 23:46:22 +08:00

55 lines
1.2 KiB
TypeScript

import { expect, test } from 'vitest'
import { getTestName, run } from './utils'
test('bundle graphql-tools with --dts flag', async () => {
await run(
getTestName(),
{
'input.ts': `export { makeExecutableSchema } from 'graphql-tools'`,
},
{
flags: ['--dts'],
},
)
})
test('bundle graphql-tools with --dts-resolve flag', async () => {
await run(
getTestName(),
{
'input.ts': `export { makeExecutableSchema } from 'graphql-tools'`,
},
{
flags: ['--dts-resolve'],
},
)
})
test('bundle graphql-tools with --sourcemap flag', async () => {
const { outFiles } = await run(
getTestName(),
{
'input.ts': `export { makeExecutableSchema } from 'graphql-tools'`,
},
{
flags: ['--sourcemap'],
},
)
expect(outFiles).toEqual(['input.js', 'input.js.map'])
})
test('bundle graphql-tools with --sourcemap inline flag', async () => {
const { output, outFiles } = await run(
getTestName(),
{
'input.ts': `export { makeExecutableSchema } from 'graphql-tools'`,
},
{
flags: ['--sourcemap', 'inline'],
},
)
expect(output).toContain('//# sourceMappingURL=data:application/json;base64')
expect(outFiles).toEqual(['input.js'])
})