Skip to content
This repository was archived by the owner on Jan 31, 2023. It is now read-only.

Commit 136dfd5

Browse files
committed
Test .tsx file.
1 parent d02daf5 commit 136dfd5

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

test/e2e/e2e_spec.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('browserify preprocessor - e2e', function () {
3434
})
3535

3636
describe('typescript', function () {
37-
it('handles typescript when the path is given', function () {
37+
it('handles .ts file when the path is given', function () {
3838
return bundle('math_spec.ts', {
3939
typescript: require.resolve('typescript'),
4040
}).then((output) => {
@@ -43,9 +43,22 @@ describe('typescript', function () {
4343
})
4444
})
4545

46-
it('cannot handle typescript when the path is not given', function () {
46+
it('handles .tsx file when the path is given', function () {
47+
return bundle('math_spec.ts', {
48+
typescript: require.resolve('typescript'),
49+
}).then((output) => {
50+
// check that bundled tests work
51+
eval(output)
52+
})
53+
})
54+
55+
it('cannot handle .ts file when the path is not given', function () {
4756
expect(() => bundle('math_spec.ts')).to.throw
4857
})
58+
59+
it('cannot handle .tsx file when the path is not given', function () {
60+
expect(() => bundle('math_spec.tsx')).to.throw
61+
})
4962
})
5063

5164
describe('imports and exports', () => {

test/fixtures/math_spec.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import math from './math'
2+
3+
interface Props {
4+
greeting: string
5+
}
6+
7+
export const Foo = ({ greeting }: Props) => {
8+
return <div>{greeting}{math.add(1, 2)}</div>
9+
}

0 commit comments

Comments
 (0)