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

chore(compiler): clean up codes and update docs for isolatedModules: false #1544

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
48 changes: 0 additions & 48 deletions appveyor.yml

This file was deleted.

48 changes: 0 additions & 48 deletions docs/user/config/compilerHost.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/user/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ All options have default values which should fit most of the projects. Click on
| [**`compiler`**][compiler] | [TypeScript module to use as compiler.][compiler] | `string` | `"typescript"` |
| [**`tsConfig`**][tsConfig] | [TypeScript compiler related configuration.][tsConfig] | `string`\|`object`\|`boolean` | _auto_ |
| [**`isolatedModules`**][isolatedModules] | [Disable type-checking][isolatedModules] | `boolean` | `false` |
| [**`compilerHost`**][compilerHost] | [Use TypeScript Compiler API][compilerHost] | `boolean` | `false` |
| [**`diagnostics`**][diagnostics] | [Diagnostics related configuration.][diagnostics] | `boolean`\|`object` | `true` |
| [**`babelConfig`**][babelConfig] | [Babel(Jest) related configuration.][babelConfig] | `boolean`\|`object` | _disabled_ |
| [**`stringifyContentPathRegex`**][stringifyContentPathRegex] | [Files which will become modules returning self content.][stringifyContentPathRegex] | `string`\|`RegExp` | _disabled_ |
Expand Down
15 changes: 15 additions & 0 deletions docs/user/config/isolatedModules.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ You'll lose type-checking ability and some features such as `const enum`, but in

Here is how to disable type-checking and compile each file as an isolated module:

## Performance

Using `isolatedModules: false` (default) might impact the performance of your tests. To solve this, there are 2 ways:
- Either use `isolatedModules: true` (see disadvantages above)
- Or use `isolatedModules: false` and check your `tsconfig.json` which `ts-jest` uses. Make sure that your test `tsconfig` only includes the files which are needed
for your test environment. These necessary files can **ONLY** be:
- Your global modules imported via namespaces
- Polyfills
- Other test environment files

When creating `LanguageService` instance, `LanguageServiceHost` takes all the files declared by the combination of `files`,
`includes` and `excludes` which are provided via your test `tsconfig`. If `tsconfig` includes all the files in a project,
this will make internal `TypeScript` take lots of time because `TypeScript` is busy with reading files which creates
lots of unnecessary I/O threads before it actually creates the instance which will impact to the performance.

### Example

<div class="row"><div class="col-md-6" markdown="block">
Expand Down
1 change: 0 additions & 1 deletion e2e/__helpers__/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ export enum PackageSets {
}
export const allValidPackageSets = [PackageSets.default, PackageSets.babel7, PackageSets.babel7StringConfig]
export const allPackageSetsWithPreset = [PackageSets.default, PackageSets.babel7, PackageSets.babel7StringConfig]
export const allPackageSetsWithProgram = [PackageSets.default, PackageSets.babel7, PackageSets.babel7StringConfig]