Skip to content

Commit

Permalink
Merge branch 'master' into catch-syntax-errors
Browse files Browse the repository at this point in the history
  • Loading branch information
GeeWee authored Jun 1, 2018
2 parents d8c0a3f + 0b98674 commit 73fbb63
Show file tree
Hide file tree
Showing 13 changed files with 223 additions and 231 deletions.
19 changes: 19 additions & 0 deletions collaborator-guidelines.md → COLLABORATORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

# Collaborator Guidelines

ts-jest is grateful for all issues, PRs and contributions. In this file are tips for getting started contributing,
and best practices, so that we can ensure that we can maintain this project in the future.

## Installing and building the project

To be able to install and build the project probably, `rimraf` is required. Install `rimraf` by running
Expand All @@ -36,3 +39,19 @@ After installing `rimraf`, `yarn` command can be run normally when installing de
ts-jest must match the major version of jest. Matching the minor version is preferred. Matching the version patch is not required.

When merging PRs which fix bugs, it is preferable to increment the version patch version so that the changes can be published to NPM.

## Tests

All new features or bugfixes should be accompanied with a new test, to ensure that the change works as intended, and to make sure we don't inadvertently break it in the future through refactring

If you are simply refactoring code, it is not needed to add a test.

### How to add tests
- Tests are added by creating a new file in tests/__tests__
- A test usually consists of two parts
- A directory under tests/ that have some files that should result in a specific output when jest is passed through it
- A file under tests/__tests__ that uses the runJest command to run Jest on the specified directory, and makes asserts on the output of stdout and stderr
When asserting things on the output, it is common to both assert something about the exit code, and something about the output. Always assert on the output first, before asserting on the status code - as it leads to much nicer error messages when refactoring. (You get the full output text, rather than just '0 didn't equal 1')

### How to run tests
Tests are run through `yarn test`
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@
]
},
"dependencies": {
"babel-core": "^6.26.3",
"babel-plugin-istanbul": "^4.1.6",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
"babel-preset-jest": "^23.0.0",
"cpx": "^1.5.0",
"fs-extra": "6.0.1",
Expand All @@ -74,7 +72,8 @@
"yargs": "^11.0.0"
},
"peerDependencies": {
"jest": "^22.4.0 || ^22.5.0-alpha.1 || ^23.0.0-alpha.1",
"babel-core": "^6.26.3 || ^7.0.0-0",
"jest": "^22.4.0 || ^23.0.0",
"typescript": "2.x"
},
"devDependencies": {
Expand All @@ -83,9 +82,10 @@
"@types/fs-extra": "5.0.2",
"@types/jest": "22.2.3",
"@types/lodash": "^4.14.109",
"@types/node": "10.1.2",
"@types/node": "10.1.3",
"@types/react": "16.3.14",
"@types/yargs": "^11.0.0",
"babel-core": "^6.26.3",
"babel-preset-env": "^1.7.0",
"cross-spawn": "latest",
"cross-spawn-with-kill": "latest",
Expand All @@ -97,7 +97,7 @@
"react": "16.4.0",
"react-test-renderer": "16.4.0",
"reflect-metadata": "^0.1.12",
"rimraf": "latest",
"rimraf": "^2.6.2",
"ts-jest": "22.4.6",
"tslint": "^5.10.0",
"typescript": "^2.8.3"
Expand Down
4 changes: 0 additions & 4 deletions src/postprocess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,6 @@ export const getPostProcessHook = (
const plugins = Array.from(
(tsJestConfig.babelConfig && tsJestConfig.babelConfig.plugins) || [],
);
// If we're not skipping babel
if (tsCompilerOptions.allowSyntheticDefaultImports) {
plugins.push('transform-es2015-modules-commonjs');
}

const babelOptions: BabelTransformOptions = {
...tsJestConfig.babelConfig,
Expand Down
5 changes: 0 additions & 5 deletions src/preprocessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ export function process(
filePath,
);

/*const modified =
tsJestConfig.disableSourceMapSupport === true
? outputText
: injectSourcemapHook(filePath, transpileOutput, outputText);
*/
flushLogs();

return { code: outputText.code, map: outputText.map };
Expand Down
4 changes: 2 additions & 2 deletions src/transpiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function transpileTypescript(
compilerOptions: ts.CompilerOptions,
): CodeSourceMapPair {
logOnce('Compiling via normal transpileModule call');
const transpileOutput = transpileViaTranspileModile(
const transpileOutput = transpileViaTranspileModule(
filePath,
fileSrc,
compilerOptions,
Expand All @@ -25,7 +25,7 @@ export function transpileTypescript(
/**
* This is faster, and considers the modules in isolation
*/
function transpileViaTranspileModile(
function transpileViaTranspileModule(
filePath: string,
fileSource: string,
compilerOptions: ts.CompilerOptions,
Expand Down
Loading

0 comments on commit 73fbb63

Please sign in to comment.