Skip to content

Commit

Permalink
test: leverage testing-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Jun 9, 2024
1 parent ab30f6c commit 1cb3ef2
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions test/integration/tsconfig-override/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import * as fsp from 'fs/promises'
import { join } from 'path'
import { createIntegrationTest } from '../utils'
import { assertFilesContent, createIntegrationTest } from '../utils'

describe('integration tsconfig-override', () => {
it('should use es5 output in build without override', async () => {
Expand All @@ -9,12 +7,13 @@ describe('integration tsconfig-override', () => {
directory: __dirname,
},
async ({ dir }) => {
const content = await fsp.readFile(
join(dir, './dist/index.js'),
'utf-8',
)
expect(content).toContain('function A')
expect(content).not.toContain('class A')
assertFilesContent(dir, {
['./dist/index.js']: (content) => {
return (
content.includes('function A') && !content.includes('class A')
)
},
})
},
)
})
Expand All @@ -25,12 +24,13 @@ describe('integration tsconfig-override', () => {
args: ['--tsconfig', 'tsconfig.build.json'],
},
async ({ dir }) => {
const content = await fsp.readFile(
join(dir, './dist/index.js'),
'utf-8',
)
expect(content).not.toContain('function A')
expect(content).toContain('class A')
assertFilesContent(dir, {
['./dist/index.js']: (content) => {
return (
content.includes('class A') && !content.includes('function A')
)
},
})
},
)
})
Expand Down

0 comments on commit 1cb3ef2

Please sign in to comment.