Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use Babel instead of ts-jest to speed up and simplify tests
Removed typechecking from jest tests (by removing ts-jest and just using Babel's TypeScript transpilation, per https://jestjs.io/docs/en/getting-started#using-typescript). This makes tests run faster (~2s vs. ~9s for a single test after making a change to a `.ts` file) and simplifies their build configuration (by removing an unnecessary tool, ts-jest, from our toolchain). You should instead rely on your editor (and CI) for typechecking. Babel is a good choice because it is the standard for transpilation, and tslint is being deprecated in favor of Babel + eslint (so we need to switch soon anyway to get the latest lint rules, such as those for React hooks).
- Loading branch information
Showing
7 changed files
with
60 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,30 @@ | ||
// @ts-check | ||
|
||
/** @type {import('@babel/core').TransformOptions} */ | ||
const config = { | ||
presets: [ | ||
[ | ||
'@babel/preset-env', | ||
{ | ||
modules: false, | ||
useBuiltIns: 'entry', | ||
corejs: 3, | ||
}, | ||
/** @type {import('@babel/core').ConfigFunction} */ | ||
module.exports = api => { | ||
const isTest = api.env('test') | ||
api.cache.forever() | ||
|
||
return { | ||
presets: [ | ||
[ | ||
'@babel/preset-env', | ||
{ | ||
// Node (used for testing) doesn't support modules, so compile to CommonJS for testing. | ||
modules: isTest ? 'commonjs' : false, | ||
useBuiltIns: 'entry', | ||
corejs: 3, | ||
}, | ||
], | ||
'@babel/preset-typescript', | ||
'@babel/preset-react', | ||
], | ||
'@babel/preset-typescript', | ||
'@babel/preset-react', | ||
], | ||
plugins: ['@babel/plugin-syntax-dynamic-import', 'babel-plugin-lodash'], | ||
} | ||
plugins: [ | ||
'@babel/plugin-syntax-dynamic-import', | ||
'babel-plugin-lodash', | ||
|
||
module.exports = config | ||
// Node 12 (released 2019 Apr 23) supports these natively, so we can remove this plugin soon. | ||
'@babel/plugin-proposal-class-properties', | ||
], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ Object { | |
} | ||
} | ||
> | ||
<Unknown | ||
<CompletionWidgetDropdown | ||
completionListOrError={ | ||
Object { | ||
"items": Array [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters