Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip][beta] doc updates & CI filtering fixes #701

Merged
merged 14 commits into from
Sep 12, 2018
Merged

[wip][beta] doc updates & CI filtering fixes #701

merged 14 commits into from
Sep 12, 2018

Conversation

kulshekhar
Copy link
Owner

No description provided.

@huafu huafu added this to the v23.10.0 milestone Sep 7, 2018
@huafu huafu changed the title Update versioning section [DOC] text updates & CI filtering fixes Sep 8, 2018
@huafu huafu changed the title [DOC] text updates & CI filtering fixes [beta] text updates & CI filtering fixes Sep 8, 2018
@huafu huafu changed the title [beta] text updates & CI filtering fixes [beta] doc updates & CI filtering fixes Sep 8, 2018
@huafu huafu changed the title [beta] doc updates & CI filtering fixes [wip][beta] doc updates & CI filtering fixes Sep 8, 2018

## Jest preset

### Basic usage

In most of the case, simply adding `preset: 'ts-jest'` to your Jest config should be enough starting using TypeScript with Jest (suposing you did add `ts-jest` to your dev. npm dependencies of course):
In most of the case, simply adding `preset: 'ts-jest'` to your Jest config should be enough starting using TypeScript with Jest (supposing you did add `ts-jest` to your dev. npm dependencies of course):
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In most cases, simply adding preset: 'ts-jest' to your Jest config should be enough to start using TypeScript with Jest (assuming you have added ts-jest to your dependencies of course):

@@ -50,10 +50,79 @@ module.exports = {
}
```

## Paths mapping

If you use ["baseUrl" asn "paths" options](https://www.typescriptlang.org/docs/handbook/module-resolution.html) in your `tsconfig` file, you should make sure the ["moduleNameMapper"](https://facebook.github.io/jest/docs/en/configuration.html#modulenamemapper-object-string-string) option in your Jest config is setup accordingly.
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"baseUrl" and "paths" options

@@ -2,7 +2,7 @@
title: Isolated Modules option
---

By default TSJest uses TypeScript compiler in the context of a project (yours), with full type-checking and features. But it can also be used to compile each file separatly, as an isolated module. That's what the `isolatedModules` option (which defaults to `false`) comes for.
By default TSJest uses TypeScript compiler in the context of a project (yours), with full type-checking and features. But it can also be used to compile each file separately, as an isolated module. That's what the `isolatedModules` option (which defaults to `false`) comes for.

You'll loose type-checking ability and some features such as `const enum`, but in the case you plan on using Jest with the cache disabled (`jest --no-cache`), your tests will then run much faster.
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loose -> lose

@@ -4,15 +4,15 @@ title: TypeScript Config option

The `tsConfig` option allows you to define the which `tsconfig` JSON file to use. An inline compiler options object can also be specified instead of the path to a file.

By default, TSJest will do like `tsc` and use the project's `tsconfig.json` file. If it cannot find one, it'l use defaults TypeScript compiler options (except `es5` is used as target instead of `es3`).
By default, TSJest will do like `tsc` and use the project's `tsconfig.json` file. If it cannot find one, it'll use defaults TypeScript compiler options (except `es5` is used as target instead of `es3`).
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TSJest will behave like tsc...

it'll use the default TypeScript ...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm...

By default, it'll use the default TypeScript

not too many "default"?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not really, one is for the 'situation' and one is for the compiler options so it seems ok


### Disabling/enabling

By default all diagnostic are enabled. This is the same as setting the `diagnostics` option to `true`. To disable all diagnostics, set `diagnostics` to `false` (you might experience slightly better performence as well, especially if you disabled Jest cache).
By default all diagnostic are enabled. This is the same as setting the `diagnostics` option to `true`. To disable all diagnostics, set `diagnostics` to `false` (you might experience slightly better performance as well, especially if you disabled Jest cache).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

diagnostic -> diagnostics


### Advanced configuration

The option's value can also accpet an object for more advanced configuration. Each config. key is optional:
The option's value can also accept an object for more advanced configuration. Each config. key is optional:

- **`pretty`**: Enables/disable colorful and pretty output of errors (default: _enabled_).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enables/disable -> Enables/disables

---
title: Configuration
---
TSJest configuration is done within Jest configuration object. This configuration can be in `package.json` under the `jest` property, or in its own `jest.config.js` file. The latter is preferred since it's a JavaScript file, but it depends on your needs and preference.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latter is preferred -> the 2nd option is preferred (it looks clearer).

@coveralls
Copy link

coveralls commented Sep 11, 2018

Coverage Status

Coverage remained the same at 79.57% when pulling 2ba8fcc on kulshekhar-patch-1 into 294497a on beta.

huafu and others added 3 commits September 11, 2018 17:05
@huafu huafu merged commit ac3a833 into beta Sep 12, 2018
@huafu huafu deleted the kulshekhar-patch-1 branch September 12, 2018 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants