Skip to content

Commit

Permalink
test: adds a test for resolveJsonModule in TS 2.9
Browse files Browse the repository at this point in the history
  • Loading branch information
huafu committed Jul 24, 2018
1 parent 76e27c1 commit 68f8cb3
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/__tests__/import-json.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import runJest from '../__helpers__/runJest';

describe('Import JSON with `resolveJsonModule`', () => {
it('should work as expected', () => {
const result = runJest('../import-json', ['--no-cache']);

expect(result.status).toBe(0);
});
});
1 change: 1 addition & 0 deletions tests/import-json/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
coverage
9 changes: 9 additions & 0 deletions tests/import-json/__tests__/pkg.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
declare var jest, describe, it, expect;

import pkg from '../pkg';

describe('pkg', () => {
it('should statically import package.json', () => {
expect(pkg).toEqual(require('../package.json'));
});
});
15 changes: 15 additions & 0 deletions tests/import-json/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"jest": {
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json"
]
}
}
3 changes: 3 additions & 0 deletions tests/import-json/pkg.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import * as pkg from './package';

export default pkg;
5 changes: 5 additions & 0 deletions tests/import-json/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"resolveJsonModule": true
}
}

0 comments on commit 68f8cb3

Please sign in to comment.