Skip to content

Commit

Permalink
feat: diagnostics, different compilers, ...
Browse files Browse the repository at this point in the history
  • Loading branch information
huafu committed Aug 18, 2018
1 parent 82d1ce9 commit f26ebf0
Show file tree
Hide file tree
Showing 51 changed files with 1,365 additions and 1,448 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ jspm_packages
tests/simple-long-path/long-src-path
# is linked to the temp dir of the os
e2e/__workdir_synlink__
# while refactoring...
old/

# binaries
*.tgz
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,7 @@ jspm_packages

# Optional REPL history
.node_repl_history
# while refactoring...
old/

*.tgz
9 changes: 5 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
module.exports = {
rootDir: '.',
transform: {
'\\.ts$': '<rootDir>/dist/index.js',
'\\.ts$': '<rootDir>/dist/index.js'
},
testMatch: ['<rootDir>/src/**/?(*.)+(spec|test).ts?(x)'],
collectCoverageFrom: [
'<rootDir>/src/**/*.ts',
'!<rootDir>/src/**/*.d.ts',
'!<rootDir>/src/**/*.spec.ts',
'!<rootDir>/src/**/*.test.ts',
'!<rootDir>/src/**/__*__/*',
'!<rootDir>/src/**/__*__/*'
],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
testEnvironment: 'node',
};
testEnvironment: 'node'
}
74 changes: 59 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,30 @@
"url": "https://github.com/kulshekhar/ts-jest/issues"
},
"homepage": "https://github.com/kulshekhar/ts-jest#readme",
"dependencies": {},
"dependencies": {
"arrify": "^1.0.1",
"buffer-from": "^1.1.1",
"fast-json-stable-stringify": "^2.0.0",
"json5": "^1.0.1",
"make-error": "^1.3.4",
"mkdirp": "^0.5.1",
"yn": "^2.0.0"
},
"peerDependencies": {
"babel-jest": ">=22.0.0 <24.0.0",
"jest": ">=22.0.0 <24.0.0",
"typescript": ">=2.7.0 <4.0.0"
},
"devDependencies": {
"@types/arrify": "^1.0.4",
"@types/babel__core": "^7.0.1",
"@types/buffer-from": "^1.1.0",
"@types/fs-extra": "5.0.4",
"@types/gist-package-json": "git+https://gist.github.com/5c1cc527fe6b5b7dba41fec7fe54bf6e.git",
"@types/jest": "^23.3.1",
"@types/json5": "0.0.29",
"@types/lodash.set": "^4.3.4",
"@types/mkdirp": "^0.5.2",
"@types/node": "^10.5.8",
"@types/semver": "^5.5.0",
"closest-file-data": "^0.1.4",
Expand Down
13 changes: 8 additions & 5 deletions src/__helpers__/fakers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TsJestGlobalOptions, BabelConfig, TsJestConfig } from '../types'
import { TsJestGlobalOptions, BabelConfig, TsJestConfig } from '../lib/types'
import { resolve } from 'path'
import { ImportReasons } from '../utils/messages'
import { ImportReasons } from '../lib/messages'

export function filePath(relPath: string): string {
return resolve(__dirname, '..', '..', relPath)
Expand Down Expand Up @@ -54,10 +54,13 @@ describe('hello', () => {

export function tsJestConfig(options?: Partial<TsJestConfig>): TsJestConfig {
return {
babelJest: undefined,
version: '0.0.0-mock0',
typeCheck: false,
compiler: 'typescript',
babelConfig: undefined,
tsConfig: undefined,
diagnostics: [],
stringifyContentPathRegex: undefined,
diagnostics: { ignoreCodes: [], pretty: false },
...options,
}
}
Expand Down Expand Up @@ -85,6 +88,6 @@ export function babelConfig<T extends BabelConfig>(options?: BabelConfig): T {
} as any
}

export function importReason(text: string = 'because'): ImportReasons {
export function importReason(text: string = '[[BECAUSE]]'): ImportReasons {
return text as any
}
2 changes: 1 addition & 1 deletion src/__helpers__/mock-there.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export default function mockThese(map: string[] | { [k: string]: () => any }) {
const isArray = Array.isArray(map)
const items: string[] = isArray ? (map as string[]) : Object.keys(map)
items.forEach(item => {
const val = isArray ? () => item : map[item]
const val = isArray ? () => item : (map as any)[item]
jest.doMock(item, val, { virtual: true })
})
}
21 changes: 0 additions & 21 deletions src/__mocks__/ts-program.ts

This file was deleted.

31 changes: 0 additions & 31 deletions src/__snapshots__/ts-jest-transformer.spec.ts.snap

This file was deleted.

39 changes: 0 additions & 39 deletions src/__snapshots__/ts-program.spec.ts.snap

This file was deleted.

4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import TsJestTransformer from './ts-jest-transformer'
import createJestPreset from './utils/create-jest-preset'
import { TsJestTransformer } from './lib/ts-jest-transformer'
import { createJestPreset } from './lib/create-jest-preset'

// TODO: allow a `TsJestGlobalOptions` object to be give to createTransformer()
// so that presets could totally customize and extend the transfomer;
Expand Down
Loading

0 comments on commit f26ebf0

Please sign in to comment.