mirror of
https://github.com/cachix/install-nix-action.git
synced 2025-06-08 09:54:28 +00:00
v6
This commit is contained in:
parent
cd5893b2c6
commit
70742d22d9
6774 changed files with 1602535 additions and 1 deletions
1
node_modules/ts-jest/.ts-jest-digest
generated
vendored
Normal file
1
node_modules/ts-jest/.ts-jest-digest
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
7145adc485d1d0fa5bc7b6467bd416798f0a9a49
|
488
node_modules/ts-jest/CHANGELOG.md
generated
vendored
Normal file
488
node_modules/ts-jest/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,488 @@
|
|||
<a name="24.1.0"></a>
|
||||
# [24.1.0](https://github.com/kulshekhar/ts-jest/compare/v24.0.2...v24.1.0) (2019-09-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* [#825](https://github.com/kulshekhar/ts-jest/issues/825) handle symlinked modules (ala pnpm) correctly ([e190b23](https://github.com/kulshekhar/ts-jest/commit/e190b23))
|
||||
* handle tsBuildInfoFile option ([f9583e9](https://github.com/kulshekhar/ts-jest/commit/f9583e9)), closes [#1095](https://github.com/kulshekhar/ts-jest/issues/1095)
|
||||
* **perf:** add cache for fs calls ([#908](https://github.com/kulshekhar/ts-jest/issues/908)) ([3dada81](https://github.com/kulshekhar/ts-jest/commit/3dada81))
|
||||
* **types:** unforce esModuleInterop in tsconfig.json ([c2d39b6](https://github.com/kulshekhar/ts-jest/commit/c2d39b6))
|
||||
|
||||
|
||||
|
||||
<a name="24.0.2"></a>
|
||||
## [24.0.2](https://github.com/kulshekhar/ts-jest/compare/v24.0.1...v24.0.2) (2019-04-05)
|
||||
|
||||
|
||||
|
||||
<a name="24.0.1"></a>
|
||||
## [24.0.1](https://github.com/kulshekhar/ts-jest/compare/v24.0.0...v24.0.1) (2019-03-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* update call to globIgnore ([#1002](https://github.com/kulshekhar/ts-jest/issues/1002)) ([#1003](https://github.com/kulshekhar/ts-jest/issues/1003)) ([05b63af](https://github.com/kulshekhar/ts-jest/commit/05b63af))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **config:** specify package.json location ([#823](https://github.com/kulshekhar/ts-jest/issues/823)) ([#1013](https://github.com/kulshekhar/ts-jest/issues/1013)) ([fb7dd55](https://github.com/kulshekhar/ts-jest/commit/fb7dd55))
|
||||
|
||||
|
||||
|
||||
<a name="24.0.0"></a>
|
||||
# [24.0.0](https://github.com/kulshekhar/ts-jest/compare/v23.10.5...v24.0.0) (2019-02-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* cli test ([1d67101](https://github.com/kulshekhar/ts-jest/commit/1d67101))
|
||||
* module tests and some snapshots ([999f889](https://github.com/kulshekhar/ts-jest/commit/999f889))
|
||||
* remove unused snapshots ([108b08b](https://github.com/kulshekhar/ts-jest/commit/108b08b))
|
||||
* some tests ([d0f2231](https://github.com/kulshekhar/ts-jest/commit/d0f2231))
|
||||
* test command ([8372b5e](https://github.com/kulshekhar/ts-jest/commit/8372b5e))
|
||||
* test path for windows (attempt 1) ([6824ac4](https://github.com/kulshekhar/ts-jest/commit/6824ac4))
|
||||
* test path for windows (attempt 2) ([eb2fc8a](https://github.com/kulshekhar/ts-jest/commit/eb2fc8a))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **jest:** bump to 24 ([defcb77](https://github.com/kulshekhar/ts-jest/commit/defcb77))
|
||||
|
||||
|
||||
|
||||
<a name="23.10.4"></a>
|
||||
## [23.10.4](https://github.com/kulshekhar/ts-jest/compare/v23.10.3...v23.10.4) (2018-10-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **cache:** adds project's dep versions to cache key ([6cacbea](https://github.com/kulshekhar/ts-jest/commit/6cacbea)), closes [#785](https://github.com/kulshekhar/ts-jest/issues/785)
|
||||
* **cli:** change options to better reflect the new presets ([68abcfb](https://github.com/kulshekhar/ts-jest/commit/68abcfb))
|
||||
* **helpers:** deprecate import from ts-jest, now ts-jest/utils ([33ff29f](https://github.com/kulshekhar/ts-jest/commit/33ff29f)), closes [#782](https://github.com/kulshekhar/ts-jest/issues/782)
|
||||
* **typings:** typo in presets definition file ([53767ab](https://github.com/kulshekhar/ts-jest/commit/53767ab))
|
||||
* **typings:** wrong import in preset typings + test ([94dc4e7](https://github.com/kulshekhar/ts-jest/commit/94dc4e7))
|
||||
|
||||
|
||||
|
||||
<a name="23.10.3"></a>
|
||||
## [23.10.3](https://github.com/kulshekhar/ts-jest/compare/v23.10.2...v23.10.3) (2018-09-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **compiler:** do not force module kind if piping babel ([acebc8c](https://github.com/kulshekhar/ts-jest/commit/acebc8c)), closes [#767](https://github.com/kulshekhar/ts-jest/issues/767)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **helpers:** adds a mocked test helper for mock typings ([f976135](https://github.com/kulshekhar/ts-jest/commit/f976135)), closes [#576](https://github.com/kulshekhar/ts-jest/issues/576)
|
||||
|
||||
|
||||
|
||||
<a name="23.10.2"></a>
|
||||
## [23.10.2](https://github.com/kulshekhar/ts-jest/compare/v23.10.1...v23.10.2) (2018-09-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **cache:** resolved tsconfig in cache key + pkg digest ([e891608](https://github.com/kulshekhar/ts-jest/commit/e891608)), closes [#749](https://github.com/kulshekhar/ts-jest/issues/749)
|
||||
* **cli:** resets testMatch if using testRegex option ([31ad0aa](https://github.com/kulshekhar/ts-jest/commit/31ad0aa)), closes [#756](https://github.com/kulshekhar/ts-jest/issues/756)
|
||||
* **diagnostics:** throws only for category warning and error ([bb28849](https://github.com/kulshekhar/ts-jest/commit/bb28849)), closes [#748](https://github.com/kulshekhar/ts-jest/issues/748)
|
||||
* **import:** wrong error message when a module exists but fails ([e0d6c57](https://github.com/kulshekhar/ts-jest/commit/e0d6c57))
|
||||
* **preset:** createJestPreset fails with base and no array ([3c325e8](https://github.com/kulshekhar/ts-jest/commit/3c325e8))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **cli:** CLI 'config:migrate' now detects best preset ([febd8d3](https://github.com/kulshekhar/ts-jest/commit/febd8d3))
|
||||
* **preset:** adds 2 presets along the default one ([9f3d759](https://github.com/kulshekhar/ts-jest/commit/9f3d759))
|
||||
* **preset:** adds presets typings and export all presets ([f55d895](https://github.com/kulshekhar/ts-jest/commit/f55d895))
|
||||
* **typings:** emit declaration files, filtering out internals ([4f10f7e](https://github.com/kulshekhar/ts-jest/commit/4f10f7e)), closes [#745](https://github.com/kulshekhar/ts-jest/issues/745)
|
||||
|
||||
|
||||
|
||||
<a name="23.10.1"></a>
|
||||
## [23.10.1](https://github.com/kulshekhar/ts-jest/compare/v23.10.0...v23.10.1) (2018-09-20)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **compile:** js files were never transpiled thru TS ([374dca1](https://github.com/kulshekhar/ts-jest/commit/374dca1)), closes [#740](https://github.com/kulshekhar/ts-jest/issues/740)
|
||||
* **config:** warn instead of forcing ESM interoperability ([a2a4be2](https://github.com/kulshekhar/ts-jest/commit/a2a4be2))
|
||||
* **windows:** normalize paths ([c12dfff](https://github.com/kulshekhar/ts-jest/commit/c12dfff))
|
||||
|
||||
|
||||
|
||||
<a name="23.10.0"></a>
|
||||
# [23.10.0](https://github.com/kulshekhar/ts-jest/compare/v23.10.0-beta.6...v23.10.0) (2018-09-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **babel:** fixes the babel 6 hack ([c8d51cf](https://github.com/kulshekhar/ts-jest/commit/c8d51cf))
|
||||
* **config:** jsx should also be considered as js files ([6c32a93](https://github.com/kulshekhar/ts-jest/commit/6c32a93))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **hints:** warns if transform matches js without allowJs ([952cc87](https://github.com/kulshekhar/ts-jest/commit/952cc87))
|
||||
|
||||
|
||||
|
||||
<a name="23.10.0-beta.6"></a>
|
||||
# [23.10.0-beta.6](https://github.com/kulshekhar/ts-jest/compare/v23.10.0-beta.5...v23.10.0-beta.6) (2018-09-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **babel:** instrumentation was done twice when using babel ([659a7fb](https://github.com/kulshekhar/ts-jest/commit/659a7fb)), closes [#713](https://github.com/kulshekhar/ts-jest/issues/713)
|
||||
* **cache:** includes all parameters in cache key computing ([70e1867](https://github.com/kulshekhar/ts-jest/commit/70e1867))
|
||||
* **e2e:** fixes the eval tool (not used yet) ([939d13a](https://github.com/kulshekhar/ts-jest/commit/939d13a))
|
||||
|
||||
|
||||
|
||||
<a name="23.10.0-beta.5"></a>
|
||||
# [23.10.0-beta.5](https://github.com/kulshekhar/ts-jest/compare/v23.10.0-beta.4...v23.10.0-beta.5) (2018-09-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **package:** fixes the outdated package-lock ([c5a5b7a](https://github.com/kulshekhar/ts-jest/commit/c5a5b7a))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **diagnostics:** add option to enable/disable first-TS-error-throws ([2c840c2](https://github.com/kulshekhar/ts-jest/commit/2c840c2))
|
||||
|
||||
|
||||
|
||||
<a name="23.10.0-beta.4"></a>
|
||||
# [23.10.0-beta.4](https://github.com/kulshekhar/ts-jest/compare/v23.10.0-beta.3...v23.10.0-beta.4) (2018-09-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **config:** fixes a bug in the tsconfig file resolver ([3910f2c](https://github.com/kulshekhar/ts-jest/commit/3910f2c))
|
||||
|
||||
|
||||
|
||||
<a name="23.10.0-beta.3"></a>
|
||||
# [23.10.0-beta.3](https://github.com/kulshekhar/ts-jest/compare/v23.10.0-beta.2...v23.10.0-beta.3) (2018-09-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **config:** fixes a bug in path resolver ([ceb0424](https://github.com/kulshekhar/ts-jest/commit/ceb0424))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **cli:** adds a cli tool to migrate old config ([714f5f0](https://github.com/kulshekhar/ts-jest/commit/714f5f0))
|
||||
* **cli:** ads a simple config:init helper + tests ([6700522](https://github.com/kulshekhar/ts-jest/commit/6700522))
|
||||
* **config:** exposes custom transformers to config for presets ([885bc44](https://github.com/kulshekhar/ts-jest/commit/885bc44))
|
||||
* **logger:** adds ts-jest version in the logger's context ([bb0c06e](https://github.com/kulshekhar/ts-jest/commit/bb0c06e))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* **bundle:** improves bundle size ([34eedc3](https://github.com/kulshekhar/ts-jest/commit/34eedc3))
|
||||
|
||||
|
||||
|
||||
<a name="23.10.0-beta.2"></a>
|
||||
# [23.10.0-beta.2](https://github.com/kulshekhar/ts-jest/compare/v23.10.0-beta.1...v23.10.0-beta.2) (2018-09-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **caching:** fixes a possible cache collision ([9c38694](https://github.com/kulshekhar/ts-jest/commit/9c38694))
|
||||
* **testing:** change logging level for some utility ([16f125a](https://github.com/kulshekhar/ts-jest/commit/16f125a))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **config:** typeCheck default to true (langauge service) ([623b2f4](https://github.com/kulshekhar/ts-jest/commit/623b2f4))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* **config:** Language service will be used by default from now on
|
||||
|
||||
|
||||
|
||||
<a name="23.10.0-beta.1"></a>
|
||||
# [23.10.0-beta.1](https://github.com/kulshekhar/ts-jest/compare/v23.1.4...v23.10.0-beta.1) (2018-09-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* typos + node 6 compat ([0ed1587](https://github.com/kulshekhar/ts-jest/commit/0ed1587))
|
||||
* **ci:** can't use runInBand for e2e: cache collision ([db650f4](https://github.com/kulshekhar/ts-jest/commit/db650f4))
|
||||
* jest 22 did not have default config ([cbaddc3](https://github.com/kulshekhar/ts-jest/commit/cbaddc3))
|
||||
* **ci:** do not run e2e sub-tests in band ([18ad865](https://github.com/kulshekhar/ts-jest/commit/18ad865))
|
||||
* **ci:** ensure npm is present with ci ([edb6eda](https://github.com/kulshekhar/ts-jest/commit/edb6eda))
|
||||
* **logger:** removes cyclic imports ([5ef980f](https://github.com/kulshekhar/ts-jest/commit/5ef980f))
|
||||
* babel-config + adds test ([12146c3](https://github.com/kulshekhar/ts-jest/commit/12146c3))
|
||||
* **tests:** CI fixes ([34a41ea](https://github.com/kulshekhar/ts-jest/commit/34a41ea))
|
||||
* fixes js style to be node < 10 compatible ([83d7517](https://github.com/kulshekhar/ts-jest/commit/83d7517))
|
||||
* hoisting per level + memoize fix ([31847b0](https://github.com/kulshekhar/ts-jest/commit/31847b0))
|
||||
* makes node6 happy ([f170285](https://github.com/kulshekhar/ts-jest/commit/f170285))
|
||||
* node 6 unhappy again... ([703ad0b](https://github.com/kulshekhar/ts-jest/commit/703ad0b))
|
||||
* normalizes bundle hash on any node version ([ce7afaf](https://github.com/kulshekhar/ts-jest/commit/ce7afaf))
|
||||
* source maps ([89a30c9](https://github.com/kulshekhar/ts-jest/commit/89a30c9))
|
||||
* updates templates ([f2e1da2](https://github.com/kulshekhar/ts-jest/commit/f2e1da2))
|
||||
* uses cross-platform spawn + fix pkg versions ([ac1599c](https://github.com/kulshekhar/ts-jest/commit/ac1599c))
|
||||
* we are not writing files, use normalized EOL ([47fff43](https://github.com/kulshekhar/ts-jest/commit/47fff43))
|
||||
* **tests:** detect npm version to use or not ci ([683a1e5](https://github.com/kulshekhar/ts-jest/commit/683a1e5))
|
||||
* **tests:** do not use babel in our tests + new API for simple ([3e4de3e](https://github.com/kulshekhar/ts-jest/commit/3e4de3e))
|
||||
* **tests:** more sanitizing for windows compat ([faae274](https://github.com/kulshekhar/ts-jest/commit/faae274))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* diagnostics, different compilers, ... ([f26ebf0](https://github.com/kulshekhar/ts-jest/commit/f26ebf0))
|
||||
* **config:** adds a helper to build moduleNameMapper from paths ([7b8598e](https://github.com/kulshekhar/ts-jest/commit/7b8598e)), closes [#364](https://github.com/kulshekhar/ts-jest/issues/364)
|
||||
* **logging:** improves log messages + tests ([5d03c4d](https://github.com/kulshekhar/ts-jest/commit/5d03c4d))
|
||||
* jest preset ([beb50b5](https://github.com/kulshekhar/ts-jest/commit/beb50b5))
|
||||
* **test:** jest serializers ([dfa9c0f](https://github.com/kulshekhar/ts-jest/commit/dfa9c0f))
|
||||
* adds logging + better hashing ([4322701](https://github.com/kulshekhar/ts-jest/commit/4322701))
|
||||
* **tests:** more test tools + adds test related to debuggin issues ([8dcafca](https://github.com/kulshekhar/ts-jest/commit/8dcafca))
|
||||
* allow env var to add diagnostic codes to ignore ([777edf5](https://github.com/kulshekhar/ts-jest/commit/777edf5))
|
||||
* cache key + tests ([bd55448](https://github.com/kulshekhar/ts-jest/commit/bd55448))
|
||||
* directly writes to stdio so jest does not swallow ([6a7f01f](https://github.com/kulshekhar/ts-jest/commit/6a7f01f))
|
||||
* handles stringifyContentPathRegex ([3fcb4bd](https://github.com/kulshekhar/ts-jest/commit/3fcb4bd))
|
||||
* hoisting + tests + many other things ([6186e84](https://github.com/kulshekhar/ts-jest/commit/6186e84))
|
||||
* io serializer + other test utils ([d03e0e7](https://github.com/kulshekhar/ts-jest/commit/d03e0e7))
|
||||
* warn about unsupported versions ([1103071](https://github.com/kulshekhar/ts-jest/commit/1103071))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* detects changes in templates and bundle ([2a3da21](https://github.com/kulshekhar/ts-jest/commit/2a3da21))
|
||||
* **babel:** uses babel-jest cache key as part of ours ([f51c4a7](https://github.com/kulshekhar/ts-jest/commit/f51c4a7))
|
||||
* do not type check if fileName doesn't match ([cc45adc](https://github.com/kulshekhar/ts-jest/commit/cc45adc))
|
||||
* faster tests ([37a0187](https://github.com/kulshekhar/ts-jest/commit/37a0187))
|
||||
* more cleaning ([c48f7b8](https://github.com/kulshekhar/ts-jest/commit/c48f7b8))
|
||||
* trying to improve travis-ci conf ([e4b4d95](https://github.com/kulshekhar/ts-jest/commit/e4b4d95))
|
||||
* **cache:** share config-sets for parallel test running ([090ca7b](https://github.com/kulshekhar/ts-jest/commit/090ca7b))
|
||||
* **tests:** run e2e tests in band ([b3e94ff](https://github.com/kulshekhar/ts-jest/commit/b3e94ff))
|
||||
|
||||
|
||||
|
||||
<a name="23.1.3"></a>
|
||||
## [23.1.3](https://github.com/kulshekhar/ts-jest/compare/v23.1.2...v23.1.3) (2018-08-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **html:** correctly transforms html source when needed ([9a2d74f](https://github.com/kulshekhar/ts-jest/commit/9a2d74f))
|
||||
* **lint:** fixes tslint script & lint issues ([60ab36e](https://github.com/kulshekhar/ts-jest/commit/60ab36e))
|
||||
* **package:** update fs-extra to version 6.0.1 ([7e73536](https://github.com/kulshekhar/ts-jest/commit/7e73536))
|
||||
* **package:** update pkg-dir to version 3.0.0 ([3fb8f9f](https://github.com/kulshekhar/ts-jest/commit/3fb8f9f))
|
||||
* **package:** update yargs to version 12.0.1 ([390ffcd](https://github.com/kulshekhar/ts-jest/commit/390ffcd))
|
||||
* **source-maps:** fix source maps options/calls ([76e27c1](https://github.com/kulshekhar/ts-jest/commit/76e27c1))
|
||||
* allow (but deprecate) use of old preprocessor.js ([a65079f](https://github.com/kulshekhar/ts-jest/commit/a65079f))
|
||||
* big refactor + fixes (mainly cache key + coverage) ([e46caae](https://github.com/kulshekhar/ts-jest/commit/e46caae))
|
||||
* fixes coverage and tests ([09500c2](https://github.com/kulshekhar/ts-jest/commit/09500c2))
|
||||
* gracefully load [@babel](https://github.com/babel)/core or babel-core ([98b2410](https://github.com/kulshekhar/ts-jest/commit/98b2410))
|
||||
* hack for babel < 6 so that breakpoints do work ([90c74ef](https://github.com/kulshekhar/ts-jest/commit/90c74ef)), closes [#627](https://github.com/kulshekhar/ts-jest/issues/627)
|
||||
* makes node 6 happy ([f6f82b8](https://github.com/kulshekhar/ts-jest/commit/f6f82b8))
|
||||
* makes window happy ([36fbebe](https://github.com/kulshekhar/ts-jest/commit/36fbebe))
|
||||
* npm coming with node 6 doesn't talk `ci` ([b87198d](https://github.com/kulshekhar/ts-jest/commit/b87198d))
|
||||
* resolves correctly config file path (fix [#636](https://github.com/kulshekhar/ts-jest/issues/636)) ([5ab100c](https://github.com/kulshekhar/ts-jest/commit/5ab100c))
|
||||
* test rootDir to handle preset-angular ([8a6a8f7](https://github.com/kulshekhar/ts-jest/commit/8a6a8f7))
|
||||
* Typo in utils.ts ([#534](https://github.com/kulshekhar/ts-jest/issues/534)) ([a650260](https://github.com/kulshekhar/ts-jest/commit/a650260))
|
||||
* wrong error message ([c955083](https://github.com/kulshekhar/ts-jest/commit/c955083))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* do not hash cache key, jest does it underneath ([fbe4f1f](https://github.com/kulshekhar/ts-jest/commit/fbe4f1f))
|
||||
* improves speed of local test after 1st run ([cc04021](https://github.com/kulshekhar/ts-jest/commit/cc04021))
|
||||
|
||||
|
||||
|
||||
<a name="22.4.5"></a>
|
||||
## [22.4.5](https://github.com/kulshekhar/ts-jest/compare/v22.4.4...v22.4.5) (2018-05-05)
|
||||
|
||||
|
||||
|
||||
<a name="22.4.1"></a>
|
||||
## [22.4.1](https://github.com/kulshekhar/ts-jest/compare/v22.4.0...v22.4.1) (2018-03-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **package:** update source-map-support to version 0.5.0 ([f0aab12](https://github.com/kulshekhar/ts-jest/commit/f0aab12))
|
||||
* add startDir to if-clause ([eed5311](https://github.com/kulshekhar/ts-jest/commit/eed5311))
|
||||
* **package:** update yargs to version 10.0.3 ([5cdf969](https://github.com/kulshekhar/ts-jest/commit/5cdf969))
|
||||
* **package:** update yargs to version 11.0.0 ([7e9ce40](https://github.com/kulshekhar/ts-jest/commit/7e9ce40))
|
||||
* **package:** update yargs to version 9.0.1 ([#326](https://github.com/kulshekhar/ts-jest/issues/326)) ([8bf9924](https://github.com/kulshekhar/ts-jest/commit/8bf9924))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add option to run TypeScript diagnostics ([13b77d9](https://github.com/kulshekhar/ts-jest/commit/13b77d9))
|
||||
|
||||
|
||||
|
||||
<a name="21.0.1"></a>
|
||||
## [21.0.1](https://github.com/kulshekhar/ts-jest/compare/v21.0.0...v21.0.1) (2017-09-14)
|
||||
|
||||
|
||||
|
||||
<a name="21.0.0"></a>
|
||||
# [21.0.0](https://github.com/kulshekhar/ts-jest/compare/v20.0.14...v21.0.0) (2017-09-05)
|
||||
|
||||
|
||||
|
||||
<a name="20.0.14"></a>
|
||||
## [20.0.14](https://github.com/kulshekhar/ts-jest/compare/v20.0.13...v20.0.14) (2017-09-01)
|
||||
|
||||
|
||||
|
||||
<a name="20.0.13"></a>
|
||||
## [20.0.13](https://github.com/kulshekhar/ts-jest/compare/v20.0.12...v20.0.13) (2017-08-30)
|
||||
|
||||
|
||||
|
||||
<a name="20.0.12"></a>
|
||||
## [20.0.12](https://github.com/kulshekhar/ts-jest/compare/v20.0.11...v20.0.12) (2017-08-30)
|
||||
|
||||
|
||||
|
||||
<a name="20.0.11"></a>
|
||||
## [20.0.11](https://github.com/kulshekhar/ts-jest/compare/v20.0.9...v20.0.11) (2017-08-29)
|
||||
|
||||
|
||||
|
||||
<a name="20.0.9"></a>
|
||||
## [20.0.9](https://github.com/kulshekhar/ts-jest/compare/20.0.9...v20.0.9) (2017-08-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **package:** update fs-extra to version 4.0.0 ([5be18fb](https://github.com/kulshekhar/ts-jest/commit/5be18fb))
|
||||
|
||||
|
||||
|
||||
<a name="20.0.7"></a>
|
||||
## [20.0.7](https://github.com/kulshekhar/ts-jest/compare/17.0.3...20.0.7) (2017-07-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **package:** update fs-extra to version 3.0.0 ([906be12](https://github.com/kulshekhar/ts-jest/commit/906be12))
|
||||
* **package:** update yargs to version 8.0.1 ([0b2ea98](https://github.com/kulshekhar/ts-jest/commit/0b2ea98))
|
||||
* peer dependency against Typescript 2.x ([cb08128](https://github.com/kulshekhar/ts-jest/commit/cb08128))
|
||||
* remove outDir when collecting coverage ([c076956](https://github.com/kulshekhar/ts-jest/commit/c076956))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* export transpileIfTypescript ([6f835af](https://github.com/kulshekhar/ts-jest/commit/6f835af))
|
||||
|
||||
|
||||
|
||||
<a name="17.0.3"></a>
|
||||
## [17.0.3](https://github.com/kulshekhar/ts-jest/compare/17.0.2...17.0.3) (2016-12-01)
|
||||
|
||||
|
||||
|
||||
<a name="17.0.2"></a>
|
||||
## [17.0.2](https://github.com/kulshekhar/ts-jest/compare/17.0.1...17.0.2) (2016-12-01)
|
||||
|
||||
|
||||
|
||||
<a name="17.0.1"></a>
|
||||
## [17.0.1](https://github.com/kulshekhar/ts-jest/compare/17.0.0...17.0.1) (2016-11-30)
|
||||
|
||||
|
||||
|
||||
<a name="17.0.0"></a>
|
||||
# [17.0.0](https://github.com/kulshekhar/ts-jest/compare/0.1.13...17.0.0) (2016-11-09)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.13"></a>
|
||||
## [0.1.13](https://github.com/kulshekhar/ts-jest/compare/0.1.12...0.1.13) (2016-11-07)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.12"></a>
|
||||
## [0.1.12](https://github.com/kulshekhar/ts-jest/compare/0.1.11...0.1.12) (2016-11-03)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.11"></a>
|
||||
## [0.1.11](https://github.com/kulshekhar/ts-jest/compare/0.1.10...0.1.11) (2016-10-27)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.10"></a>
|
||||
## [0.1.10](https://github.com/kulshekhar/ts-jest/compare/0.1.9...0.1.10) (2016-10-26)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.9"></a>
|
||||
## [0.1.9](https://github.com/kulshekhar/ts-jest/compare/0.1.8...0.1.9) (2016-10-24)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.8"></a>
|
||||
## [0.1.8](https://github.com/kulshekhar/ts-jest/compare/0.1.7...0.1.8) (2016-10-14)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.7"></a>
|
||||
## [0.1.7](https://github.com/kulshekhar/ts-jest/compare/0.1.6...0.1.7) (2016-10-10)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.6"></a>
|
||||
## [0.1.6](https://github.com/kulshekhar/ts-jest/compare/0.1.5...0.1.6) (2016-10-08)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.5"></a>
|
||||
## [0.1.5](https://github.com/kulshekhar/ts-jest/compare/0.1.4...0.1.5) (2016-09-22)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.4"></a>
|
||||
## [0.1.4](https://github.com/kulshekhar/ts-jest/compare/0.1.3...0.1.4) (2016-09-16)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.3"></a>
|
||||
## [0.1.3](https://github.com/kulshekhar/ts-jest/compare/0.1.2...0.1.3) (2016-08-31)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.2"></a>
|
||||
## [0.1.2](https://github.com/kulshekhar/ts-jest/compare/0.1.1...0.1.2) (2016-08-31)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.1"></a>
|
||||
## [0.1.1](https://github.com/kulshekhar/ts-jest/compare/0.1.0...0.1.1) (2016-08-31)
|
||||
|
||||
|
||||
|
||||
<a name="0.1.0"></a>
|
||||
# [0.1.0](https://github.com/kulshekhar/ts-jest/compare/0.0.1...0.1.0) (2016-08-31)
|
||||
|
||||
|
||||
|
||||
<a name="0.0.1"></a>
|
||||
## [0.0.1](https://github.com/kulshekhar/ts-jest/compare/0.0.0...0.0.1) (2016-08-30)
|
||||
|
||||
|
||||
|
||||
<a name="0.0.0"></a>
|
||||
# 0.0.0 (2016-08-30)
|
||||
|
||||
|
||||
|
67
node_modules/ts-jest/CONTRIBUTING.md
generated
vendored
Normal file
67
node_modules/ts-jest/CONTRIBUTING.md
generated
vendored
Normal file
|
@ -0,0 +1,67 @@
|
|||
# Contributing
|
||||
|
||||
When contributing to this repository, please first discuss the change you wish to make via [slack](https://bit.ly/ts-jest-slack) or [issue](https://github.com/kulshekhar/ts-jest/issues) with the owners of this repository before making a change.
|
||||
|
||||
Please note we have a code of conduct, please follow it in all your interactions with the project.
|
||||
|
||||
## Pull Request Process
|
||||
|
||||
1. Ensure the tests are passing and that you have latest `master` branch merged in.
|
||||
2. Update the `docs/` with details of your changes if required.
|
||||
3. If possible, squash your commits. There must be only one commit in your PR (until a review). Then after each review requesting changes, DO NOT squash your commits with the one before the review, so that we can see intermediate modifications.
|
||||
4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you do not have permission to do that, you may request the second reviewer to merge it for you.
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
### Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
### Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
### Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
### Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
||||
|
||||
### Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at kulshekhar@gmail.com. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
### Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
21
node_modules/ts-jest/LICENSE.md
generated
vendored
Normal file
21
node_modules/ts-jest/LICENSE.md
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2016-2018
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
62
node_modules/ts-jest/README.md
generated
vendored
Normal file
62
node_modules/ts-jest/README.md
generated
vendored
Normal file
|
@ -0,0 +1,62 @@
|
|||
# ts-jest [](https://badge.fury.io/js/ts-jest) [](https://npmjs.org/package/ts-jest) [](https://snyk.io/test/github/kulshekhar/ts-jest) [](https://coveralls.io/github/kulshekhar/ts-jest?branch=master) [](https://dependabot.com) [](https://travis-ci.org/kulshekhar/ts-jest) [](https://ci.appveyor.com/project/kulshekhar/ts-jest/branch/master)
|
||||
|
||||
<img src="./icon.png" align="right" title="ts-jest Logo" width="128" height="128">
|
||||
|
||||
**`ts-jest`** is a TypeScript preprocessor with source map support for Jest that lets you use Jest to test projects written in TypeScript.
|
||||
|
||||
It supports all features of TypeScript including type-checking. [Read more about Babel7 + `preset-typescript` **vs** TypeScript (and `ts-jest`)](https://kulshekhar.github.io/ts-jest/user/babel7-or-ts).
|
||||
|
||||
---
|
||||
|
||||
| We are not doing semantic versioning and `23.10` is a re-write, run `npm i -D ts-jest@"<23.10.0"` to go back to the previous version |
|
||||
|---|
|
||||
|
||||
[<img src="./docs/assets/img/documentation.png" align="left" height="24"> View the online documentation (usage & technical)](https://kulshekhar.github.io/ts-jest)
|
||||
|
||||
[<img src="./docs/assets/img/slack.png" align="left" height="24"> Ask for some help in the `ts-jest` community of Slack](https://bit.ly/ts-jest-slack)
|
||||
|
||||
<!--
|
||||
[<img src="./docs/assets/img/troubleshooting.png" align="left" height="24"> Before reporting any issue, be sure to check the troubleshooting page](https://kulshekhar.github.io/ts-jest/user/troubleshooting)
|
||||
-->
|
||||
|
||||
[<img src="./docs/assets/img/pull-request.png" align="left" height="24"> We're looking for collaborators! Want to help improve `ts-jest`?](https://github.com/kulshekhar/ts-jest/issues/223)
|
||||
|
||||
---
|
||||
|
||||
## Getting Started
|
||||
|
||||
These instructions will get you setup to use `ts-jest` in your project. For more detailed documentation, please check [online documentation](https://kulshekhar.github.io/ts-jest).
|
||||
|
||||
| | using npm | using yarn |
|
||||
|---:|---|---|
|
||||
| **Prerequisites** | `npm i -D jest typescript` | `yarn add --dev jest typescript` |
|
||||
| **Installing** | `npm i -D ts-jest @types/jest` | `yarn add --dev ts-jest @types/jest` |
|
||||
| **Creating config** | `npx ts-jest config:init` | `yarn ts-jest config:init` |
|
||||
| **Running tests** | `npm t` or `npx jest` | `yarn test` or `yarn jest` |
|
||||
|
||||
## Built With
|
||||
|
||||
* [TypeScript](https://www.typescriptlang.org/) - JavaScript that scales
|
||||
* [Jest](https://jestjs.io/) - Delightful JavaScript Testing
|
||||
* [`ts-jest`](https://kulshekhar.github.io/ts-jest) - Jest processor for TypeScript _(yes, `ts-jest` uses itself for its tests)_
|
||||
|
||||
## Contributing
|
||||
|
||||
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
|
||||
|
||||
## Versioning
|
||||
|
||||
We **DO NOT** use [SemVer](http://semver.org/) for versioning. Though you can think about SemVer when reading our version, except our major number follows the one of Jest. For the versions available, see the [tags on this repository](https://github.com/kulshekhar/ts-jest/tags).
|
||||
|
||||
## Authors/maintainers
|
||||
|
||||
* **Kulshekhar Kabra** - [kulshekhar](https://github.com/kulshekhar)
|
||||
* **Gustav Wengel** - [GeeWee](https://github.com/GeeWee)
|
||||
* **Ahn** - [ahnpnl](https://github.com/ahnpnl)
|
||||
* **Huafu Gandon** - [huafu](https://github.com/huafu)
|
||||
|
||||
See also the list of [contributors](https://github.com/kulshekhar/ts-jest/contributors) who participated in this project.
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
|
3
node_modules/ts-jest/cli.js
generated
vendored
Executable file
3
node_modules/ts-jest/cli.js
generated
vendored
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
require('./dist/cli').processArgv()
|
1
node_modules/ts-jest/dist/cli/config/init.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/cli/config/init.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
152
node_modules/ts-jest/dist/cli/config/init.js
generated
vendored
Normal file
152
node_modules/ts-jest/dist/cli/config/init.js
generated
vendored
Normal file
|
@ -0,0 +1,152 @@
|
|||
"use strict";
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var fs_1 = require("fs");
|
||||
var json5_1 = require("json5");
|
||||
var path_1 = require("path");
|
||||
var presets_1 = require("../helpers/presets");
|
||||
exports.run = function (args) { return __awaiter(void 0, void 0, void 0, function () {
|
||||
var file, filePath, name, isPackage, exists, pkgFile, hasPackage, _a, jestPreset, askedTsconfig, force, jsdom, tsconfig, pkgJson, jsFilesProcessor, shouldPostProcessWithBabel, preset, body, base, tsJestConf, content;
|
||||
return __generator(this, function (_b) {
|
||||
file = args._[0] || 'jest.config.js';
|
||||
filePath = path_1.join(process.cwd(), file);
|
||||
name = path_1.basename(file);
|
||||
isPackage = name === 'package.json';
|
||||
exists = fs_1.existsSync(filePath);
|
||||
pkgFile = isPackage ? filePath : path_1.join(process.cwd(), 'package.json');
|
||||
hasPackage = isPackage || fs_1.existsSync(pkgFile);
|
||||
_a = args.jestPreset, jestPreset = _a === void 0 ? true : _a, askedTsconfig = args.tsconfig, force = args.force, jsdom = args.jsdom;
|
||||
tsconfig = askedTsconfig === 'tsconfig.json' ? undefined : askedTsconfig;
|
||||
pkgJson = hasPackage ? JSON.parse(fs_1.readFileSync(pkgFile, 'utf8')) : {};
|
||||
jsFilesProcessor = args.js, shouldPostProcessWithBabel = args.babel;
|
||||
if (jsFilesProcessor == null) {
|
||||
jsFilesProcessor = shouldPostProcessWithBabel ? 'babel' : undefined;
|
||||
}
|
||||
else if (shouldPostProcessWithBabel == null) {
|
||||
shouldPostProcessWithBabel = jsFilesProcessor === 'babel';
|
||||
}
|
||||
if (jsFilesProcessor === 'babel') {
|
||||
preset = presets_1.jsWIthBabel;
|
||||
}
|
||||
else if (jsFilesProcessor === 'ts') {
|
||||
preset = presets_1.jsWithTs;
|
||||
}
|
||||
else {
|
||||
preset = presets_1.defaults;
|
||||
}
|
||||
if (isPackage && !exists) {
|
||||
throw new Error("File " + file + " does not exists.");
|
||||
}
|
||||
else if (!isPackage && exists && !force) {
|
||||
throw new Error("Configuration file " + file + " already exists.");
|
||||
}
|
||||
if (!isPackage && !name.endsWith('.js')) {
|
||||
throw new TypeError("Configuration file " + file + " must be a .js file or the package.json.");
|
||||
}
|
||||
if (hasPackage && pkgJson.jest) {
|
||||
if (force && !isPackage) {
|
||||
delete pkgJson.jest;
|
||||
fs_1.writeFileSync(pkgFile, JSON.stringify(pkgJson, undefined, ' '));
|
||||
}
|
||||
else if (!force) {
|
||||
throw new Error("A Jest configuration is already set in " + pkgFile + ".");
|
||||
}
|
||||
}
|
||||
if (isPackage) {
|
||||
base = jestPreset ? { preset: preset.name } : __assign({}, preset.value);
|
||||
if (!jsdom)
|
||||
base.testEnvironment = 'node';
|
||||
if (tsconfig || shouldPostProcessWithBabel) {
|
||||
tsJestConf = {};
|
||||
base.globals = { 'ts-jest': tsJestConf };
|
||||
if (tsconfig)
|
||||
tsJestConf.tsconfig = tsconfig;
|
||||
if (shouldPostProcessWithBabel)
|
||||
tsJestConf.babelConfig = true;
|
||||
}
|
||||
body = JSON.stringify(__assign(__assign({}, pkgJson), { jest: base }), undefined, ' ');
|
||||
}
|
||||
else {
|
||||
content = [];
|
||||
if (!jestPreset) {
|
||||
content.push(preset.jsImport('tsjPreset') + ";", '');
|
||||
}
|
||||
content.push('module.exports = {');
|
||||
if (jestPreset) {
|
||||
content.push(" preset: '" + preset.name + "',");
|
||||
}
|
||||
else {
|
||||
content.push(" ...tsjPreset,");
|
||||
}
|
||||
if (!jsdom)
|
||||
content.push(" testEnvironment: 'node',");
|
||||
if (tsconfig || shouldPostProcessWithBabel) {
|
||||
content.push(" globals: {");
|
||||
content.push(" 'ts-jest': {");
|
||||
if (tsconfig)
|
||||
content.push(" tsconfig: " + json5_1.stringify(tsconfig) + ",");
|
||||
if (shouldPostProcessWithBabel)
|
||||
content.push(" babelConfig: true,");
|
||||
content.push(" },");
|
||||
content.push(" },");
|
||||
}
|
||||
content.push('};');
|
||||
body = content.join('\n');
|
||||
}
|
||||
fs_1.writeFileSync(filePath, body);
|
||||
process.stderr.write("\nJest configuration written to \"" + filePath + "\".\n");
|
||||
return [2];
|
||||
});
|
||||
}); };
|
||||
exports.help = function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||
return __generator(this, function (_a) {
|
||||
process.stdout.write("\nUsage:\n ts-jest config:init [options] [<config-file>]\n\nArguments:\n <config-file> Can be a js or json Jest config file. If it is a\n package.json file, the configuration will be read from\n the \"jest\" property.\n Default: jest.config.js\n\nOptions:\n --force Discard any existing Jest config\n --js ts|babel Process .js files with ts-jest if 'ts' or with\n babel-jest if 'babel'\n --no-jest-preset Disable the use of Jest presets\n --tsconfig <file> Path to the tsconfig.json file\n --babel Pipe babel-jest after ts-jest\n --jsdom Use jsdom as test environment instead of node\n");
|
||||
return [2];
|
||||
});
|
||||
}); };
|
1
node_modules/ts-jest/dist/cli/config/migrate.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/cli/config/migrate.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
217
node_modules/ts-jest/dist/cli/config/migrate.js
generated
vendored
Normal file
217
node_modules/ts-jest/dist/cli/config/migrate.js
generated
vendored
Normal file
|
@ -0,0 +1,217 @@
|
|||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
var __spread = (this && this.__spread) || function () {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var bs_logger_1 = require("bs-logger");
|
||||
var stringifyJson = require("fast-json-stable-stringify");
|
||||
var fs_1 = require("fs");
|
||||
var json5_1 = require("json5");
|
||||
var path_1 = require("path");
|
||||
var backports_1 = require("../../util/backports");
|
||||
var presets_1 = require("../helpers/presets");
|
||||
exports.run = function (args) { return __awaiter(void 0, void 0, void 0, function () {
|
||||
var nullLogger, file, filePath, footNotes, name, isPackage, actualConfig, migratedConfig, presetName, preset, jsTransformers, jsWithTs, jsWithBabel, presetValue, migratedValue, presetValue, migratedValue, before, after, stringify, prefix;
|
||||
return __generator(this, function (_a) {
|
||||
nullLogger = bs_logger_1.createLogger({ targets: [] });
|
||||
file = args._[0];
|
||||
filePath = path_1.resolve(process.cwd(), file);
|
||||
footNotes = [];
|
||||
if (!fs_1.existsSync(filePath)) {
|
||||
throw new Error("Configuration file " + file + " does not exists.");
|
||||
}
|
||||
name = path_1.basename(file);
|
||||
isPackage = name === 'package.json';
|
||||
if (!/\.(js|json)$/.test(name)) {
|
||||
throw new TypeError("Configuration file " + file + " must be a JavaScript or JSON file.");
|
||||
}
|
||||
actualConfig = require(filePath);
|
||||
if (isPackage) {
|
||||
actualConfig = actualConfig.jest;
|
||||
}
|
||||
if (!actualConfig)
|
||||
actualConfig = {};
|
||||
migratedConfig = backports_1.backportJestConfig(nullLogger, actualConfig);
|
||||
if (!migratedConfig.preset && args.jestPreset) {
|
||||
if (args.js) {
|
||||
presetName = args.js === 'babel' ? presets_1.JestPresetNames.jsWIthBabel : presets_1.JestPresetNames.jsWithTs;
|
||||
}
|
||||
else {
|
||||
jsTransformers = Object.keys(migratedConfig.transform || {}).reduce(function (list, pattern) {
|
||||
if (RegExp(pattern.replace(/^<rootDir>\/?/, '/dummy-project/')).test('/dummy-project/src/foo.js')) {
|
||||
var transformer = migratedConfig.transform[pattern];
|
||||
if (/\bbabel-jest\b/.test(transformer))
|
||||
transformer = 'babel-jest';
|
||||
else if (/\ts-jest\b/.test(transformer))
|
||||
transformer = 'ts-jest';
|
||||
return __spread(list, [transformer]);
|
||||
}
|
||||
return list;
|
||||
}, []);
|
||||
jsWithTs = jsTransformers.includes('ts-jest');
|
||||
jsWithBabel = jsTransformers.includes('babel-jest');
|
||||
if (jsWithBabel && !jsWithTs) {
|
||||
presetName = presets_1.JestPresetNames.jsWIthBabel;
|
||||
}
|
||||
else if (jsWithTs && !jsWithBabel) {
|
||||
presetName = presets_1.JestPresetNames.jsWithTs;
|
||||
}
|
||||
else {
|
||||
presetName = presets_1.JestPresetNames.default;
|
||||
}
|
||||
}
|
||||
presetName = presetName || presets_1.JestPresetNames.default;
|
||||
preset = presets_1.allPresets[presetName];
|
||||
footNotes.push("Detected preset '" + preset.label + "' as the best matching preset for your configuration.\nVisit https://kulshekhar.github.io/ts-jest/user/config/#jest-preset for more information about presets.\n");
|
||||
}
|
||||
else if (migratedConfig.preset && migratedConfig.preset.startsWith('ts-jest')) {
|
||||
if (args.jestPreset === false) {
|
||||
delete migratedConfig.preset;
|
||||
}
|
||||
else {
|
||||
preset = presets_1.allPresets[migratedConfig.preset] || presets_1.defaults;
|
||||
}
|
||||
}
|
||||
if (preset)
|
||||
migratedConfig.preset = preset.name;
|
||||
if (migratedConfig.moduleFileExtensions && migratedConfig.moduleFileExtensions.length && preset) {
|
||||
presetValue = dedupSort(preset.value.moduleFileExtensions || []).join('::');
|
||||
migratedValue = dedupSort(migratedConfig.moduleFileExtensions).join('::');
|
||||
if (presetValue === migratedValue) {
|
||||
delete migratedConfig.moduleFileExtensions;
|
||||
}
|
||||
}
|
||||
if (migratedConfig.testRegex && preset) {
|
||||
migratedConfig.testMatch = null;
|
||||
}
|
||||
else if (migratedConfig.testMatch && migratedConfig.testMatch.length && preset) {
|
||||
presetValue = dedupSort(preset.value.testMatch || []).join('::');
|
||||
migratedValue = dedupSort(migratedConfig.testMatch).join('::');
|
||||
if (presetValue === migratedValue) {
|
||||
delete migratedConfig.testMatch;
|
||||
}
|
||||
}
|
||||
if (migratedConfig.transform) {
|
||||
Object.keys(migratedConfig.transform).forEach(function (key) {
|
||||
var val = migratedConfig.transform[key];
|
||||
if (typeof val === 'string' && /\/?ts-jest(?:\/preprocessor\.js)?$/.test(val)) {
|
||||
;
|
||||
migratedConfig.transform[key] = 'ts-jest';
|
||||
}
|
||||
});
|
||||
}
|
||||
if (preset &&
|
||||
migratedConfig.transform &&
|
||||
stringifyJson(migratedConfig.transform) === stringifyJson(preset.value.transform)) {
|
||||
delete migratedConfig.transform;
|
||||
}
|
||||
cleanupConfig(actualConfig);
|
||||
cleanupConfig(migratedConfig);
|
||||
before = stringifyJson(actualConfig);
|
||||
after = stringifyJson(migratedConfig);
|
||||
if (after === before) {
|
||||
process.stderr.write("\nNo migration needed for given Jest configuration\n ");
|
||||
return [2];
|
||||
}
|
||||
stringify = /\.json$/.test(file) ? JSON.stringify : json5_1.stringify;
|
||||
prefix = /\.json$/.test(file) ? '"jest": ' : 'module.exports = ';
|
||||
if (preset && migratedConfig.transform) {
|
||||
footNotes.push("\nI couldn't check if your \"transform\" value is the same as mine which is: " + stringify(preset.value.transform, undefined, ' ') + "\nIf it is the case, you can safely remove the \"transform\" from what I've migrated.\n");
|
||||
}
|
||||
process.stderr.write("\nMigrated Jest configuration:\n");
|
||||
process.stdout.write("" + prefix + stringify(migratedConfig, undefined, ' ') + "\n");
|
||||
if (footNotes.length) {
|
||||
process.stderr.write("\n" + footNotes.join('\n') + "\n");
|
||||
}
|
||||
return [2];
|
||||
});
|
||||
}); };
|
||||
function cleanupConfig(config) {
|
||||
if (config.globals) {
|
||||
if (config.globals['ts-jest'] && Object.keys(config.globals['ts-jest']).length === 0) {
|
||||
delete config.globals['ts-jest'];
|
||||
}
|
||||
if (Object.keys(config.globals).length === 0) {
|
||||
delete config.globals;
|
||||
}
|
||||
}
|
||||
if (config.transform && Object.keys(config.transform).length === 0) {
|
||||
delete config.transform;
|
||||
}
|
||||
if (config.moduleFileExtensions) {
|
||||
config.moduleFileExtensions = dedupSort(config.moduleFileExtensions);
|
||||
if (config.moduleFileExtensions.length === 0)
|
||||
delete config.moduleFileExtensions;
|
||||
}
|
||||
if (config.testMatch) {
|
||||
config.testMatch = dedupSort(config.testMatch);
|
||||
if (config.testMatch.length === 0)
|
||||
delete config.testMatch;
|
||||
}
|
||||
if (config.preset === presets_1.JestPresetNames.default)
|
||||
config.preset = presets_1.defaults.name;
|
||||
}
|
||||
function dedupSort(arr) {
|
||||
return arr
|
||||
.filter(function (s, i, a) { return a.findIndex(function (e) { return s.toString() === e.toString(); }) === i; })
|
||||
.sort(function (a, b) { return (a.toString() > b.toString() ? 1 : a.toString() < b.toString() ? -1 : 0); });
|
||||
}
|
||||
exports.help = function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||
return __generator(this, function (_a) {
|
||||
process.stdout.write("\nUsage:\n ts-jest config:migrate [options] <config-file>\n\nArguments:\n <config-file> Can be a js or json Jest config file. If it is a\n package.json file, the configuration will be read from\n the \"jest\" property.\n\nOptions:\n --js ts|babel Process .js files with ts-jest if 'ts' or with\n babel-jest if 'babel'\n --no-jest-preset Disable the use of Jest presets\n");
|
||||
return [2];
|
||||
});
|
||||
}); };
|
1
node_modules/ts-jest/dist/cli/help.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/cli/help.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
45
node_modules/ts-jest/dist/cli/help.js
generated
vendored
Normal file
45
node_modules/ts-jest/dist/cli/help.js
generated
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.run = function (_) { return __awaiter(void 0, void 0, void 0, function () {
|
||||
return __generator(this, function (_a) {
|
||||
process.stdout.write("\nUsage:\n ts-jest command [options] [...args]\n\nCommands:\n config:init Creates initial Jest configuration\n config:migrate Migrates a given Jest configuration\n help [command] Show this help, or help about a command\n\nExample:\n ts-jest help config:migrate\n");
|
||||
return [2];
|
||||
});
|
||||
}); };
|
||||
exports.help = exports.run;
|
1
node_modules/ts-jest/dist/cli/helpers/presets.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/cli/helpers/presets.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
39
node_modules/ts-jest/dist/cli/helpers/presets.js
generated
vendored
Normal file
39
node_modules/ts-jest/dist/cli/helpers/presets.js
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var JestPresetNames;
|
||||
(function (JestPresetNames) {
|
||||
JestPresetNames["default"] = "ts-jest/presets/default";
|
||||
JestPresetNames["jsWithTs"] = "ts-jest/presets/js-with-ts";
|
||||
JestPresetNames["jsWIthBabel"] = "ts-jest/presets/js-with-babel";
|
||||
})(JestPresetNames = exports.JestPresetNames || (exports.JestPresetNames = {}));
|
||||
var definePreset = function (fullName) { return ({
|
||||
fullName: fullName,
|
||||
get name() {
|
||||
return this.isDefault ? 'ts-jest' : fullName;
|
||||
},
|
||||
get label() {
|
||||
return fullName.split('/').pop();
|
||||
},
|
||||
get jsVarName() {
|
||||
return this.isDefault
|
||||
? 'defaults'
|
||||
: fullName
|
||||
.split('/')
|
||||
.pop()
|
||||
.replace(/\-([a-z])/g, function (_, l) { return l.toUpperCase(); });
|
||||
},
|
||||
get value() {
|
||||
return require("../../../" + fullName.replace(/^ts-jest\//, '') + "/jest-preset");
|
||||
},
|
||||
jsImport: function (varName) {
|
||||
if (varName === void 0) { varName = 'tsjPreset'; }
|
||||
return "const { " + this.jsVarName + ": " + varName + " } = require('ts-jest/presets')";
|
||||
},
|
||||
get isDefault() {
|
||||
return fullName === JestPresetNames.default;
|
||||
},
|
||||
}); };
|
||||
exports.allPresets = {};
|
||||
exports.defaults = (exports.allPresets[JestPresetNames.default] = definePreset(JestPresetNames.default));
|
||||
exports.jsWithTs = (exports.allPresets[JestPresetNames.jsWithTs] = definePreset(JestPresetNames.jsWithTs));
|
||||
exports.jsWIthBabel = (exports.allPresets[JestPresetNames.jsWIthBabel] = definePreset(JestPresetNames.jsWIthBabel));
|
1
node_modules/ts-jest/dist/cli/index.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/cli/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
103
node_modules/ts-jest/dist/cli/index.js
generated
vendored
Normal file
103
node_modules/ts-jest/dist/cli/index.js
generated
vendored
Normal file
|
@ -0,0 +1,103 @@
|
|||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var bs_logger_1 = require("bs-logger");
|
||||
var yargsParser = require("yargs-parser");
|
||||
var logger_1 = require("../util/logger");
|
||||
var VALID_COMMANDS = ['help', 'config:migrate', 'config:init'];
|
||||
var logger = logger_1.rootLogger.child((_a = {}, _a[bs_logger_1.LogContexts.namespace] = 'cli', _a[bs_logger_1.LogContexts.application] = 'ts-jest', _a));
|
||||
function cli(args) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var parsedArgv, command, isHelp, _a, run, help, cmd;
|
||||
return __generator(this, function (_b) {
|
||||
parsedArgv = yargsParser(args, {
|
||||
boolean: ['dry-run', 'jest-preset', 'allow-js', 'diff', 'babel', 'force', 'jsdom'],
|
||||
string: ['tsconfig', 'js'],
|
||||
count: ['verbose'],
|
||||
alias: { verbose: ['v'] },
|
||||
default: { jestPreset: true, verbose: 0 },
|
||||
coerce: {
|
||||
js: function (val) {
|
||||
var res = val.trim().toLowerCase();
|
||||
if (!['babel', 'ts'].includes(res))
|
||||
throw new Error("The 'js' option must be 'babel' or 'ts', given: '" + val + "'.");
|
||||
return res;
|
||||
},
|
||||
},
|
||||
});
|
||||
if (parsedArgv.allowJs != null) {
|
||||
if (parsedArgv.js)
|
||||
throw new Error("The 'allowJs' and 'js' options cannot be set together.");
|
||||
parsedArgv.js = parsedArgv.allowJs ? 'ts' : undefined;
|
||||
}
|
||||
command = parsedArgv._.shift();
|
||||
isHelp = command === 'help';
|
||||
if (isHelp)
|
||||
command = parsedArgv._.shift();
|
||||
if (!VALID_COMMANDS.includes(command))
|
||||
command = 'help';
|
||||
_a = require("./" + command.replace(/:/g, '/')), run = _a.run, help = _a.help;
|
||||
cmd = isHelp && command !== 'help' ? help : run;
|
||||
return [2, cmd(parsedArgv, logger)];
|
||||
});
|
||||
});
|
||||
}
|
||||
function processArgv() {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var err_1;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
_a.trys.push([0, 2, , 3]);
|
||||
return [4, cli(process.argv.slice(2))];
|
||||
case 1:
|
||||
_a.sent();
|
||||
process.exit(0);
|
||||
return [3, 3];
|
||||
case 2:
|
||||
err_1 = _a.sent();
|
||||
logger.fatal(err_1.message);
|
||||
process.exit(1);
|
||||
return [3, 3];
|
||||
case 3: return [2];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.processArgv = processArgv;
|
1
node_modules/ts-jest/dist/compiler.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/compiler.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
233
node_modules/ts-jest/dist/compiler.js
generated
vendored
Normal file
233
node_modules/ts-jest/dist/compiler.js
generated
vendored
Normal file
|
@ -0,0 +1,233 @@
|
|||
"use strict";
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
var __values = (this && this.__values) || function(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var bs_logger_1 = require("bs-logger");
|
||||
var bufferFrom = require("buffer-from");
|
||||
var stableStringify = require("fast-json-stable-stringify");
|
||||
var fs_1 = require("fs");
|
||||
var memoize = require("lodash.memoize");
|
||||
var mkdirp = require("mkdirp");
|
||||
var path_1 = require("path");
|
||||
var messages_1 = require("./util/messages");
|
||||
var sha1_1 = require("./util/sha1");
|
||||
var hasOwn = Object.prototype.hasOwnProperty;
|
||||
function createCompiler(configs) {
|
||||
var e_1, _a, _b, _c;
|
||||
var logger = configs.logger.child({ namespace: 'ts-compiler' });
|
||||
logger.debug('creating typescript compiler', configs.tsJest.isolatedModules ? '(isolated modules)' : '(language service)');
|
||||
var cachedir = configs.tsCacheDir;
|
||||
var memoryCache = {
|
||||
contents: Object.create(null),
|
||||
versions: Object.create(null),
|
||||
outputs: Object.create(null),
|
||||
};
|
||||
var ts = configs.compilerModule;
|
||||
var cwd = configs.cwd;
|
||||
var extensions = ['.ts', '.tsx'];
|
||||
var _d = configs.typescript, compilerOptions = _d.options, fileNames = _d.fileNames;
|
||||
if (compilerOptions.allowJs) {
|
||||
extensions.push('.js');
|
||||
extensions.push('.jsx');
|
||||
}
|
||||
try {
|
||||
for (var fileNames_1 = __values(fileNames), fileNames_1_1 = fileNames_1.next(); !fileNames_1_1.done; fileNames_1_1 = fileNames_1.next()) {
|
||||
var path = fileNames_1_1.value;
|
||||
memoryCache.versions[path] = 1;
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (fileNames_1_1 && !fileNames_1_1.done && (_a = fileNames_1.return)) _a.call(fileNames_1);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
var getExtension = compilerOptions.jsx === ts.JsxEmit.Preserve
|
||||
? function (path) { return (/\.[tj]sx$/.test(path) ? '.jsx' : '.js'); }
|
||||
: function (_) { return '.js'; };
|
||||
var transformers = configs.tsCustomTransformers;
|
||||
var getOutput = function (code, fileName) {
|
||||
logger.debug({ fileName: fileName }, 'getOutput(): compiling as isolated module');
|
||||
var result = ts.transpileModule(code, {
|
||||
fileName: fileName,
|
||||
transformers: transformers,
|
||||
compilerOptions: compilerOptions,
|
||||
reportDiagnostics: configs.shouldReportDiagnostic(fileName),
|
||||
});
|
||||
if (result.diagnostics)
|
||||
configs.raiseDiagnostics(result.diagnostics, fileName, logger);
|
||||
return [result.outputText, result.sourceMapText];
|
||||
};
|
||||
var getTypeInfo = function (_code, _fileName, _position) {
|
||||
throw new TypeError(messages_1.Errors.TypesUnavailableWithoutTypeCheck);
|
||||
};
|
||||
if (!configs.tsJest.isolatedModules) {
|
||||
var updateMemoryCache_1 = function (code, fileName) {
|
||||
logger.debug({ fileName: fileName }, "updateMemoryCache()");
|
||||
if (memoryCache.contents[fileName] !== code) {
|
||||
memoryCache.contents[fileName] = code;
|
||||
memoryCache.versions[fileName] = (memoryCache.versions[fileName] || 0) + 1;
|
||||
}
|
||||
};
|
||||
var serviceHostDebugCtx = (_b = {},
|
||||
_b[bs_logger_1.LogContexts.logLevel] = bs_logger_1.LogLevels.debug,
|
||||
_b.namespace = 'ts:serviceHost',
|
||||
_b.call = null,
|
||||
_b);
|
||||
var serviceHostTraceCtx = __assign(__assign({}, serviceHostDebugCtx), (_c = {}, _c[bs_logger_1.LogContexts.logLevel] = bs_logger_1.LogLevels.trace, _c));
|
||||
var serviceHost = {
|
||||
getScriptFileNames: function () { return Object.keys(memoryCache.versions); },
|
||||
getScriptVersion: function (fileName) {
|
||||
var version = memoryCache.versions[fileName];
|
||||
return version === undefined ? undefined : String(version);
|
||||
},
|
||||
getScriptSnapshot: function (fileName) {
|
||||
var hit = hasOwn.call(memoryCache.contents, fileName);
|
||||
logger.trace({ fileName: fileName, cacheHit: hit }, "getScriptSnapshot():", 'cache', hit ? 'hit' : 'miss');
|
||||
if (!hit) {
|
||||
memoryCache.contents[fileName] = ts.sys.readFile(fileName);
|
||||
}
|
||||
var contents = memoryCache.contents[fileName];
|
||||
if (contents === undefined) {
|
||||
return;
|
||||
}
|
||||
return ts.ScriptSnapshot.fromString(contents);
|
||||
},
|
||||
fileExists: memoize(ts.sys.fileExists),
|
||||
readFile: logger.wrap(serviceHostTraceCtx, 'readFile', memoize(ts.sys.readFile)),
|
||||
readDirectory: memoize(ts.sys.readDirectory),
|
||||
getDirectories: memoize(ts.sys.getDirectories),
|
||||
directoryExists: memoize(ts.sys.directoryExists),
|
||||
realpath: memoize(ts.sys.realpath),
|
||||
getNewLine: function () { return '\n'; },
|
||||
getCurrentDirectory: function () { return cwd; },
|
||||
getCompilationSettings: function () { return compilerOptions; },
|
||||
getDefaultLibFileName: function () { return ts.getDefaultLibFilePath(compilerOptions); },
|
||||
getCustomTransformers: function () { return transformers; },
|
||||
};
|
||||
logger.debug('creating language service');
|
||||
var service_1 = ts.createLanguageService(serviceHost);
|
||||
getOutput = function (code, fileName) {
|
||||
logger.debug({ fileName: fileName }, 'getOutput(): compiling using language service');
|
||||
updateMemoryCache_1(code, fileName);
|
||||
var output = service_1.getEmitOutput(fileName);
|
||||
if (configs.shouldReportDiagnostic(fileName)) {
|
||||
logger.debug({ fileName: fileName }, 'getOutput(): computing diagnostics');
|
||||
var diagnostics = service_1
|
||||
.getCompilerOptionsDiagnostics()
|
||||
.concat(service_1.getSyntacticDiagnostics(fileName))
|
||||
.concat(service_1.getSemanticDiagnostics(fileName));
|
||||
configs.raiseDiagnostics(diagnostics, fileName, logger);
|
||||
}
|
||||
if (output.emitSkipped) {
|
||||
throw new TypeError(path_1.relative(cwd, fileName) + ": Emit skipped");
|
||||
}
|
||||
if (output.outputFiles.length === 0) {
|
||||
throw new TypeError(messages_1.interpolate(messages_1.Errors.UnableToRequireDefinitionFile, {
|
||||
file: path_1.basename(fileName),
|
||||
}));
|
||||
}
|
||||
return [output.outputFiles[1].text, output.outputFiles[0].text];
|
||||
};
|
||||
getTypeInfo = function (code, fileName, position) {
|
||||
updateMemoryCache_1(code, fileName);
|
||||
var info = service_1.getQuickInfoAtPosition(fileName, position);
|
||||
var name = ts.displayPartsToString(info ? info.displayParts : []);
|
||||
var comment = ts.displayPartsToString(info ? info.documentation : []);
|
||||
return { name: name, comment: comment };
|
||||
};
|
||||
}
|
||||
var compile = readThrough(cachedir, memoryCache, getOutput, getExtension, cwd, logger);
|
||||
return { cwd: cwd, compile: compile, getTypeInfo: getTypeInfo, extensions: extensions, cachedir: cachedir, ts: ts };
|
||||
}
|
||||
exports.createCompiler = createCompiler;
|
||||
function readThrough(cachedir, memoryCache, compile, getExtension, cwd, logger) {
|
||||
if (!cachedir) {
|
||||
return function (code, fileName, lineOffset) {
|
||||
logger.debug({ fileName: fileName }, 'readThrough(): no cache');
|
||||
var _a = __read(compile(code, fileName, lineOffset), 2), value = _a[0], sourceMap = _a[1];
|
||||
var output = updateOutput(value, fileName, sourceMap, getExtension, cwd);
|
||||
memoryCache.outputs[fileName] = output;
|
||||
return output;
|
||||
};
|
||||
}
|
||||
mkdirp.sync(cachedir);
|
||||
return function (code, fileName, lineOffset) {
|
||||
var cachePath = path_1.join(cachedir, getCacheName(code, fileName));
|
||||
var extension = getExtension(fileName);
|
||||
var outputPath = "" + cachePath + extension;
|
||||
try {
|
||||
var output_1 = fs_1.readFileSync(outputPath, 'utf8');
|
||||
if (isValidCacheContent(output_1)) {
|
||||
logger.debug({ fileName: fileName }, 'readThrough(): cache hit');
|
||||
memoryCache.outputs[fileName] = output_1;
|
||||
return output_1;
|
||||
}
|
||||
}
|
||||
catch (err) { }
|
||||
logger.debug({ fileName: fileName }, 'readThrough(): cache miss');
|
||||
var _a = __read(compile(code, fileName, lineOffset), 2), value = _a[0], sourceMap = _a[1];
|
||||
var output = updateOutput(value, fileName, sourceMap, getExtension, cwd);
|
||||
logger.debug({ fileName: fileName, outputPath: outputPath }, 'readThrough(): writing caches');
|
||||
memoryCache.outputs[fileName] = output;
|
||||
fs_1.writeFileSync(outputPath, output);
|
||||
return output;
|
||||
};
|
||||
}
|
||||
function updateOutput(outputText, fileName, sourceMap, getExtension, sourceRoot) {
|
||||
var base = path_1.basename(fileName);
|
||||
var base64Map = bufferFrom(updateSourceMap(sourceMap, fileName, sourceRoot), 'utf8').toString('base64');
|
||||
var sourceMapContent = "data:application/json;charset=utf-8;base64," + base64Map;
|
||||
var sourceMapLength = (base + ".map").length + (getExtension(fileName).length - path_1.extname(fileName).length);
|
||||
return outputText.slice(0, -sourceMapLength) + sourceMapContent;
|
||||
}
|
||||
function updateSourceMap(sourceMapText, fileName, _sourceRoot) {
|
||||
var sourceMap = JSON.parse(sourceMapText);
|
||||
sourceMap.file = fileName;
|
||||
sourceMap.sources = [fileName];
|
||||
delete sourceMap.sourceRoot;
|
||||
return stableStringify(sourceMap);
|
||||
}
|
||||
function getCacheName(sourceCode, fileName) {
|
||||
return sha1_1.sha1(path_1.extname(fileName), '\x00', sourceCode);
|
||||
}
|
||||
function isValidCacheContent(contents) {
|
||||
return /(?:9|0=|Q==)$/.test(contents.slice(-3));
|
||||
}
|
36
node_modules/ts-jest/dist/config/config-set.d.ts
generated
vendored
Normal file
36
node_modules/ts-jest/dist/config/config-set.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
/// <reference types="jest" />
|
||||
import { Logger } from 'bs-logger';
|
||||
import { CompilerOptions, CustomTransformers, ParsedCommandLine } from 'typescript';
|
||||
import { AstTransformerDesc, BabelConfig, BabelJestTransformer, TTypeScript, TsCompiler, TsJestConfig, TsJestGlobalOptions, TsJestHooksMap } from '../types';
|
||||
export declare class ConfigSet {
|
||||
readonly parentOptions?: TsJestGlobalOptions | undefined;
|
||||
readonly projectPackageJson: Record<string, any>;
|
||||
readonly projectDependencies: Record<string, string>;
|
||||
readonly jest: jest.ProjectConfig;
|
||||
readonly tsJest: TsJestConfig;
|
||||
readonly typescript: ParsedCommandLine;
|
||||
readonly tsconfig: any;
|
||||
readonly versions: Record<string, string>;
|
||||
private static loadConfig;
|
||||
readonly babel: BabelConfig | undefined;
|
||||
readonly compilerModule: TTypeScript;
|
||||
readonly babelJestTransformer: BabelJestTransformer | undefined;
|
||||
readonly tsCompiler: TsCompiler;
|
||||
readonly astTransformers: AstTransformerDesc[];
|
||||
readonly tsCustomTransformers: CustomTransformers;
|
||||
readonly hooks: TsJestHooksMap;
|
||||
readonly shouldReportDiagnostic: (filePath: string) => boolean;
|
||||
readonly shouldStringifyContent: (filePath: string) => boolean;
|
||||
readonly tsCacheDir: string | undefined;
|
||||
readonly overriddenCompilerOptions: Partial<CompilerOptions>;
|
||||
readonly rootDir: string;
|
||||
readonly cwd: string;
|
||||
readonly tsJestDigest: string;
|
||||
readonly cacheKey: string;
|
||||
readonly logger: Logger;
|
||||
constructor(jestConfig: jest.ProjectConfig, parentOptions?: TsJestGlobalOptions | undefined, parentLogger?: Logger);
|
||||
resolvePath(inputPath: string, { throwIfMissing, nodeResolve }?: {
|
||||
throwIfMissing?: boolean;
|
||||
nodeResolve?: boolean;
|
||||
}): string;
|
||||
}
|
794
node_modules/ts-jest/dist/config/config-set.js
generated
vendored
Normal file
794
node_modules/ts-jest/dist/config/config-set.js
generated
vendored
Normal file
|
@ -0,0 +1,794 @@
|
|||
"use strict";
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __values = (this && this.__values) || function(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
var __spread = (this && this.__spread) || function () {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var bs_logger_1 = require("bs-logger");
|
||||
var fs_1 = require("fs");
|
||||
var json5 = require("json5");
|
||||
var path_1 = require("path");
|
||||
var semver = require("semver");
|
||||
var __1 = require("..");
|
||||
var compiler_1 = require("../compiler");
|
||||
var transformers_1 = require("../transformers");
|
||||
var backports_1 = require("../util/backports");
|
||||
var get_package_version_1 = require("../util/get-package-version");
|
||||
var importer_1 = require("../util/importer");
|
||||
var json_1 = require("../util/json");
|
||||
var jsonable_value_1 = require("../util/jsonable-value");
|
||||
var logger_1 = require("../util/logger");
|
||||
var memoize_1 = require("../util/memoize");
|
||||
var messages_1 = require("../util/messages");
|
||||
var normalize_slashes_1 = require("../util/normalize-slashes");
|
||||
var sha1_1 = require("../util/sha1");
|
||||
var ts_error_1 = require("../util/ts-error");
|
||||
var logger = logger_1.rootLogger.child({ namespace: 'config' });
|
||||
exports.MATCH_NOTHING = /a^/;
|
||||
exports.IGNORE_DIAGNOSTIC_CODES = [
|
||||
6059,
|
||||
18002,
|
||||
18003,
|
||||
];
|
||||
var DiagnosticCodes;
|
||||
(function (DiagnosticCodes) {
|
||||
DiagnosticCodes[DiagnosticCodes["TsJest"] = 151000] = "TsJest";
|
||||
DiagnosticCodes[DiagnosticCodes["ConfigModuleOption"] = 151001] = "ConfigModuleOption";
|
||||
})(DiagnosticCodes = exports.DiagnosticCodes || (exports.DiagnosticCodes = {}));
|
||||
var normalizeRegex = function (pattern) {
|
||||
return pattern ? (typeof pattern === 'string' ? pattern : pattern.source) : undefined;
|
||||
};
|
||||
var toDiagnosticCode = function (code) {
|
||||
return code ? parseInt(("" + code).trim().replace(/^TS/, ''), 10) || undefined : undefined;
|
||||
};
|
||||
var toDiagnosticCodeList = function (items, into) {
|
||||
var e_1, _a;
|
||||
if (into === void 0) { into = []; }
|
||||
if (!Array.isArray(items))
|
||||
items = [items];
|
||||
try {
|
||||
for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {
|
||||
var item = items_1_1.value;
|
||||
if (!item)
|
||||
continue;
|
||||
if (Array.isArray(item)) {
|
||||
toDiagnosticCodeList(item, into);
|
||||
continue;
|
||||
}
|
||||
else if (typeof item === 'string') {
|
||||
var children = item.trim().split(/\s*,\s*/g);
|
||||
if (children.length > 1) {
|
||||
toDiagnosticCodeList(children, into);
|
||||
continue;
|
||||
}
|
||||
item = children[0];
|
||||
}
|
||||
if (!item)
|
||||
continue;
|
||||
var code = toDiagnosticCode(item);
|
||||
if (code && !into.includes(code))
|
||||
into.push(code);
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
return into;
|
||||
};
|
||||
var ConfigSet = (function () {
|
||||
function ConfigSet(jestConfig, parentOptions, parentLogger) {
|
||||
var _a;
|
||||
this.parentOptions = parentOptions;
|
||||
this._jestConfig = jestConfig;
|
||||
this.logger = parentLogger ? parentLogger.child((_a = {}, _a[bs_logger_1.LogContexts.namespace] = 'config', _a)) : logger;
|
||||
}
|
||||
Object.defineProperty(ConfigSet.prototype, "projectPackageJson", {
|
||||
get: function () {
|
||||
var packageJson = this.tsJest.packageJson;
|
||||
if (packageJson && packageJson.kind === 'inline') {
|
||||
return packageJson.value;
|
||||
}
|
||||
if (packageJson && packageJson.kind === 'file' && packageJson.value) {
|
||||
var path = this.resolvePath(packageJson.value);
|
||||
if (fs_1.existsSync(path)) {
|
||||
return require(path);
|
||||
}
|
||||
this.logger.warn(messages_1.Errors.UnableToFindProjectRoot);
|
||||
return {};
|
||||
}
|
||||
var tsJestRoot = path_1.resolve(__dirname, '..', '..');
|
||||
var pkgPath = path_1.resolve(tsJestRoot, '..', '..', 'package.json');
|
||||
if (fs_1.existsSync(pkgPath)) {
|
||||
return require(pkgPath);
|
||||
}
|
||||
if (fs_1.realpathSync(this.rootDir) === fs_1.realpathSync(tsJestRoot)) {
|
||||
pkgPath = path_1.resolve(tsJestRoot, 'package.json');
|
||||
if (fs_1.existsSync(pkgPath)) {
|
||||
return require(pkgPath);
|
||||
}
|
||||
}
|
||||
this.logger.warn(messages_1.Errors.UnableToFindProjectRoot);
|
||||
return {};
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "projectDependencies", {
|
||||
get: function () {
|
||||
var pkg = this.projectPackageJson;
|
||||
var names = Object.keys(__assign(__assign(__assign(__assign({}, pkg.optionalDependencies), pkg.peerDependencies), pkg.devDependencies), pkg.dependencies));
|
||||
return names.reduce(function (map, name) {
|
||||
var version = get_package_version_1.getPackageVersion(name);
|
||||
if (version)
|
||||
map[name] = version;
|
||||
return map;
|
||||
}, {});
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "jest", {
|
||||
get: function () {
|
||||
var config = backports_1.backportJestConfig(this.logger, this._jestConfig);
|
||||
if (this.parentOptions) {
|
||||
var globals = config.globals || (config.globals = {});
|
||||
globals['ts-jest'] = __assign(__assign({}, this.parentOptions), globals['ts-jest']);
|
||||
}
|
||||
this.logger.debug({ jestConfig: config }, 'normalized jest config');
|
||||
return config;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "tsJest", {
|
||||
get: function () {
|
||||
var _this = this;
|
||||
var parsedConfig = this.jest;
|
||||
var _a = parsedConfig.globals, globals = _a === void 0 ? {} : _a;
|
||||
var options = __assign({}, globals['ts-jest']);
|
||||
var tsConfigOpt = options.tsConfig;
|
||||
var tsConfig;
|
||||
if (typeof tsConfigOpt === 'string' || tsConfigOpt == null || tsConfigOpt === true) {
|
||||
tsConfig = {
|
||||
kind: 'file',
|
||||
value: typeof tsConfigOpt === 'string' ? this.resolvePath(tsConfigOpt) : undefined,
|
||||
};
|
||||
}
|
||||
else if (typeof tsConfigOpt === 'object') {
|
||||
tsConfig = {
|
||||
kind: 'inline',
|
||||
value: tsConfigOpt,
|
||||
};
|
||||
}
|
||||
var packageJsonOpt = options.packageJson;
|
||||
var packageJson;
|
||||
if (typeof packageJsonOpt === 'string' || packageJsonOpt == null || packageJsonOpt === true) {
|
||||
packageJson = {
|
||||
kind: 'file',
|
||||
value: typeof packageJsonOpt === 'string' ? this.resolvePath(packageJsonOpt) : undefined,
|
||||
};
|
||||
}
|
||||
else if (typeof packageJsonOpt === 'object') {
|
||||
packageJson = {
|
||||
kind: 'inline',
|
||||
value: packageJsonOpt,
|
||||
};
|
||||
}
|
||||
var transformers = (options.astTransformers || []).map(function (mod) { return _this.resolvePath(mod, { nodeResolve: true }); });
|
||||
var babelConfigOpt = options.babelConfig;
|
||||
var babelConfig;
|
||||
if (typeof babelConfigOpt === 'string' || babelConfigOpt === true) {
|
||||
babelConfig = {
|
||||
kind: 'file',
|
||||
value: babelConfigOpt === true ? undefined : this.resolvePath(babelConfigOpt),
|
||||
};
|
||||
}
|
||||
else if (babelConfigOpt) {
|
||||
babelConfig = {
|
||||
kind: 'inline',
|
||||
value: babelConfigOpt,
|
||||
};
|
||||
}
|
||||
var diagnostics;
|
||||
var _b = options.diagnostics, diagnosticsOpt = _b === void 0 ? true : _b;
|
||||
var ignoreList = [exports.IGNORE_DIAGNOSTIC_CODES, process.env.TS_JEST_IGNORE_DIAGNOSTICS];
|
||||
if (diagnosticsOpt === true || diagnosticsOpt == null) {
|
||||
diagnostics = { ignoreCodes: [], pretty: true, throws: true };
|
||||
}
|
||||
else if (diagnosticsOpt === false) {
|
||||
diagnostics = {
|
||||
throws: false,
|
||||
pretty: true,
|
||||
ignoreCodes: [],
|
||||
pathRegex: exports.MATCH_NOTHING.source,
|
||||
};
|
||||
}
|
||||
else {
|
||||
ignoreList.push(diagnosticsOpt.ignoreCodes);
|
||||
diagnostics = {
|
||||
pretty: diagnosticsOpt.pretty == null ? true : !!diagnosticsOpt.pretty,
|
||||
ignoreCodes: [],
|
||||
pathRegex: normalizeRegex(diagnosticsOpt.pathRegex),
|
||||
throws: !diagnosticsOpt.warnOnly,
|
||||
};
|
||||
}
|
||||
diagnostics.ignoreCodes = toDiagnosticCodeList(ignoreList);
|
||||
var stringifyContentPathRegex = normalizeRegex(options.stringifyContentPathRegex);
|
||||
var res = {
|
||||
tsConfig: tsConfig,
|
||||
packageJson: packageJson,
|
||||
babelConfig: babelConfig,
|
||||
diagnostics: diagnostics,
|
||||
isolatedModules: !!options.isolatedModules,
|
||||
compiler: options.compiler || 'typescript',
|
||||
transformers: transformers,
|
||||
stringifyContentPathRegex: stringifyContentPathRegex,
|
||||
};
|
||||
this.logger.debug({ tsJestConfig: res }, 'normalized ts-jest config');
|
||||
return res;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "typescript", {
|
||||
get: function () {
|
||||
return this._typescript.resolved;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "tsconfig", {
|
||||
get: function () {
|
||||
return this._typescript.input;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "versions", {
|
||||
get: function () {
|
||||
var modules = ['jest', this.tsJest.compiler];
|
||||
if (this.tsJest.babelConfig) {
|
||||
modules.push('@babel/core', 'babel-jest');
|
||||
}
|
||||
return modules.reduce(function (map, name) {
|
||||
map[name] = get_package_version_1.getPackageVersion(name) || '-';
|
||||
return map;
|
||||
}, { 'ts-jest': __1.version });
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "_typescript", {
|
||||
get: function () {
|
||||
var tsConfig = this.tsJest.tsConfig;
|
||||
var configFilePath = tsConfig && tsConfig.kind === 'file' ? tsConfig.value : undefined;
|
||||
var result = this.readTsConfig(tsConfig && tsConfig.kind === 'inline' ? tsConfig.value : undefined, configFilePath, tsConfig == null);
|
||||
this.raiseDiagnostics(result.resolved.errors, configFilePath);
|
||||
this.logger.debug({ tsconfig: result }, 'normalized typescript config');
|
||||
return result;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "raiseDiagnostics", {
|
||||
get: function () {
|
||||
var _this = this;
|
||||
var _a = this, createTsError = _a.createTsError, filterDiagnostics = _a.filterDiagnostics, throws = _a.tsJest.diagnostics.throws, DiagnosticCategory = _a.compilerModule.DiagnosticCategory;
|
||||
return function (diagnostics, filePath, logger) {
|
||||
if (logger === void 0) { logger = _this.logger; }
|
||||
var filteredDiagnostics = filterDiagnostics(diagnostics, filePath);
|
||||
if (filteredDiagnostics.length === 0)
|
||||
return;
|
||||
var error = createTsError(filteredDiagnostics);
|
||||
var importantCategories = [DiagnosticCategory.Warning, DiagnosticCategory.Error];
|
||||
if (throws && filteredDiagnostics.some(function (d) { return importantCategories.includes(d.category); })) {
|
||||
throw error;
|
||||
}
|
||||
logger.warn({ error: error }, error.message);
|
||||
};
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
ConfigSet.loadConfig = function (base) {
|
||||
var _a = importer_1.importer.babelCore(messages_1.ImportReasons.BabelJest), OptionManager = _a.OptionManager, loadPartialConfig = _a.loadPartialConfig, version = _a.version;
|
||||
if (version && semver.satisfies(version, '>=6 <7')) {
|
||||
delete base.cwd;
|
||||
}
|
||||
if (typeof loadPartialConfig === 'function') {
|
||||
var partialConfig = loadPartialConfig(base);
|
||||
if (partialConfig) {
|
||||
return partialConfig.options;
|
||||
}
|
||||
}
|
||||
return new OptionManager().init(base);
|
||||
};
|
||||
Object.defineProperty(ConfigSet.prototype, "babel", {
|
||||
get: function () {
|
||||
var babelConfig = this.tsJest.babelConfig;
|
||||
if (babelConfig == null) {
|
||||
this.logger.debug('babel is disabled');
|
||||
return;
|
||||
}
|
||||
var base = { cwd: this.cwd };
|
||||
if (babelConfig.kind === 'file') {
|
||||
if (babelConfig.value) {
|
||||
base = __assign(__assign({}, base), json5.parse(fs_1.readFileSync(babelConfig.value, 'utf8')));
|
||||
}
|
||||
}
|
||||
else if (babelConfig.kind === 'inline') {
|
||||
base = __assign(__assign({}, base), babelConfig.value);
|
||||
}
|
||||
var config = ConfigSet.loadConfig(base);
|
||||
this.logger.debug({ babelConfig: config }, 'normalized babel config');
|
||||
return config;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "compilerModule", {
|
||||
get: function () {
|
||||
return importer_1.importer.typescript(messages_1.ImportReasons.TsJest, this.tsJest.compiler);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "babelJestTransformer", {
|
||||
get: function () {
|
||||
var babel = this.babel;
|
||||
if (!babel)
|
||||
return;
|
||||
this.logger.debug('creating babel-jest transformer');
|
||||
return importer_1.importer.babelJest(messages_1.ImportReasons.BabelJest).createTransformer(babel);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "tsCompiler", {
|
||||
get: function () {
|
||||
return compiler_1.createCompiler(this);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "astTransformers", {
|
||||
get: function () {
|
||||
return __spread(transformers_1.internals, this.tsJest.transformers.map(function (m) { return require(m); }));
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "tsCustomTransformers", {
|
||||
get: function () {
|
||||
var _this = this;
|
||||
return {
|
||||
before: this.astTransformers.map(function (t) { return t.factory(_this); }),
|
||||
};
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "hooks", {
|
||||
get: function () {
|
||||
var hooksFile = process.env.TS_JEST_HOOKS;
|
||||
if (hooksFile) {
|
||||
hooksFile = path_1.resolve(this.cwd, hooksFile);
|
||||
return importer_1.importer.tryTheseOr(hooksFile, {});
|
||||
}
|
||||
return {};
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "filterDiagnostics", {
|
||||
get: function () {
|
||||
var _a = this, ignoreCodes = _a.tsJest.diagnostics.ignoreCodes, shouldReportDiagnostic = _a.shouldReportDiagnostic;
|
||||
return function (diagnostics, filePath) {
|
||||
if (filePath && !shouldReportDiagnostic(filePath))
|
||||
return [];
|
||||
return diagnostics.filter(function (diagnostic) {
|
||||
if (diagnostic.file && diagnostic.file.fileName && !shouldReportDiagnostic(diagnostic.file.fileName)) {
|
||||
return false;
|
||||
}
|
||||
return ignoreCodes.indexOf(diagnostic.code) === -1;
|
||||
});
|
||||
};
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "shouldReportDiagnostic", {
|
||||
get: function () {
|
||||
var pathRegex = this.tsJest.diagnostics.pathRegex;
|
||||
if (pathRegex) {
|
||||
var regex_1 = new RegExp(pathRegex);
|
||||
return function (file) { return regex_1.test(file); };
|
||||
}
|
||||
else {
|
||||
return function () { return true; };
|
||||
}
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "shouldStringifyContent", {
|
||||
get: function () {
|
||||
var stringifyContentPathRegex = this.tsJest.stringifyContentPathRegex;
|
||||
if (stringifyContentPathRegex) {
|
||||
var regex_2 = new RegExp(stringifyContentPathRegex);
|
||||
return function (file) { return regex_2.test(file); };
|
||||
}
|
||||
else {
|
||||
return function () { return false; };
|
||||
}
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "createTsError", {
|
||||
get: function () {
|
||||
var _this = this;
|
||||
var pretty = this.tsJest.diagnostics.pretty;
|
||||
var formatDiagnostics = pretty
|
||||
? this.compilerModule.formatDiagnosticsWithColorAndContext
|
||||
: this.compilerModule.formatDiagnostics;
|
||||
var diagnosticHost = {
|
||||
getNewLine: function () { return '\n'; },
|
||||
getCurrentDirectory: function () { return _this.cwd; },
|
||||
getCanonicalFileName: function (path) { return path; },
|
||||
};
|
||||
return function (diagnostics) {
|
||||
var diagnosticText = formatDiagnostics(diagnostics, diagnosticHost);
|
||||
var diagnosticCodes = diagnostics.map(function (x) { return x.code; });
|
||||
return new ts_error_1.TSError(diagnosticText, diagnosticCodes);
|
||||
};
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "tsCacheDir", {
|
||||
get: function () {
|
||||
if (!this.jest.cache) {
|
||||
logger.debug('file caching disabled');
|
||||
return;
|
||||
}
|
||||
var cacheSuffix = sha1_1.sha1(json_1.stringify({
|
||||
version: this.compilerModule.version,
|
||||
digest: this.tsJestDigest,
|
||||
dependencies: this.projectDependencies,
|
||||
compiler: this.tsJest.compiler,
|
||||
compilerOptions: this.typescript.options,
|
||||
isolatedModules: this.tsJest.isolatedModules,
|
||||
diagnostics: this.tsJest.diagnostics,
|
||||
}));
|
||||
var res = path_1.join(this.jest.cacheDirectory, 'ts-jest', cacheSuffix.substr(0, 2), cacheSuffix.substr(2));
|
||||
logger.debug({ cacheDirectory: res }, 'will use file caching');
|
||||
return res;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "overriddenCompilerOptions", {
|
||||
get: function () {
|
||||
var options = {
|
||||
sourceMap: true,
|
||||
inlineSourceMap: false,
|
||||
inlineSources: true,
|
||||
declaration: false,
|
||||
noEmit: false,
|
||||
outDir: '$$ts-jest$$',
|
||||
removeComments: false,
|
||||
out: undefined,
|
||||
outFile: undefined,
|
||||
composite: undefined,
|
||||
declarationDir: undefined,
|
||||
declarationMap: undefined,
|
||||
emitDeclarationOnly: undefined,
|
||||
incremental: undefined,
|
||||
sourceRoot: undefined,
|
||||
tsBuildInfoFile: undefined,
|
||||
};
|
||||
if (!this.tsJest.babelConfig) {
|
||||
options.module = this.compilerModule.ModuleKind.CommonJS;
|
||||
}
|
||||
return options;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "rootDir", {
|
||||
get: function () {
|
||||
return path_1.normalize(this.jest.rootDir || this.cwd);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "cwd", {
|
||||
get: function () {
|
||||
return path_1.normalize(this.jest.cwd || process.cwd());
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "isDoctoring", {
|
||||
get: function () {
|
||||
return !!process.env.TS_JEST_DOCTOR;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "tsJestDigest", {
|
||||
get: function () {
|
||||
return __1.digest;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "jsonValue", {
|
||||
get: function () {
|
||||
var jest = __assign({}, this.jest);
|
||||
var globals = (jest.globals = __assign({}, jest.globals));
|
||||
delete jest.name;
|
||||
delete jest.cacheDirectory;
|
||||
delete globals['ts-jest'];
|
||||
return new jsonable_value_1.JsonableValue({
|
||||
versions: this.versions,
|
||||
projectDepVersions: this.projectDependencies,
|
||||
digest: this.tsJestDigest,
|
||||
transformers: this.astTransformers.map(function (t) { return t.name + "@" + t.version; }),
|
||||
jest: jest,
|
||||
tsJest: this.tsJest,
|
||||
babel: this.babel,
|
||||
tsconfig: this.typescript.options,
|
||||
});
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ConfigSet.prototype, "cacheKey", {
|
||||
get: function () {
|
||||
return this.jsonValue.serialized;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
ConfigSet.prototype.makeDiagnostic = function (code, messageText, options) {
|
||||
if (options === void 0) { options = {}; }
|
||||
var _a = options.category, category = _a === void 0 ? this.compilerModule.DiagnosticCategory.Warning : _a, file = options.file, start = options.start, length = options.length;
|
||||
return {
|
||||
code: code,
|
||||
messageText: messageText,
|
||||
category: category,
|
||||
file: file,
|
||||
start: start,
|
||||
length: length,
|
||||
};
|
||||
};
|
||||
ConfigSet.prototype.readTsConfig = function (compilerOptions, resolvedConfigFile, noProject) {
|
||||
var e_2, _a;
|
||||
var config = { compilerOptions: {} };
|
||||
var basePath = normalize_slashes_1.normalizeSlashes(this.rootDir);
|
||||
var configFileName;
|
||||
var ts = this.compilerModule;
|
||||
var input;
|
||||
if (noProject) {
|
||||
input = { compilerOptions: __assign({}, compilerOptions) };
|
||||
}
|
||||
else {
|
||||
configFileName = resolvedConfigFile
|
||||
? normalize_slashes_1.normalizeSlashes(resolvedConfigFile)
|
||||
: ts.findConfigFile(normalize_slashes_1.normalizeSlashes(this.rootDir), ts.sys.fileExists);
|
||||
if (configFileName) {
|
||||
this.logger.debug({ tsConfigFileName: configFileName }, 'readTsConfig(): reading', configFileName);
|
||||
var result_1 = ts.readConfigFile(configFileName, ts.sys.readFile);
|
||||
if (result_1.error) {
|
||||
return {
|
||||
resolved: { errors: [result_1.error], fileNames: [], options: {} },
|
||||
};
|
||||
}
|
||||
config = result_1.config;
|
||||
input = __assign(__assign({}, result_1.config), { compilerOptions: __assign(__assign({}, (result_1.config && result_1.config.compilerOptions)), compilerOptions) });
|
||||
basePath = normalize_slashes_1.normalizeSlashes(path_1.dirname(configFileName));
|
||||
}
|
||||
}
|
||||
config.compilerOptions = __assign(__assign({}, config.compilerOptions), compilerOptions);
|
||||
var result = ts.parseJsonConfigFileContent(config, ts.sys, basePath, undefined, configFileName);
|
||||
var forcedOptions = this.overriddenCompilerOptions;
|
||||
var finalOptions = result.options;
|
||||
if (finalOptions.target === undefined) {
|
||||
finalOptions.target = ts.ScriptTarget.ES5;
|
||||
}
|
||||
var target = finalOptions.target;
|
||||
var defaultModule = [ts.ScriptTarget.ES3, ts.ScriptTarget.ES5].includes(target)
|
||||
? ts.ModuleKind.CommonJS
|
||||
: ts.ModuleKind.ESNext;
|
||||
var moduleValue = finalOptions.module == null ? defaultModule : finalOptions.module;
|
||||
if ('module' in forcedOptions &&
|
||||
moduleValue !== forcedOptions.module &&
|
||||
!(finalOptions.esModuleInterop || finalOptions.allowSyntheticDefaultImports)) {
|
||||
result.errors.push(this.makeDiagnostic(DiagnosticCodes.ConfigModuleOption, messages_1.Errors.ConfigNoModuleInterop, {
|
||||
category: ts.DiagnosticCategory.Message,
|
||||
}));
|
||||
if (!('allowSyntheticDefaultImports' in config.compilerOptions)) {
|
||||
finalOptions.allowSyntheticDefaultImports = true;
|
||||
}
|
||||
}
|
||||
try {
|
||||
for (var _b = __values(Object.keys(forcedOptions)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||
var key = _c.value;
|
||||
var val = forcedOptions[key];
|
||||
if (val === undefined) {
|
||||
delete finalOptions[key];
|
||||
}
|
||||
else {
|
||||
finalOptions[key] = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
||||
}
|
||||
finally { if (e_2) throw e_2.error; }
|
||||
}
|
||||
return { input: input, resolved: result };
|
||||
};
|
||||
ConfigSet.prototype.resolvePath = function (inputPath, _a) {
|
||||
var _b = _a === void 0 ? {} : _a, _c = _b.throwIfMissing, throwIfMissing = _c === void 0 ? true : _c, _d = _b.nodeResolve, nodeResolve = _d === void 0 ? false : _d;
|
||||
var path = inputPath;
|
||||
var nodeResolved = false;
|
||||
if (path.startsWith('<rootDir>')) {
|
||||
path = path_1.resolve(path_1.join(this.rootDir, path.substr(9)));
|
||||
}
|
||||
else if (!path_1.isAbsolute(path)) {
|
||||
if (!path.startsWith('.') && nodeResolve) {
|
||||
try {
|
||||
path = require.resolve(path);
|
||||
nodeResolved = true;
|
||||
}
|
||||
catch (_) { }
|
||||
}
|
||||
if (!nodeResolved) {
|
||||
path = path_1.resolve(this.cwd, path);
|
||||
}
|
||||
}
|
||||
if (!nodeResolved && nodeResolve) {
|
||||
try {
|
||||
path = require.resolve(path);
|
||||
nodeResolved = true;
|
||||
}
|
||||
catch (_) { }
|
||||
}
|
||||
if (throwIfMissing && !fs_1.existsSync(path)) {
|
||||
throw new Error(messages_1.interpolate(messages_1.Errors.FileNotFound, { inputPath: inputPath, resolvedPath: path }));
|
||||
}
|
||||
this.logger.debug({ fromPath: inputPath, toPath: path }, 'resolved path from', inputPath, 'to', path);
|
||||
return path;
|
||||
};
|
||||
ConfigSet.prototype.toJSON = function () {
|
||||
return this.jsonValue.value;
|
||||
};
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "projectPackageJson", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "projectDependencies", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "jest", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "tsJest", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "versions", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "_typescript", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "raiseDiagnostics", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "babel", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "compilerModule", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "babelJestTransformer", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "tsCompiler", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "astTransformers", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "tsCustomTransformers", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "hooks", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "filterDiagnostics", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "shouldReportDiagnostic", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "shouldStringifyContent", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "createTsError", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "tsCacheDir", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "overriddenCompilerOptions", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "rootDir", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "cwd", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "tsJestDigest", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], ConfigSet.prototype, "jsonValue", null);
|
||||
return ConfigSet;
|
||||
}());
|
||||
exports.ConfigSet = ConfigSet;
|
10
node_modules/ts-jest/dist/config/create-jest-preset.d.ts
generated
vendored
Normal file
10
node_modules/ts-jest/dist/config/create-jest-preset.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
/// <reference types="jest" />
|
||||
export interface TsJestPresets {
|
||||
transform: Record<string, string>;
|
||||
testMatch?: string[];
|
||||
moduleFileExtensions?: string[];
|
||||
}
|
||||
export interface CreateJestPresetOptions {
|
||||
allowJs?: boolean;
|
||||
}
|
||||
export declare function createJestPreset({ allowJs }?: CreateJestPresetOptions, from?: jest.InitialOptions): TsJestPresets;
|
23
node_modules/ts-jest/dist/config/create-jest-preset.js
generated
vendored
Normal file
23
node_modules/ts-jest/dist/config/create-jest-preset.js
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
"use strict";
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var logger_1 = require("../util/logger");
|
||||
var logger = logger_1.rootLogger.child({ namespace: 'jest-preset' });
|
||||
function createJestPreset(_a, from) {
|
||||
var _b;
|
||||
var _c = (_a === void 0 ? {} : _a).allowJs, allowJs = _c === void 0 ? false : _c;
|
||||
if (from === void 0) { from = {}; }
|
||||
logger.debug({ allowJs: allowJs }, 'creating jest presets', allowJs ? 'handling' : 'not handling', 'JavaScript files');
|
||||
return __assign(__assign({ transform: __assign(__assign({}, from.transform), (_b = {}, _b[allowJs ? '^.+\\.[tj]sx?$' : '^.+\\.tsx?$'] = 'ts-jest', _b)) }, (from.testMatch ? { testMatch: from.testMatch } : undefined)), (from.moduleFileExtensions ? { moduleFileExtensions: from.moduleFileExtensions } : undefined));
|
||||
}
|
||||
exports.createJestPreset = createJestPreset;
|
5
node_modules/ts-jest/dist/config/paths-to-module-name-mapper.d.ts
generated
vendored
Normal file
5
node_modules/ts-jest/dist/config/paths-to-module-name-mapper.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
export declare const pathsToModuleNameMapper: (mapping: import("typescript").MapLike<string[]>, { prefix }?: {
|
||||
prefix?: string | undefined;
|
||||
}) => {
|
||||
[key: string]: string;
|
||||
} | undefined;
|
63
node_modules/ts-jest/dist/config/paths-to-module-name-mapper.js
generated
vendored
Normal file
63
node_modules/ts-jest/dist/config/paths-to-module-name-mapper.js
generated
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
"use strict";
|
||||
var __values = (this && this.__values) || function(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var bs_logger_1 = require("bs-logger");
|
||||
var logger_1 = require("../util/logger");
|
||||
var messages_1 = require("../util/messages");
|
||||
var escapeRegex = function (str) { return str.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&'); };
|
||||
var logger = logger_1.rootLogger.child((_a = {}, _a[bs_logger_1.LogContexts.namespace] = 'path-mapper', _a));
|
||||
exports.pathsToModuleNameMapper = function (mapping, _a) {
|
||||
var e_1, _b;
|
||||
var _c = (_a === void 0 ? {} : _a).prefix, prefix = _c === void 0 ? '' : _c;
|
||||
var jestMap = {};
|
||||
try {
|
||||
for (var _d = __values(Object.keys(mapping)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
||||
var fromPath = _e.value;
|
||||
var pattern = void 0;
|
||||
var toPaths = mapping[fromPath];
|
||||
if (toPaths.length === 0) {
|
||||
logger.warn(messages_1.interpolate(messages_1.Errors.NotMappingPathWithEmptyMap, { path: fromPath }));
|
||||
continue;
|
||||
}
|
||||
else if (toPaths.length > 1) {
|
||||
logger.warn(messages_1.interpolate(messages_1.Errors.MappingOnlyFirstTargetOfPath, {
|
||||
path: fromPath,
|
||||
count: toPaths.length,
|
||||
}));
|
||||
}
|
||||
var target = toPaths[0];
|
||||
var segments = fromPath.split(/\*/g);
|
||||
if (segments.length === 1) {
|
||||
pattern = "^" + escapeRegex(fromPath) + "$";
|
||||
jestMap[pattern] = "" + prefix + target;
|
||||
}
|
||||
else if (segments.length === 2) {
|
||||
pattern = "^" + escapeRegex(segments[0]) + "(.*)" + escapeRegex(segments[1]) + "$";
|
||||
jestMap[pattern] = "" + prefix + target.replace(/\*/g, '$1');
|
||||
}
|
||||
else {
|
||||
logger.warn(messages_1.interpolate(messages_1.Errors.NotMappingMultiStarPath, { path: fromPath }));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
return jestMap;
|
||||
};
|
16
node_modules/ts-jest/dist/index.d.ts
generated
vendored
Normal file
16
node_modules/ts-jest/dist/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
import { createJestPreset as createJestPresetCore } from './config/create-jest-preset';
|
||||
import { TsJestTransformer } from './ts-jest-transformer';
|
||||
import { TsJestGlobalOptions } from './types';
|
||||
import { mocked as mockedCore } from './util/testing';
|
||||
export declare const mocked: typeof mockedCore;
|
||||
export declare const createJestPreset: typeof createJestPresetCore;
|
||||
export declare const pathsToModuleNameMapper: (mapping: import("typescript").MapLike<string[]>, { prefix }?: {
|
||||
prefix?: string | undefined;
|
||||
}) => {
|
||||
[key: string]: string;
|
||||
} | undefined;
|
||||
export declare const version: string;
|
||||
export declare const digest: string;
|
||||
export declare function createTransformer(baseConfig?: TsJestGlobalOptions): TsJestTransformer;
|
||||
declare const jestPreset: import("./config/create-jest-preset").TsJestPresets;
|
||||
export { jestPreset, };
|
74
node_modules/ts-jest/dist/index.js
generated
vendored
Normal file
74
node_modules/ts-jest/dist/index.js
generated
vendored
Normal file
|
@ -0,0 +1,74 @@
|
|||
"use strict";
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
var __spread = (this && this.__spread) || function () {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
};
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var bs_logger_1 = require("bs-logger");
|
||||
var fs_1 = require("fs");
|
||||
var path_1 = require("path");
|
||||
var create_jest_preset_1 = require("./config/create-jest-preset");
|
||||
var paths_to_module_name_mapper_1 = require("./config/paths-to-module-name-mapper");
|
||||
var ts_jest_transformer_1 = require("./ts-jest-transformer");
|
||||
var logger_1 = require("./util/logger");
|
||||
var messages_1 = require("./util/messages");
|
||||
var testing_1 = require("./util/testing");
|
||||
var version_checkers_1 = require("./util/version-checkers");
|
||||
var warn = logger_1.rootLogger.child((_a = {}, _a[bs_logger_1.LogContexts.logLevel] = bs_logger_1.LogLevels.warn, _a));
|
||||
var helperMoved = function (name, helper) {
|
||||
return warn.wrap(messages_1.interpolate(messages_1.Deprecateds.HelperMovedToUtils, { helper: name }), helper);
|
||||
};
|
||||
exports.mocked = helperMoved('mocked', testing_1.mocked);
|
||||
exports.createJestPreset = helperMoved('createJestPreset', create_jest_preset_1.createJestPreset);
|
||||
exports.pathsToModuleNameMapper = helperMoved('pathsToModuleNameMapper', paths_to_module_name_mapper_1.pathsToModuleNameMapper);
|
||||
exports.version = require('../package.json').version;
|
||||
exports.digest = fs_1.readFileSync(path_1.resolve(__dirname, '..', '.ts-jest-digest'), 'utf8');
|
||||
var transformer;
|
||||
function defaultTransformer() {
|
||||
return transformer || (transformer = createTransformer());
|
||||
}
|
||||
function createTransformer(baseConfig) {
|
||||
version_checkers_1.VersionCheckers.jest.warn();
|
||||
return new ts_jest_transformer_1.TsJestTransformer(baseConfig);
|
||||
}
|
||||
exports.createTransformer = createTransformer;
|
||||
function process() {
|
||||
var _a;
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
return (_a = defaultTransformer()).process.apply(_a, __spread(args));
|
||||
}
|
||||
exports.process = process;
|
||||
function getCacheKey() {
|
||||
var _a;
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
return (_a = defaultTransformer()).getCacheKey.apply(_a, __spread(args));
|
||||
}
|
||||
exports.getCacheKey = getCacheKey;
|
||||
exports.canInstrument = false;
|
||||
var jestPreset = create_jest_preset_1.createJestPreset();
|
||||
exports.jestPreset = jestPreset;
|
||||
exports.__singleton = function () { return transformer; };
|
||||
exports.__resetModule = function () { return (transformer = undefined); };
|
1
node_modules/ts-jest/dist/transformers/hoist-jest.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/transformers/hoist-jest.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
80
node_modules/ts-jest/dist/transformers/hoist-jest.js
generated
vendored
Normal file
80
node_modules/ts-jest/dist/transformers/hoist-jest.js
generated
vendored
Normal file
|
@ -0,0 +1,80 @@
|
|||
"use strict";
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
var __spread = (this && this.__spread) || function () {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var bs_logger_1 = require("bs-logger");
|
||||
var HOIST_METHODS = ['mock', 'unmock'];
|
||||
exports.name = 'hoisting-jest-mock';
|
||||
exports.version = 1;
|
||||
function factory(cs) {
|
||||
var logger = cs.logger.child({ namespace: 'ts-hoisting' });
|
||||
var ts = cs.compilerModule;
|
||||
function shouldHoistNode(node) {
|
||||
return (ts.isExpressionStatement(node) &&
|
||||
ts.isCallExpression(node.expression) &&
|
||||
ts.isPropertyAccessExpression(node.expression.expression) &&
|
||||
ts.isIdentifier(node.expression.expression.expression) &&
|
||||
node.expression.expression.expression.text === 'jest' &&
|
||||
ts.isIdentifier(node.expression.expression.name) &&
|
||||
HOIST_METHODS.includes(node.expression.expression.name.text));
|
||||
}
|
||||
function createVisitor(ctx, _) {
|
||||
var level = 0;
|
||||
var hoisted = [];
|
||||
var enter = function () {
|
||||
level++;
|
||||
if (hoisted[level]) {
|
||||
hoisted[level].splice(0, hoisted[level].length);
|
||||
}
|
||||
};
|
||||
var exit = function () { return level--; };
|
||||
var hoist = function (node) {
|
||||
if (hoisted[level]) {
|
||||
hoisted[level].push(node);
|
||||
}
|
||||
else {
|
||||
hoisted[level] = [node];
|
||||
}
|
||||
};
|
||||
var visitor = function (node) {
|
||||
enter();
|
||||
var resultNode = ts.visitEachChild(node, visitor, ctx);
|
||||
if (hoisted[level] && hoisted[level].length) {
|
||||
var hoistedStmts_1 = hoisted[level];
|
||||
var otherStmts = resultNode.statements.filter(function (s) { return !hoistedStmts_1.includes(s); });
|
||||
var newNode = ts.getMutableClone(resultNode);
|
||||
newNode.statements = ts.createNodeArray(__spread(hoistedStmts_1, otherStmts));
|
||||
resultNode = newNode;
|
||||
}
|
||||
exit();
|
||||
if (shouldHoistNode(resultNode)) {
|
||||
hoist(resultNode);
|
||||
}
|
||||
return resultNode;
|
||||
};
|
||||
return visitor;
|
||||
}
|
||||
return function (ctx) {
|
||||
var _a;
|
||||
return logger.wrap((_a = {}, _a[bs_logger_1.LogContexts.logLevel] = bs_logger_1.LogLevels.debug, _a.call = null, _a), 'visitSourceFileNode(): hoisting', function (sf) { return ts.visitNode(sf, createVisitor(ctx, sf)); });
|
||||
};
|
||||
}
|
||||
exports.factory = factory;
|
1
node_modules/ts-jest/dist/transformers/index.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/transformers/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
4
node_modules/ts-jest/dist/transformers/index.js
generated
vendored
Normal file
4
node_modules/ts-jest/dist/transformers/index.js
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var hoisting = require("./hoist-jest");
|
||||
exports.internals = [hoisting];
|
17
node_modules/ts-jest/dist/ts-jest-transformer.d.ts
generated
vendored
Normal file
17
node_modules/ts-jest/dist/ts-jest-transformer.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
/// <reference types="jest" />
|
||||
import { Logger } from 'bs-logger';
|
||||
import { ConfigSet } from './config/config-set';
|
||||
import { TsJestGlobalOptions } from './types';
|
||||
export declare class TsJestTransformer implements jest.Transformer {
|
||||
static readonly lastTransformerId: number;
|
||||
readonly logger: Logger;
|
||||
readonly id: number;
|
||||
readonly options: TsJestGlobalOptions;
|
||||
constructor(baseOptions?: TsJestGlobalOptions);
|
||||
configsFor(jestConfig: jest.ProjectConfig | string): ConfigSet;
|
||||
process(input: string, filePath: jest.Path, jestConfig: jest.ProjectConfig, transformOptions?: jest.TransformOptions): jest.TransformedSource | string;
|
||||
getCacheKey(fileContent: string, filePath: string, jestConfigStr: string, transformOptions?: {
|
||||
instrument?: boolean;
|
||||
rootDir?: string;
|
||||
}): string;
|
||||
}
|
132
node_modules/ts-jest/dist/ts-jest-transformer.js
generated
vendored
Normal file
132
node_modules/ts-jest/dist/ts-jest-transformer.js
generated
vendored
Normal file
|
@ -0,0 +1,132 @@
|
|||
"use strict";
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var util_1 = require("util");
|
||||
var config_set_1 = require("./config/config-set");
|
||||
var json_1 = require("./util/json");
|
||||
var jsonable_value_1 = require("./util/jsonable-value");
|
||||
var logger_1 = require("./util/logger");
|
||||
var messages_1 = require("./util/messages");
|
||||
var sha1_1 = require("./util/sha1");
|
||||
exports.INSPECT_CUSTOM = util_1.inspect.custom || 'inspect';
|
||||
var TsJestTransformer = (function () {
|
||||
function TsJestTransformer(baseOptions) {
|
||||
if (baseOptions === void 0) { baseOptions = {}; }
|
||||
this.options = __assign({}, baseOptions);
|
||||
this.id = TsJestTransformer._nextTransformerId;
|
||||
this.logger = logger_1.rootLogger.child({
|
||||
transformerId: this.id,
|
||||
namespace: 'jest-transformer',
|
||||
});
|
||||
this.logger.debug({ baseOptions: baseOptions }, 'created new transformer');
|
||||
}
|
||||
Object.defineProperty(TsJestTransformer, "lastTransformerId", {
|
||||
get: function () {
|
||||
return TsJestTransformer._lastTransformerId;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(TsJestTransformer, "_nextTransformerId", {
|
||||
get: function () {
|
||||
return ++TsJestTransformer._lastTransformerId;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
TsJestTransformer.prototype[exports.INSPECT_CUSTOM] = function () {
|
||||
return "[object TsJestTransformer<#" + this.id + ">]";
|
||||
};
|
||||
TsJestTransformer.prototype.configsFor = function (jestConfig) {
|
||||
var csi;
|
||||
var jestConfigObj;
|
||||
if (typeof jestConfig === 'string') {
|
||||
csi = TsJestTransformer._configSetsIndex.find(function (cs) { return cs.jestConfig.serialized === jestConfig; });
|
||||
if (csi)
|
||||
return csi.configSet;
|
||||
jestConfigObj = json_1.parse(jestConfig);
|
||||
}
|
||||
else {
|
||||
csi = TsJestTransformer._configSetsIndex.find(function (cs) { return cs.jestConfig.value === jestConfig; });
|
||||
if (csi)
|
||||
return csi.configSet;
|
||||
var serialized_1 = json_1.stringify(jestConfig);
|
||||
csi = TsJestTransformer._configSetsIndex.find(function (cs) { return cs.jestConfig.serialized === serialized_1; });
|
||||
if (csi) {
|
||||
csi.jestConfig.value = jestConfig;
|
||||
return csi.configSet;
|
||||
}
|
||||
jestConfigObj = jestConfig;
|
||||
}
|
||||
this.logger.info("no matching config-set found, creating a new one");
|
||||
var configSet = new config_set_1.ConfigSet(jestConfigObj, this.options, this.logger);
|
||||
TsJestTransformer._configSetsIndex.push({
|
||||
jestConfig: new jsonable_value_1.JsonableValue(jestConfigObj),
|
||||
configSet: configSet,
|
||||
});
|
||||
return configSet;
|
||||
};
|
||||
TsJestTransformer.prototype.process = function (input, filePath, jestConfig, transformOptions) {
|
||||
this.logger.debug({ fileName: filePath, transformOptions: transformOptions }, 'processing', filePath);
|
||||
var result;
|
||||
var source = input;
|
||||
var configs = this.configsFor(jestConfig);
|
||||
var hooks = configs.hooks;
|
||||
var stringify = configs.shouldStringifyContent(filePath);
|
||||
var babelJest = stringify ? undefined : configs.babelJestTransformer;
|
||||
var isDefinitionFile = filePath.endsWith('.d.ts');
|
||||
var isJsFile = !isDefinitionFile && /\.jsx?$/.test(filePath);
|
||||
var isTsFile = isDefinitionFile || /\.tsx?$/.test(filePath);
|
||||
if (stringify) {
|
||||
result = "module.exports=" + JSON.stringify(source);
|
||||
}
|
||||
else if (isDefinitionFile) {
|
||||
result = '';
|
||||
}
|
||||
else if (!configs.typescript.options.allowJs && isJsFile) {
|
||||
this.logger.warn({ fileName: filePath }, messages_1.interpolate(messages_1.Errors.GotJsFileButAllowJsFalse, { path: filePath }));
|
||||
result = source;
|
||||
}
|
||||
else if (isJsFile || isTsFile) {
|
||||
result = configs.tsCompiler.compile(source, filePath);
|
||||
}
|
||||
else {
|
||||
var message = babelJest ? messages_1.Errors.GotUnknownFileTypeWithBabel : messages_1.Errors.GotUnknownFileTypeWithoutBabel;
|
||||
this.logger.warn({ fileName: filePath }, messages_1.interpolate(message, { path: filePath }));
|
||||
result = source;
|
||||
}
|
||||
if (babelJest) {
|
||||
this.logger.debug({ fileName: filePath }, 'calling babel-jest processor');
|
||||
result = babelJest.process(result, filePath, jestConfig, __assign(__assign({}, transformOptions), { instrument: false }));
|
||||
}
|
||||
if (hooks.afterProcess) {
|
||||
this.logger.debug({ fileName: filePath, hookName: 'afterProcess' }, 'calling afterProcess hook');
|
||||
var newResult = hooks.afterProcess([input, filePath, jestConfig, transformOptions], result);
|
||||
if (newResult !== undefined) {
|
||||
return newResult;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
TsJestTransformer.prototype.getCacheKey = function (fileContent, filePath, jestConfigStr, transformOptions) {
|
||||
if (transformOptions === void 0) { transformOptions = {}; }
|
||||
this.logger.debug({ fileName: filePath, transformOptions: transformOptions }, 'computing cache key for', filePath);
|
||||
var configs = this.configsFor(jestConfigStr);
|
||||
var _a = transformOptions.instrument, instrument = _a === void 0 ? false : _a, _b = transformOptions.rootDir, rootDir = _b === void 0 ? configs.rootDir : _b;
|
||||
return sha1_1.sha1(configs.cacheKey, '\x00', rootDir, '\x00', "instrument:" + (instrument ? 'on' : 'off'), '\x00', fileContent, '\x00', filePath);
|
||||
};
|
||||
TsJestTransformer._configSetsIndex = [];
|
||||
TsJestTransformer._lastTransformerId = 0;
|
||||
return TsJestTransformer;
|
||||
}());
|
||||
exports.TsJestTransformer = TsJestTransformer;
|
113
node_modules/ts-jest/dist/types.d.ts
generated
vendored
Normal file
113
node_modules/ts-jest/dist/types.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,113 @@
|
|||
/// <reference types="jest" />
|
||||
import * as _babel from 'babel__core';
|
||||
import { CompilerOptions, SourceFile, TransformerFactory } from 'typescript';
|
||||
import * as _ts from 'typescript';
|
||||
import { ConfigSet } from './config/config-set';
|
||||
export declare type TBabelCore = typeof _babel;
|
||||
export declare type TTypeScript = typeof _ts;
|
||||
export declare type TBabelJest = Required<jest.Transformer>;
|
||||
export declare type BabelJestTransformer = {
|
||||
[K in Exclude<keyof jest.Transformer, 'createTransformer'>]: Exclude<jest.Transformer[K], undefined>;
|
||||
};
|
||||
export declare type BabelConfig = _babel.TransformOptions;
|
||||
export interface TsJestGlobalOptions {
|
||||
tsConfig?: boolean | string | CompilerOptions;
|
||||
packageJson?: boolean | string | object;
|
||||
isolatedModules?: boolean;
|
||||
compiler?: string;
|
||||
astTransformers?: string[];
|
||||
diagnostics?: boolean | {
|
||||
pretty?: boolean;
|
||||
ignoreCodes?: number | string | Array<number | string>;
|
||||
pathRegex?: RegExp | string;
|
||||
warnOnly?: boolean;
|
||||
};
|
||||
babelConfig?: boolean | string | BabelConfig;
|
||||
stringifyContentPathRegex?: string | RegExp;
|
||||
}
|
||||
interface TsJestConfig$tsConfig$file {
|
||||
kind: 'file';
|
||||
value: string | undefined;
|
||||
}
|
||||
interface TsJestConfig$tsConfig$inline {
|
||||
kind: 'inline';
|
||||
value: CompilerOptions;
|
||||
}
|
||||
declare type TsJestConfig$tsConfig = TsJestConfig$tsConfig$file | TsJestConfig$tsConfig$inline | undefined;
|
||||
interface TsJestConfig$diagnostics {
|
||||
pretty: boolean;
|
||||
ignoreCodes: number[];
|
||||
pathRegex?: string | undefined;
|
||||
throws: boolean;
|
||||
}
|
||||
interface TsJestConfig$babelConfig$file {
|
||||
kind: 'file';
|
||||
value: string | undefined;
|
||||
}
|
||||
interface TsJestConfig$babelConfig$inline {
|
||||
kind: 'inline';
|
||||
value: BabelConfig;
|
||||
}
|
||||
declare type TsJestConfig$babelConfig = TsJestConfig$babelConfig$file | TsJestConfig$babelConfig$inline | undefined;
|
||||
interface TsJestConfig$packageJson$file {
|
||||
kind: 'file';
|
||||
value: string | undefined;
|
||||
}
|
||||
interface TsJestConfig$packageJson$inline {
|
||||
kind: 'inline';
|
||||
value: any;
|
||||
}
|
||||
declare type TsJestConfig$packageJson = TsJestConfig$packageJson$file | TsJestConfig$packageJson$inline | undefined;
|
||||
declare type TsJestConfig$stringifyContentPathRegex = string | undefined;
|
||||
export interface TsJestConfig {
|
||||
tsConfig: TsJestConfig$tsConfig;
|
||||
packageJson: TsJestConfig$packageJson;
|
||||
isolatedModules: boolean;
|
||||
compiler: string;
|
||||
diagnostics: TsJestConfig$diagnostics;
|
||||
babelConfig: TsJestConfig$babelConfig;
|
||||
transformers: string[];
|
||||
stringifyContentPathRegex: TsJestConfig$stringifyContentPathRegex;
|
||||
}
|
||||
export interface TsJestHooksMap {
|
||||
afterProcess?(args: any[], result: string | jest.TransformedSource): string | jest.TransformedSource | void;
|
||||
}
|
||||
export interface TSCommon {
|
||||
version: typeof _ts.version;
|
||||
sys: typeof _ts.sys;
|
||||
ScriptSnapshot: typeof _ts.ScriptSnapshot;
|
||||
displayPartsToString: typeof _ts.displayPartsToString;
|
||||
createLanguageService: typeof _ts.createLanguageService;
|
||||
getDefaultLibFilePath: typeof _ts.getDefaultLibFilePath;
|
||||
getPreEmitDiagnostics: typeof _ts.getPreEmitDiagnostics;
|
||||
flattenDiagnosticMessageText: typeof _ts.flattenDiagnosticMessageText;
|
||||
transpileModule: typeof _ts.transpileModule;
|
||||
ModuleKind: typeof _ts.ModuleKind;
|
||||
ScriptTarget: typeof _ts.ScriptTarget;
|
||||
findConfigFile: typeof _ts.findConfigFile;
|
||||
readConfigFile: typeof _ts.readConfigFile;
|
||||
parseJsonConfigFileContent: typeof _ts.parseJsonConfigFileContent;
|
||||
formatDiagnostics: typeof _ts.formatDiagnostics;
|
||||
formatDiagnosticsWithColorAndContext: typeof _ts.formatDiagnosticsWithColorAndContext;
|
||||
}
|
||||
export interface TypeInfo {
|
||||
name: string;
|
||||
comment: string;
|
||||
}
|
||||
export interface TsCompiler {
|
||||
cwd: string;
|
||||
extensions: string[];
|
||||
cachedir: string | undefined;
|
||||
ts: TSCommon;
|
||||
compile(code: string, fileName: string, lineOffset?: number): string;
|
||||
getTypeInfo(code: string, fileName: string, position: number): TypeInfo;
|
||||
}
|
||||
export interface AstTransformerDesc {
|
||||
name: string;
|
||||
version: number;
|
||||
factory(cs: ConfigSet): TransformerFactory<SourceFile>;
|
||||
}
|
||||
export interface IPackageJson {
|
||||
main: string;
|
||||
}
|
||||
export {};
|
2
node_modules/ts-jest/dist/types.js
generated
vendored
Normal file
2
node_modules/ts-jest/dist/types.js
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
1
node_modules/ts-jest/dist/util/backports.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/util/backports.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
101
node_modules/ts-jest/dist/util/backports.js
generated
vendored
Normal file
101
node_modules/ts-jest/dist/util/backports.js
generated
vendored
Normal file
|
@ -0,0 +1,101 @@
|
|||
"use strict";
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var bs_logger_1 = require("bs-logger");
|
||||
var messages_1 = require("./messages");
|
||||
var context = (_a = {}, _a[bs_logger_1.LogContexts.namespace] = 'backports', _a);
|
||||
exports.backportJestConfig = function (logger, config) {
|
||||
logger.debug(__assign(__assign({}, context), { config: config }), 'backporting config');
|
||||
var _a = (config || {}).globals, globals = _a === void 0 ? {} : _a;
|
||||
var _b = globals["ts-jest"], tsJest = _b === void 0 ? {} : _b;
|
||||
var mergeTsJest = {};
|
||||
var hadWarnings = false;
|
||||
var warnConfig = function (oldPath, newPath, note) {
|
||||
hadWarnings = true;
|
||||
logger.warn(context, messages_1.interpolate(note ? messages_1.Deprecateds.ConfigOptionWithNote : messages_1.Deprecateds.ConfigOption, {
|
||||
oldPath: oldPath,
|
||||
newPath: newPath,
|
||||
note: note,
|
||||
}));
|
||||
};
|
||||
if ('__TS_CONFIG__' in globals) {
|
||||
warnConfig('globals.__TS_CONFIG__', 'globals.ts-jest.tsConfig');
|
||||
if (typeof globals.__TS_CONFIG__ === 'object') {
|
||||
mergeTsJest.tsConfig = globals.__TS_CONFIG__;
|
||||
}
|
||||
delete globals.__TS_CONFIG__;
|
||||
}
|
||||
if ('__TRANSFORM_HTML__' in globals) {
|
||||
warnConfig('globals.__TRANSFORM_HTML__', 'globals.ts-jest.stringifyContentPathRegex');
|
||||
if (globals.__TRANSFORM_HTML__) {
|
||||
mergeTsJest.stringifyContentPathRegex = '\\.html?$';
|
||||
}
|
||||
delete globals.__TRANSFORM_HTML__;
|
||||
}
|
||||
if ('typeCheck' in tsJest) {
|
||||
warnConfig('globals.ts-jest.typeCheck', 'globals.ts-jest.isolatedModules');
|
||||
mergeTsJest.isolatedModules = !tsJest.typeCheck;
|
||||
delete tsJest.typeCheck;
|
||||
}
|
||||
if ('tsConfigFile' in tsJest) {
|
||||
warnConfig('globals.ts-jest.tsConfigFile', 'globals.ts-jest.tsConfig');
|
||||
if (tsJest.tsConfigFile) {
|
||||
mergeTsJest.tsConfig = tsJest.tsConfigFile;
|
||||
}
|
||||
delete tsJest.tsConfigFile;
|
||||
}
|
||||
if ('enableTsDiagnostics' in tsJest) {
|
||||
warnConfig('globals.ts-jest.enableTsDiagnostics', 'globals.ts-jest.diagnostics');
|
||||
if (tsJest.enableTsDiagnostics) {
|
||||
mergeTsJest.diagnostics = { warnOnly: true };
|
||||
if (typeof tsJest.enableTsDiagnostics === 'string')
|
||||
mergeTsJest.diagnostics.pathRegex = tsJest.enableTsDiagnostics;
|
||||
}
|
||||
else {
|
||||
mergeTsJest.diagnostics = false;
|
||||
}
|
||||
delete tsJest.enableTsDiagnostics;
|
||||
}
|
||||
if ('useBabelrc' in tsJest) {
|
||||
warnConfig('globals.ts-jest.useBabelrc', 'globals.ts-jest.babelConfig', messages_1.Deprecateds.ConfigOptionUseBabelRcNote);
|
||||
if (tsJest.useBabelrc != null) {
|
||||
mergeTsJest.babelConfig = tsJest.useBabelrc ? true : {};
|
||||
}
|
||||
delete tsJest.useBabelrc;
|
||||
}
|
||||
if ('skipBabel' in tsJest) {
|
||||
warnConfig('globals.ts-jest.skipBabel', 'globals.ts-jest.babelConfig');
|
||||
if (tsJest.skipBabel === false && !mergeTsJest.babelConfig) {
|
||||
mergeTsJest.babelConfig = true;
|
||||
}
|
||||
delete tsJest.skipBabel;
|
||||
}
|
||||
if (hadWarnings) {
|
||||
logger.warn(context, messages_1.Helps.MigrateConfigUsingCLI);
|
||||
}
|
||||
return __assign(__assign({}, config), { globals: __assign(__assign({}, globals), { 'ts-jest': __assign(__assign({}, mergeTsJest), tsJest) }) });
|
||||
};
|
||||
exports.backportTsJestDebugEnvVar = function (logger) {
|
||||
if ('TS_JEST_DEBUG' in process.env) {
|
||||
var shouldLog = !/^\s*(?:0|f(?:alse)?|no?|disabled?|off|)\s*$/i.test(process.env.TS_JEST_DEBUG || '');
|
||||
delete process.env.TS_JEST_DEBUG;
|
||||
if (shouldLog) {
|
||||
process.env.TS_JEST_LOG = "ts-jest.log,stderr:warn";
|
||||
}
|
||||
logger.warn(context, messages_1.interpolate(messages_1.Deprecateds.EnvVar, {
|
||||
old: 'TS_JEST_DEBUG',
|
||||
new: 'TS_JEST_LOG',
|
||||
}));
|
||||
}
|
||||
};
|
3
node_modules/ts-jest/dist/util/exported.d.ts
generated
vendored
Normal file
3
node_modules/ts-jest/dist/util/exported.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
export { mocked } from './testing';
|
||||
export { createJestPreset } from '../config/create-jest-preset';
|
||||
export { pathsToModuleNameMapper } from '../config/paths-to-module-name-mapper';
|
8
node_modules/ts-jest/dist/util/exported.js
generated
vendored
Normal file
8
node_modules/ts-jest/dist/util/exported.js
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var testing_1 = require("./testing");
|
||||
exports.mocked = testing_1.mocked;
|
||||
var create_jest_preset_1 = require("../config/create-jest-preset");
|
||||
exports.createJestPreset = create_jest_preset_1.createJestPreset;
|
||||
var paths_to_module_name_mapper_1 = require("../config/paths-to-module-name-mapper");
|
||||
exports.pathsToModuleNameMapper = paths_to_module_name_mapper_1.pathsToModuleNameMapper;
|
1
node_modules/ts-jest/dist/util/get-package-version.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/util/get-package-version.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
10
node_modules/ts-jest/dist/util/get-package-version.js
generated
vendored
Normal file
10
node_modules/ts-jest/dist/util/get-package-version.js
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
function getPackageVersion(moduleName) {
|
||||
try {
|
||||
return require(moduleName + "/package.json").version;
|
||||
}
|
||||
catch (err) { }
|
||||
return;
|
||||
}
|
||||
exports.getPackageVersion = getPackageVersion;
|
1
node_modules/ts-jest/dist/util/importer.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/util/importer.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
193
node_modules/ts-jest/dist/util/importer.js
generated
vendored
Normal file
193
node_modules/ts-jest/dist/util/importer.js
generated
vendored
Normal file
|
@ -0,0 +1,193 @@
|
|||
"use strict";
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
var __spread = (this && this.__spread) || function () {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var logger_1 = require("./logger");
|
||||
var memoize_1 = require("./memoize");
|
||||
var messages_1 = require("./messages");
|
||||
var version_checkers_1 = require("./version-checkers");
|
||||
var logger = logger_1.rootLogger.child({ namespace: 'Importer' });
|
||||
var passThru = function (action) { return function (input) {
|
||||
action();
|
||||
return input;
|
||||
}; };
|
||||
var Importer = (function () {
|
||||
function Importer(_patches) {
|
||||
if (_patches === void 0) { _patches = {}; }
|
||||
this._patches = _patches;
|
||||
}
|
||||
Object.defineProperty(Importer, "instance", {
|
||||
get: function () {
|
||||
logger.debug('creating Importer singleton');
|
||||
return new Importer({
|
||||
'@babel/core': [passThru(version_checkers_1.VersionCheckers.babelCore.warn)],
|
||||
'babel-jest': [passThru(version_checkers_1.VersionCheckers.babelJest.warn)],
|
||||
typescript: [passThru(version_checkers_1.VersionCheckers.typescript.warn)],
|
||||
jest: [passThru(version_checkers_1.VersionCheckers.jest.warn)],
|
||||
});
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Importer.prototype.babelJest = function (why) {
|
||||
return this._import(why, 'babel-jest');
|
||||
};
|
||||
Importer.prototype.babelCore = function (why) {
|
||||
return this._import(why, '@babel/core');
|
||||
};
|
||||
Importer.prototype.typescript = function (why, which) {
|
||||
return this._import(why, which);
|
||||
};
|
||||
Importer.prototype.tryThese = function (moduleName) {
|
||||
var fallbacks = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
fallbacks[_i - 1] = arguments[_i];
|
||||
}
|
||||
var name;
|
||||
var loaded;
|
||||
var tries = __spread([moduleName], fallbacks);
|
||||
while ((name = tries.shift()) !== undefined) {
|
||||
var req = requireWrapper(name);
|
||||
var contextReq = __assign({}, req);
|
||||
delete contextReq.exports;
|
||||
if (req.exists) {
|
||||
loaded = req;
|
||||
if (loaded.error) {
|
||||
logger.error({ requireResult: contextReq }, "failed loading module '" + name + "'", loaded.error.message);
|
||||
}
|
||||
else {
|
||||
logger.debug({ requireResult: contextReq }, 'loaded module', name);
|
||||
loaded.exports = this._patch(name, loaded.exports);
|
||||
}
|
||||
break;
|
||||
}
|
||||
else {
|
||||
logger.debug({ requireResult: contextReq }, "module '" + name + "' not found");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return loaded;
|
||||
};
|
||||
Importer.prototype.tryTheseOr = function (moduleNames, missingResult, allowLoadError) {
|
||||
if (allowLoadError === void 0) { allowLoadError = false; }
|
||||
var args = Array.isArray(moduleNames) ? moduleNames : [moduleNames];
|
||||
var result = this.tryThese.apply(this, __spread(args));
|
||||
if (!result)
|
||||
return missingResult;
|
||||
if (!result.error)
|
||||
return result.exports;
|
||||
if (allowLoadError)
|
||||
return missingResult;
|
||||
throw result.error;
|
||||
};
|
||||
Importer.prototype._patch = function (name, unpatched) {
|
||||
if (name in this._patches) {
|
||||
logger.debug('patching', name);
|
||||
return this._patches[name].reduce(function (mod, patcher) { return patcher(mod); }, unpatched);
|
||||
}
|
||||
return unpatched;
|
||||
};
|
||||
Importer.prototype._import = function (why, moduleName, _a) {
|
||||
var _b = _a === void 0 ? {} : _a, _c = _b.alternatives, alternatives = _c === void 0 ? [] : _c, _d = _b.installTip, installTip = _d === void 0 ? moduleName : _d;
|
||||
var res = this.tryThese.apply(this, __spread([moduleName], alternatives));
|
||||
if (res && res.exists) {
|
||||
if (!res.error)
|
||||
return res.exports;
|
||||
throw new Error(messages_1.interpolate(messages_1.Errors.LoadingModuleFailed, { module: res.given, error: res.error.message }));
|
||||
}
|
||||
var msg = alternatives.length ? messages_1.Errors.UnableToLoadAnyModule : messages_1.Errors.UnableToLoadOneModule;
|
||||
var loadModule = __spread([moduleName], alternatives).map(function (m) { return "\"" + m + "\""; }).join(', ');
|
||||
if (typeof installTip === 'string') {
|
||||
installTip = [{ module: installTip, label: "install \"" + installTip + "\"" }];
|
||||
}
|
||||
var fix = installTip
|
||||
.map(function (tip) {
|
||||
return " " + (installTip.length === 1 ? '↳' : '•') + " " + messages_1.interpolate(messages_1.Helps.FixMissingModule, tip);
|
||||
})
|
||||
.join('\n');
|
||||
throw new Error(messages_1.interpolate(msg, {
|
||||
module: loadModule,
|
||||
reason: why,
|
||||
fix: fix,
|
||||
}));
|
||||
};
|
||||
__decorate([
|
||||
memoize_1.Memoize(function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
return args.join(':');
|
||||
})
|
||||
], Importer.prototype, "tryThese", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize(function (name) { return name; })
|
||||
], Importer.prototype, "_patch", null);
|
||||
__decorate([
|
||||
memoize_1.Memoize()
|
||||
], Importer, "instance", null);
|
||||
return Importer;
|
||||
}());
|
||||
exports.Importer = Importer;
|
||||
exports.importer = Importer.instance;
|
||||
function requireWrapper(moduleName) {
|
||||
var path;
|
||||
var exists = false;
|
||||
try {
|
||||
path = resolveModule(moduleName);
|
||||
exists = true;
|
||||
}
|
||||
catch (error) {
|
||||
return { error: error, exists: exists, given: moduleName };
|
||||
}
|
||||
var result = { exists: exists, path: path, given: moduleName };
|
||||
try {
|
||||
result.exports = requireModule(moduleName);
|
||||
}
|
||||
catch (error) {
|
||||
result.error = error;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
var requireModule = function (mod) { return require(mod); };
|
||||
var resolveModule = function (mod) { return require.resolve(mod); };
|
||||
function __requireModule(localRequire, localResolve) {
|
||||
requireModule = localRequire;
|
||||
resolveModule = localResolve;
|
||||
}
|
||||
exports.__requireModule = __requireModule;
|
1
node_modules/ts-jest/dist/util/json.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/util/json.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
31
node_modules/ts-jest/dist/util/json.js
generated
vendored
Normal file
31
node_modules/ts-jest/dist/util/json.js
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var stableStringify = require("fast-json-stable-stringify");
|
||||
var UNDEFINED = 'undefined';
|
||||
function stringify(input) {
|
||||
return input === undefined ? UNDEFINED : stableStringify(input);
|
||||
}
|
||||
exports.stringify = stringify;
|
||||
function parse(input) {
|
||||
return input === UNDEFINED ? undefined : JSON.parse(input);
|
||||
}
|
||||
exports.parse = parse;
|
||||
function normalize(input, _a) {
|
||||
var _b = (_a === void 0 ? {} : _a).parse, parser = _b === void 0 ? parse : _b;
|
||||
var result;
|
||||
if (normalize.cache.has(input)) {
|
||||
result = normalize.cache.get(input);
|
||||
}
|
||||
else {
|
||||
var data = parser(input);
|
||||
result = stringify(data);
|
||||
if (result === input)
|
||||
result = undefined;
|
||||
normalize.cache.set(input, result);
|
||||
}
|
||||
return result === undefined ? input : result;
|
||||
}
|
||||
exports.normalize = normalize;
|
||||
(function (normalize) {
|
||||
normalize.cache = new Map();
|
||||
})(normalize = exports.normalize || (exports.normalize = {}));
|
1
node_modules/ts-jest/dist/util/jsonable-value.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/util/jsonable-value.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
34
node_modules/ts-jest/dist/util/jsonable-value.js
generated
vendored
Normal file
34
node_modules/ts-jest/dist/util/jsonable-value.js
generated
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var json_1 = require("./json");
|
||||
var JsonableValue = (function () {
|
||||
function JsonableValue(value) {
|
||||
this.value = value;
|
||||
}
|
||||
Object.defineProperty(JsonableValue.prototype, "value", {
|
||||
get: function () {
|
||||
return this._value;
|
||||
},
|
||||
set: function (value) {
|
||||
this._value = value;
|
||||
this._serialized = json_1.stringify(value);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(JsonableValue.prototype, "serialized", {
|
||||
get: function () {
|
||||
return this._serialized;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
JsonableValue.prototype.valueOf = function () {
|
||||
return this._value;
|
||||
};
|
||||
JsonableValue.prototype.toString = function () {
|
||||
return this._serialized;
|
||||
};
|
||||
return JsonableValue;
|
||||
}());
|
||||
exports.JsonableValue = JsonableValue;
|
1
node_modules/ts-jest/dist/util/logger.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/util/logger.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
21
node_modules/ts-jest/dist/util/logger.js
generated
vendored
Normal file
21
node_modules/ts-jest/dist/util/logger.js
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var bs_logger_1 = require("bs-logger");
|
||||
var backports_1 = require("./backports");
|
||||
var original = process.env.TS_JEST_LOG;
|
||||
var buildOptions = function () {
|
||||
var _a;
|
||||
return ({
|
||||
context: (_a = {},
|
||||
_a[bs_logger_1.LogContexts.package] = 'ts-jest',
|
||||
_a[bs_logger_1.LogContexts.logLevel] = bs_logger_1.LogLevels.trace,
|
||||
_a.version = require('../../package.json').version,
|
||||
_a),
|
||||
targets: process.env.TS_JEST_LOG || undefined,
|
||||
});
|
||||
};
|
||||
exports.rootLogger = bs_logger_1.createLogger(buildOptions());
|
||||
backports_1.backportTsJestDebugEnvVar(exports.rootLogger);
|
||||
if (original !== process.env.TS_JEST_LOG) {
|
||||
exports.rootLogger = bs_logger_1.createLogger(buildOptions());
|
||||
}
|
1
node_modules/ts-jest/dist/util/memoize.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/util/memoize.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
47
node_modules/ts-jest/dist/util/memoize.js
generated
vendored
Normal file
47
node_modules/ts-jest/dist/util/memoize.js
generated
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var cacheProp = Symbol.for('[memoize]');
|
||||
function Memoize(keyBuilder) {
|
||||
return function (_, propertyKey, descriptor) {
|
||||
if (descriptor.value != null) {
|
||||
descriptor.value = memoize(propertyKey, descriptor.value, keyBuilder || (function (v) { return v; }));
|
||||
}
|
||||
else if (descriptor.get != null) {
|
||||
descriptor.get = memoize(propertyKey, descriptor.get, keyBuilder || (function () { return propertyKey; }));
|
||||
}
|
||||
};
|
||||
}
|
||||
exports.Memoize = Memoize;
|
||||
function ensureCache(target, reset) {
|
||||
if (reset === void 0) { reset = false; }
|
||||
if (reset || !target[cacheProp]) {
|
||||
Object.defineProperty(target, cacheProp, {
|
||||
value: Object.create(null),
|
||||
configurable: true,
|
||||
});
|
||||
}
|
||||
return target[cacheProp];
|
||||
}
|
||||
function ensureChildCache(target, key, reset) {
|
||||
if (reset === void 0) { reset = false; }
|
||||
var dict = ensureCache(target);
|
||||
if (reset || !dict[key]) {
|
||||
dict[key] = new Map();
|
||||
}
|
||||
return dict[key];
|
||||
}
|
||||
function memoize(namespace, func, keyBuilder) {
|
||||
return function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
var cache = ensureChildCache(this, namespace);
|
||||
var key = keyBuilder.apply(this, args);
|
||||
if (cache.has(key))
|
||||
return cache.get(key);
|
||||
var res = func.apply(this, args);
|
||||
cache.set(key, res);
|
||||
return res;
|
||||
};
|
||||
}
|
1
node_modules/ts-jest/dist/util/messages.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/util/messages.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
47
node_modules/ts-jest/dist/util/messages.js
generated
vendored
Normal file
47
node_modules/ts-jest/dist/util/messages.js
generated
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var Errors;
|
||||
(function (Errors) {
|
||||
Errors["LoadingModuleFailed"] = "Loading module {{module}} failed with error: {{error}}";
|
||||
Errors["UnableToLoadOneModule"] = "Unable to load the module {{module}}. {{reason}} To fix it:\n{{fix}}";
|
||||
Errors["UnableToLoadAnyModule"] = "Unable to load any of these modules: {{module}}. {{reason}}. To fix it:\n{{fix}}";
|
||||
Errors["TypesUnavailableWithoutTypeCheck"] = "Type information is unavailable with \"isolatedModules\"";
|
||||
Errors["UnableToRequireDefinitionFile"] = "Unable to require `.d.ts` file.\nThis is usually the result of a faulty configuration or import. Make sure there is a `.js`, `.json` or another executable extension available alongside `{{file}}`.";
|
||||
Errors["FileNotFound"] = "File not found: {{inputPath}} (resolved as: {{resolvedPath}})";
|
||||
Errors["UntestedDependencyVersion"] = "Version {{actualVersion}} of {{module}} installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version ({{expectedVersion}}). Please do not report issues in ts-jest if you are using unsupported versions.";
|
||||
Errors["MissingDependency"] = "Module {{module}} is not installed. If you're experiencing issues, consider installing a supported version ({{expectedVersion}}).";
|
||||
Errors["UnableToCompileTypeScript"] = "TypeScript diagnostics ({{help}}):\n{{diagnostics}}";
|
||||
Errors["NotMappingMultiStarPath"] = "Not mapping \"{{path}}\" because it has more than one star (`*`).";
|
||||
Errors["NotMappingPathWithEmptyMap"] = "Not mapping \"{{path}}\" because it has no target.";
|
||||
Errors["MappingOnlyFirstTargetOfPath"] = "Mapping only to first target of \"{{path}}\" because it has more than one ({{count}}).";
|
||||
Errors["GotJsFileButAllowJsFalse"] = "Got a `.js` file to compile while `allowJs` option is not set to `true` (file: {{path}}). To fix this:\n - if you want TypeScript to process JS files, set `allowJs` to `true` in your TypeScript config (usually tsconfig.json)\n - if you do not want TypeScript to process your `.js` files, in your Jest config change the `transform` key which value is `ts-jest` so that it does not match `.js` files anymore";
|
||||
Errors["GotUnknownFileTypeWithoutBabel"] = "Got a unknown file type to compile (file: {{path}}). To fix this, in your Jest config change the `transform` key which value is `ts-jest` so that it does not match this kind of files anymore.";
|
||||
Errors["GotUnknownFileTypeWithBabel"] = "Got a unknown file type to compile (file: {{path}}). To fix this, in your Jest config change the `transform` key which value is `ts-jest` so that it does not match this kind of files anymore. If you still want Babel to process it, add another entry to the `transform` option with value `babel-jest` which key matches this type of files.";
|
||||
Errors["ConfigNoModuleInterop"] = "If you have issues related to imports, you should consider setting `esModuleInterop` to `true` in your TypeScript configuration file (usually `tsconfig.json`). See https://blogs.msdn.microsoft.com/typescript/2018/01/31/announcing-typescript-2-7/#easier-ecmascript-module-interoperability for more information.";
|
||||
Errors["UnableToFindProjectRoot"] = "Unable to find the root of the project where ts-jest has been installed.";
|
||||
Errors["UnableToResolveJestConfig"] = "Unable to resolve jest-config. Ensure Jest is properly installed.";
|
||||
})(Errors = exports.Errors || (exports.Errors = {}));
|
||||
var Helps;
|
||||
(function (Helps) {
|
||||
Helps["FixMissingModule"] = "{{label}}: `npm i -D {{module}}` (or `yarn add --dev {{module}}`)";
|
||||
Helps["IgnoreDiagnosticCode"] = "customize using `[jest-config].globals.ts-jest.diagnostics` option";
|
||||
Helps["MigrateConfigUsingCLI"] = "Your Jest configuration is outdated. Use the CLI to help migrating it: ts-jest config:migrate <config-file>.";
|
||||
})(Helps = exports.Helps || (exports.Helps = {}));
|
||||
var Deprecateds;
|
||||
(function (Deprecateds) {
|
||||
Deprecateds["EnvVar"] = "Using env. var \"{{old}}\" is deprecated, use \"{{new}}\" instead.";
|
||||
Deprecateds["ConfigOption"] = "\"[jest-config].{{oldPath}}\" is deprecated, use \"[jest-config].{{newPath}}\" instead.";
|
||||
Deprecateds["ConfigOptionWithNote"] = "\"[jest-config].{{oldPath}}\" is deprecated, use \"[jest-config].{{newPath}}\" instead.\n \u21B3 {{note}}";
|
||||
Deprecateds["ConfigOptionUseBabelRcNote"] = "See `babel-jest` related issue: https://github.com/facebook/jest/issues/3845";
|
||||
Deprecateds["HelperMovedToUtils"] = "The `{{helper}}` helper has been moved to `ts-jest/utils`. Use `import { {{helper}} } from 'ts-jest/utils'` instead.";
|
||||
})(Deprecateds = exports.Deprecateds || (exports.Deprecateds = {}));
|
||||
var ImportReasons;
|
||||
(function (ImportReasons) {
|
||||
ImportReasons["TsJest"] = "Using \"ts-jest\" requires this package to be installed.";
|
||||
ImportReasons["BabelJest"] = "Using \"babel-jest\" requires this package to be installed.";
|
||||
})(ImportReasons = exports.ImportReasons || (exports.ImportReasons = {}));
|
||||
function interpolate(msg, vars) {
|
||||
if (vars === void 0) { vars = {}; }
|
||||
return msg.replace(/\{\{([^\}]+)\}\}/g, function (_, key) { return (key in vars ? vars[key] : _); });
|
||||
}
|
||||
exports.interpolate = interpolate;
|
1
node_modules/ts-jest/dist/util/normalize-slashes.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/util/normalize-slashes.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
6
node_modules/ts-jest/dist/util/normalize-slashes.js
generated
vendored
Normal file
6
node_modules/ts-jest/dist/util/normalize-slashes.js
generated
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
function normalizeSlashes(value) {
|
||||
return value.replace(/\\/g, '/');
|
||||
}
|
||||
exports.normalizeSlashes = normalizeSlashes;
|
1
node_modules/ts-jest/dist/util/sha1.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/util/sha1.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
31
node_modules/ts-jest/dist/util/sha1.js
generated
vendored
Normal file
31
node_modules/ts-jest/dist/util/sha1.js
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var crypto_1 = require("crypto");
|
||||
exports.cache = Object.create(null);
|
||||
function sha1() {
|
||||
var data = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
data[_i] = arguments[_i];
|
||||
}
|
||||
var canCache = data.length === 1 && typeof data[0] === 'string';
|
||||
var cacheKey;
|
||||
if (canCache) {
|
||||
cacheKey = data[0];
|
||||
if (cacheKey in exports.cache) {
|
||||
return exports.cache[cacheKey];
|
||||
}
|
||||
}
|
||||
var hash = crypto_1.createHash('sha1');
|
||||
data.forEach(function (item) {
|
||||
if (typeof item === 'string')
|
||||
hash.update(item, 'utf8');
|
||||
else
|
||||
hash.update(item);
|
||||
});
|
||||
var res = hash.digest('hex').toString();
|
||||
if (canCache) {
|
||||
exports.cache[cacheKey] = res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
exports.sha1 = sha1;
|
34
node_modules/ts-jest/dist/util/testing.d.ts
generated
vendored
Normal file
34
node_modules/ts-jest/dist/util/testing.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
/// <reference types="jest" />
|
||||
declare type MockableFunction = (...args: any[]) => any;
|
||||
declare type MethodKeysOf<T> = {
|
||||
[K in keyof T]: T[K] extends MockableFunction ? K : never;
|
||||
}[keyof T];
|
||||
declare type PropertyKeysOf<T> = {
|
||||
[K in keyof T]: T[K] extends MockableFunction ? never : K;
|
||||
}[keyof T];
|
||||
declare type ArgumentsOf<T> = T extends (...args: infer A) => any ? A : never;
|
||||
declare type ConstructorArgumentsOf<T> = T extends new (...args: infer A) => any ? A : never;
|
||||
interface MockWithArgs<T extends MockableFunction> extends jest.MockInstance<ReturnType<T>, ArgumentsOf<T>> {
|
||||
new (...args: ConstructorArgumentsOf<T>): T;
|
||||
(...args: ArgumentsOf<T>): ReturnType<T>;
|
||||
}
|
||||
declare type MaybeMockedConstructor<T> = T extends new (...args: any[]) => infer R ? jest.MockInstance<R, ConstructorArgumentsOf<T>> : {};
|
||||
declare type MockedFunction<T extends MockableFunction> = MockWithArgs<T> & {
|
||||
[K in keyof T]: T[K];
|
||||
};
|
||||
declare type MockedFunctionDeep<T extends MockableFunction> = MockWithArgs<T> & MockedObjectDeep<T>;
|
||||
declare type MockedObject<T> = MaybeMockedConstructor<T> & {
|
||||
[K in MethodKeysOf<T>]: T[K] extends MockableFunction ? MockedFunction<T[K]> : T[K];
|
||||
} & {
|
||||
[K in PropertyKeysOf<T>]: T[K];
|
||||
};
|
||||
declare type MockedObjectDeep<T> = MaybeMockedConstructor<T> & {
|
||||
[K in MethodKeysOf<T>]: T[K] extends MockableFunction ? MockedFunctionDeep<T[K]> : T[K];
|
||||
} & {
|
||||
[K in PropertyKeysOf<T>]: MaybeMockedDeep<T[K]>;
|
||||
};
|
||||
export declare type MaybeMockedDeep<T> = T extends MockableFunction ? MockedFunctionDeep<T> : T extends object ? MockedObjectDeep<T> : T;
|
||||
export declare type MaybeMocked<T> = T extends MockableFunction ? MockedFunction<T> : T extends object ? MockedObject<T> : T;
|
||||
export declare function mocked<T>(item: T, deep?: false): MaybeMocked<T>;
|
||||
export declare function mocked<T>(item: T, deep: true): MaybeMockedDeep<T>;
|
||||
export {};
|
7
node_modules/ts-jest/dist/util/testing.js
generated
vendored
Normal file
7
node_modules/ts-jest/dist/util/testing.js
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
function mocked(item, _deep) {
|
||||
if (_deep === void 0) { _deep = false; }
|
||||
return item;
|
||||
}
|
||||
exports.mocked = mocked;
|
1
node_modules/ts-jest/dist/util/ts-error.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/util/ts-error.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
41
node_modules/ts-jest/dist/util/ts-error.js
generated
vendored
Normal file
41
node_modules/ts-jest/dist/util/ts-error.js
generated
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var make_error_1 = require("make-error");
|
||||
var util_1 = require("util");
|
||||
var logger_1 = require("./logger");
|
||||
var messages_1 = require("./messages");
|
||||
var logger = logger_1.rootLogger.child({ namespace: 'TSError' });
|
||||
exports.INSPECT_CUSTOM = util_1.inspect.custom || 'inspect';
|
||||
var TSError = (function (_super) {
|
||||
__extends(TSError, _super);
|
||||
function TSError(diagnosticText, diagnosticCodes) {
|
||||
var _this = _super.call(this, messages_1.interpolate(messages_1.Errors.UnableToCompileTypeScript, {
|
||||
diagnostics: diagnosticText.trim(),
|
||||
help: messages_1.Helps.IgnoreDiagnosticCode,
|
||||
})) || this;
|
||||
_this.diagnosticText = diagnosticText;
|
||||
_this.diagnosticCodes = diagnosticCodes;
|
||||
_this.name = 'TSError';
|
||||
logger.debug({ diagnosticCodes: diagnosticCodes, diagnosticText: diagnosticText }, 'created new TSError');
|
||||
Object.defineProperty(_this, 'stack', { value: '' });
|
||||
return _this;
|
||||
}
|
||||
TSError.prototype[exports.INSPECT_CUSTOM] = function () {
|
||||
return this.diagnosticText;
|
||||
};
|
||||
return TSError;
|
||||
}(make_error_1.BaseError));
|
||||
exports.TSError = TSError;
|
1
node_modules/ts-jest/dist/util/version-checkers.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/dist/util/version-checkers.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
63
node_modules/ts-jest/dist/util/version-checkers.js
generated
vendored
Normal file
63
node_modules/ts-jest/dist/util/version-checkers.js
generated
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var semver_1 = require("semver");
|
||||
var get_package_version_1 = require("./get-package-version");
|
||||
var logger_1 = require("./logger");
|
||||
var messages_1 = require("./messages");
|
||||
var logger = logger_1.rootLogger.child({ namespace: 'versions' });
|
||||
var ExpectedVersions;
|
||||
(function (ExpectedVersions) {
|
||||
ExpectedVersions["Jest"] = ">=24 <25";
|
||||
ExpectedVersions["TypeScript"] = ">=2.7 <4";
|
||||
ExpectedVersions["BabelJest"] = ">=24 <25";
|
||||
ExpectedVersions["BabelCore"] = ">=7.0.0-beta.0 <8";
|
||||
})(ExpectedVersions = exports.ExpectedVersions || (exports.ExpectedVersions = {}));
|
||||
exports.VersionCheckers = {
|
||||
jest: createVersionChecker('jest', ExpectedVersions.Jest),
|
||||
typescript: createVersionChecker('typescript', ExpectedVersions.TypeScript),
|
||||
babelJest: createVersionChecker('babel-jest', ExpectedVersions.BabelJest),
|
||||
babelCore: createVersionChecker('@babel/core', ExpectedVersions.BabelCore),
|
||||
};
|
||||
function checkVersion(name, expectedRange, action) {
|
||||
if (action === void 0) { action = 'warn'; }
|
||||
var version = get_package_version_1.getPackageVersion(name);
|
||||
var success = !!version && semver_1.satisfies(version, expectedRange);
|
||||
logger.debug({
|
||||
actualVersion: version,
|
||||
expectedVersion: expectedRange,
|
||||
}, 'checking version of %s: %s', name, success ? 'OK' : 'NOT OK');
|
||||
if (!action || success)
|
||||
return success;
|
||||
var message = messages_1.interpolate(version ? messages_1.Errors.UntestedDependencyVersion : messages_1.Errors.MissingDependency, {
|
||||
module: name,
|
||||
actualVersion: version || '??',
|
||||
expectedVersion: rangeToHumanString(expectedRange),
|
||||
});
|
||||
if (action === 'warn') {
|
||||
logger.warn(message);
|
||||
}
|
||||
else if (action === 'throw') {
|
||||
logger.fatal(message);
|
||||
throw new RangeError(message);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
function rangeToHumanString(versionRange) {
|
||||
return new semver_1.Range(versionRange).toString();
|
||||
}
|
||||
function createVersionChecker(moduleName, expectedVersion) {
|
||||
var memo;
|
||||
var warn = function () {
|
||||
if (memo !== undefined)
|
||||
return memo;
|
||||
return (memo = checkVersion(moduleName, expectedVersion, 'warn'));
|
||||
};
|
||||
var raise = function () { return checkVersion(moduleName, expectedVersion, 'throw'); };
|
||||
return {
|
||||
raise: raise,
|
||||
warn: warn,
|
||||
forget: function () {
|
||||
memo = undefined;
|
||||
},
|
||||
};
|
||||
}
|
1
node_modules/ts-jest/jest-preset.js
generated
vendored
Normal file
1
node_modules/ts-jest/jest-preset.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
module.exports = require('./presets/default/jest-preset')
|
1
node_modules/ts-jest/node_modules/.bin/jest
generated
vendored
Symbolic link
1
node_modules/ts-jest/node_modules/.bin/jest
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../jest/bin/jest.js
|
1
node_modules/ts-jest/node_modules/.bin/json5
generated
vendored
Symbolic link
1
node_modules/ts-jest/node_modules/.bin/json5
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../json5/lib/cli.js
|
1
node_modules/ts-jest/node_modules/.bin/mkdirp
generated
vendored
Symbolic link
1
node_modules/ts-jest/node_modules/.bin/mkdirp
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../mkdirp/bin/cmd.js
|
1
node_modules/ts-jest/node_modules/.bin/semver
generated
vendored
Symbolic link
1
node_modules/ts-jest/node_modules/.bin/semver
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../semver/bin/semver
|
130
node_modules/ts-jest/package.json
generated
vendored
Normal file
130
node_modules/ts-jest/package.json
generated
vendored
Normal file
|
@ -0,0 +1,130 @@
|
|||
{
|
||||
"name": "ts-jest",
|
||||
"version": "24.1.0",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"bin": "cli.js",
|
||||
"description": "A preprocessor with source maps support to help use TypeScript with Jest",
|
||||
"scripts": {
|
||||
"prebuild": "node scripts/clean-dist.js",
|
||||
"build": "tsc -p tsconfig.build.json",
|
||||
"postbuild": "node scripts/post-build.js",
|
||||
"build:watch": "tsc -p tsconfig.build.json -w",
|
||||
"clean": "node scripts/clean.js",
|
||||
"pretest": "npm run lint",
|
||||
"test": "run-s -s test:e2e \"test:unit -- {@}\" --",
|
||||
"test:prepare": "npm run test:e2e -- --prepareOnly",
|
||||
"test:e2e": "node scripts/e2e.js",
|
||||
"test:unit": "node_modules/.bin/jest",
|
||||
"test:external": "node scripts/test-external-project.js",
|
||||
"lint": "run-s lint:ts lint:js",
|
||||
"lint:js": "node_modules/.bin/eslint . -f stylish",
|
||||
"lint:ts": "node_modules/.bin/tslint -t stylish --project .",
|
||||
"lint:fix": "run-s lint:fix:ts lint:fix:js",
|
||||
"lint:fix:js": "node_modules/.bin/eslint . --fix",
|
||||
"lint:fix:ts": "node_modules/.bin/tslint --fix --project .",
|
||||
"typecheck": "node_modules/.bin/tsc -p .",
|
||||
"doc": "cd docs && bundle exec jekyll serve --livereload",
|
||||
"doc:link": "git worktree add docs/_site gh-pages",
|
||||
"doc:unlink": "git worktree prune",
|
||||
"doc:build": "cd docs && bundle exec jekyll build",
|
||||
"doc:build-commit": "npm run doc:build && cd docs/_site && git add --all && git commit -m \"Updates github pages\"",
|
||||
"changelog": "node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
||||
"prepare": "npm run build",
|
||||
"prepublishOnly": "npm run test",
|
||||
"preversion": "npm run test",
|
||||
"version": "npm run changelog && git add CHANGELOG.md"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/kulshekhar/ts-jest.git"
|
||||
},
|
||||
"keywords": [
|
||||
"jest",
|
||||
"typescript",
|
||||
"sourcemap",
|
||||
"react",
|
||||
"testing"
|
||||
],
|
||||
"author": "Kulshekhar Kabra <kulshekhar@users.noreply.github.com> (https://github.com/kulshekhar)",
|
||||
"contributors": [
|
||||
"Huafu Gandon <huafu.gandon@gmail.com> (https://github.com/huafu)"
|
||||
],
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/kulshekhar/ts-jest/issues"
|
||||
},
|
||||
"homepage": "https://kulshekhar.github.io/ts-jest",
|
||||
"dependencies": {
|
||||
"bs-logger": "0.x",
|
||||
"buffer-from": "1.x",
|
||||
"fast-json-stable-stringify": "2.x",
|
||||
"lodash.memoize": "4.x",
|
||||
"json5": "2.x",
|
||||
"make-error": "1.x",
|
||||
"mkdirp": "0.x",
|
||||
"resolve": "1.x",
|
||||
"semver": "^5.5",
|
||||
"yargs-parser": "10.x"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"jest": ">=24 <25"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged",
|
||||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
|
||||
"post-commit": "git reset"
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "8.x",
|
||||
"@commitlint/config-conventional": "7.x",
|
||||
"@types/babel__core": "7.x",
|
||||
"@types/buffer-from": "latest",
|
||||
"@types/cross-spawn": "latest",
|
||||
"@types/fs-extra": "latest",
|
||||
"@types/jest": "23.x",
|
||||
"@types/js-yaml": "latest",
|
||||
"@types/json5": "latest",
|
||||
"@types/lodash.memoize": "4.x",
|
||||
"@types/lodash.merge": "4.x",
|
||||
"@types/lodash.set": "4.x",
|
||||
"@types/mkdirp": "latest",
|
||||
"@types/node": "10.x",
|
||||
"@types/resolve": "latest",
|
||||
"@types/semver": "latest",
|
||||
"@types/yargs": "latest",
|
||||
"conventional-changelog-cli": "2.x",
|
||||
"cross-spawn": "latest",
|
||||
"eslint": "latest",
|
||||
"fs-extra": "latest",
|
||||
"glob-gitignore": "latest",
|
||||
"husky": "1.x",
|
||||
"jest": "24.x",
|
||||
"js-yaml": "latest",
|
||||
"lint-staged": "latest",
|
||||
"lodash.merge": "4.x",
|
||||
"lodash.set": "4.x",
|
||||
"npm-run-all": "latest",
|
||||
"prettier": "latest",
|
||||
"source-map": "latest",
|
||||
"tslint": "latest",
|
||||
"tslint-config-prettier": "latest",
|
||||
"tslint-plugin-prettier": "latest",
|
||||
"typescript": "3.x"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{ts,tsx}": [
|
||||
"tslint --fix",
|
||||
"git add"
|
||||
],
|
||||
"*.{js,jsx}": [
|
||||
"eslint --fix",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
}
|
7
node_modules/ts-jest/preprocessor.js
generated
vendored
Normal file
7
node_modules/ts-jest/preprocessor.js
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
console.warn(
|
||||
'ts-jest[main] (WARN) Replace any occurrences of "ts-jest/dist/preprocessor.js" or ' +
|
||||
' "<rootDir>/node_modules/ts-jest/preprocessor.js"' +
|
||||
' in the \'transform\' section of your Jest config with just "ts-jest".'
|
||||
)
|
||||
|
||||
module.exports = require('./dist')
|
1
node_modules/ts-jest/presets/create.js
generated
vendored
Normal file
1
node_modules/ts-jest/presets/create.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
module.exports = require('../dist/config/create-jest-preset').createJestPreset
|
1
node_modules/ts-jest/presets/default/jest-preset.js
generated
vendored
Normal file
1
node_modules/ts-jest/presets/default/jest-preset.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
module.exports = require('..').defaults
|
5
node_modules/ts-jest/presets/index.d.ts
generated
vendored
Normal file
5
node_modules/ts-jest/presets/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
import { TsJestPresets } from '../dist/config/create-jest-preset'
|
||||
|
||||
export const defaults: TsJestPresets
|
||||
export const jsWithTs: TsJestPresets
|
||||
export const jsWithBabel: TsJestPresets
|
13
node_modules/ts-jest/presets/index.js
generated
vendored
Normal file
13
node_modules/ts-jest/presets/index.js
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
const create = require('./create')
|
||||
|
||||
module.exports = {
|
||||
get defaults() { return create() },
|
||||
get jsWithTs() { return create({ allowJs: true }) },
|
||||
get jsWithBabel() {
|
||||
return create({ allowJs: false }, {
|
||||
transform: {
|
||||
'^.+\\.jsx?$': 'babel-jest',
|
||||
},
|
||||
})
|
||||
},
|
||||
}
|
1
node_modules/ts-jest/presets/js-with-babel/jest-preset.js
generated
vendored
Normal file
1
node_modules/ts-jest/presets/js-with-babel/jest-preset.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
module.exports = require('..').jsWithBabel
|
1
node_modules/ts-jest/presets/js-with-ts/jest-preset.js
generated
vendored
Normal file
1
node_modules/ts-jest/presets/js-with-ts/jest-preset.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
module.exports = require('..').jsWithTs
|
1
node_modules/ts-jest/utils/index.d.ts
generated
vendored
Normal file
1
node_modules/ts-jest/utils/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export * from '../dist/util/exported'
|
1
node_modules/ts-jest/utils/index.js
generated
vendored
Normal file
1
node_modules/ts-jest/utils/index.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
module.exports = require('../dist/util/exported')
|
Loading…
Add table
Add a link
Reference in a new issue