diff --git a/AUTHORS b/AUTHORS index 2afb8dd6d0..af4691f0fe 100644 --- a/AUTHORS +++ b/AUTHORS @@ -30,6 +30,7 @@ Justin Bay Kulshekhar Kabra Kyle Roach Marshall Bowers +Martijn The Matheus Gambati Maxim Samoilov Mohammad Rajabifard diff --git a/README.md b/README.md index 4995a97e5a..13b2b0c3a0 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ Modify your project's `package.json` so that the `jest` section looks something { "jest": { "transform": { - "^.+\\.tsx?$": "/node_modules/ts-jest/preprocessor.js" + "^.+\\.tsx?$": "ts-jest" }, "testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$", "moduleFileExtensions": [ @@ -225,7 +225,7 @@ In `package.json`, inside `jest` section, the `transform` should be like this: ```json "transform": { "^.+\\.jsx?$": "/node_modules/babel-jest", - "^.+\\.tsx?$": "/node_modules/ts-jest/preprocessor.js" + "^.+\\.tsx?$": "ts-jest" } ``` @@ -236,7 +236,7 @@ Fully completed jest section should look like this: "preset": "react-native", "transform": { "^.+\\.jsx?$": "/node_modules/babel-jest", - "^.+\\.tsx?$": "/node_modules/ts-jest/preprocessor.js" + "^.+\\.tsx?$": "ts-jest" }, "testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$", "moduleFileExtensions": [ @@ -268,7 +268,7 @@ You'll also need to extend your `transform` regex with `html` extension: { "jest": { "transform": { - "^.+\\.(tsx?|html)$": "/node_modules/ts-jest/preprocessor.js" + "^.+\\.(tsx?|html)$": "ts-jest" } } } diff --git a/index.js b/index.js deleted file mode 100644 index b91eb3834e..0000000000 --- a/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./dist/index'); \ No newline at end of file diff --git a/package.json b/package.json index 8b3ec3eb56..0cfe33de56 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "ts-jest", - "version": "21.1.4", - "main": "index.js", - "types": "./dist/index.d.ts", + "version": "21.2.0", + "main": "preprocessor.js", + "types": "./dist/preprocessor.d.ts", "description": "A preprocessor with sourcemap support to help use Typescript with Jest", "scripts": { "build": "tsc -p .", @@ -78,7 +78,7 @@ "yargs": "^10.0.3" }, "peerDependencies": { - "jest": "^21.1.0 || ^21.1.0-alpha.1 || ^22.0.0-alpha.1", + "jest": "^21.1.0 || ^21.3.0-alpha.1 || ^22.0.0-alpha.1", "typescript": "2.x" }, "devDependencies": { diff --git a/src/index.ts b/src/install.ts similarity index 90% rename from src/index.ts rename to src/install.ts index cb243ee447..78921eb731 100644 --- a/src/index.ts +++ b/src/install.ts @@ -1,7 +1,6 @@ import * as sourceMapSupport from 'source-map-support'; import { defaultRetrieveFileHandler } from './default-retrieve-file-handler'; -export { transpileIfTypescript } from './transpile-if-ts'; export function install() { const options: sourceMapSupport.Options = {}; diff --git a/src/preprocessor.ts b/src/preprocessor.ts index c3a3f3d82f..f98b8f6f81 100644 --- a/src/preprocessor.ts +++ b/src/preprocessor.ts @@ -6,6 +6,8 @@ import { JestConfig, Path, TransformOptions } from './jest-types'; import { getPostProcessHook } from './postprocess'; import { getTSConfig, getTSJestConfig } from './utils'; +export { install } from './install'; + export function process( src: string, path: Path, diff --git a/tests/__tests__/transpile-if-ts.spec.ts b/tests/__tests__/transpile-if-ts.spec.ts index c19947d5c3..d55a015218 100644 --- a/tests/__tests__/transpile-if-ts.spec.ts +++ b/tests/__tests__/transpile-if-ts.spec.ts @@ -1,4 +1,4 @@ -import { transpileIfTypescript } from '../../src'; +import { transpileIfTypescript } from '../../src/transpile-if-ts'; describe('transpileIfTypescript', () => { it('should ignore anything non-TS', () => { diff --git a/tests/jestconfig-test/jest.json b/tests/jestconfig-test/jest.json index fa8c2a07ef..3041ff5c7b 100644 --- a/tests/jestconfig-test/jest.json +++ b/tests/jestconfig-test/jest.json @@ -1,7 +1,7 @@ { "rootDir": "./", "transform": { - "^.+\\.tsx?$": "/node_modules/ts-jest/preprocessor.js" + "^.+\\.tsx?$": "ts-jest" }, "mapCoverage": true, "testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",