ts-jest 23.10.4 → 23.10.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.gitattributes ADDED
@@ -0,0 +1,2 @@
1
+ package-lock.json -diff -merge
2
+ package-lock.json linguist-generated=true
package/.ts-jest-digest CHANGED
@@ -1 +1 @@
1
- c92057ca8c4a5c745979bfa0e6a09302a19dc4b3
1
+ 3fe12324700b93d3377a5957ccfc2f339524ce17
package/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ <a name="23.10.5"></a>
2
+ ## [23.10.5](https://github.com/kulshekhar/ts-jest/compare/v23.10.4...v23.10.5) (2018-11-22)
3
+
4
+
5
+
1
6
  <a name="23.10.4"></a>
2
7
  ## [23.10.4](https://github.com/kulshekhar/ts-jest/compare/v23.10.3...v23.10.4) (2018-10-06)
3
8
 
package/README.md CHANGED
@@ -46,7 +46,7 @@ Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduc
46
46
 
47
47
  ## Versioning
48
48
 
49
- We **DOT NOT** use [SemVer](http://semver.org/) for versioning. Tho you can think about SemVer when reading our version, except our major number follow the one of Jest. For the versions available, see the [tags on this repository](https://github.com/kulshekhar/ts-jest/tags).
49
+ We **DO NOT** use [SemVer](http://semver.org/) for versioning. Tho you can think about SemVer when reading our version, except our major number follow the one of Jest. For the versions available, see the [tags on this repository](https://github.com/kulshekhar/ts-jest/tags).
50
50
 
51
51
  ## Authors/maintainers
52
52
 
@@ -30,18 +30,12 @@ var __spread = (this && this.__spread) || function () {
30
30
  for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
31
31
  return ar;
32
32
  };
33
- var __importStar = (this && this.__importStar) || function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
37
- result["default"] = mod;
38
- return result;
39
- };
40
33
  Object.defineProperty(exports, "__esModule", { value: true });
41
- var jestConfig = __importStar(require("jest-config"));
42
34
  var logger_1 = require("../util/logger");
35
+ var jest_config_resolver_1 = require("./jest-config-resolver");
43
36
  var logger = logger_1.rootLogger.child({ namespace: 'jest-preset' });
44
- var defaults = jestConfig.defaults || {
37
+ var jestConfigPkg = jest_config_resolver_1.getJestConfigPkg(logger);
38
+ var defaults = jestConfigPkg.defaults || {
45
39
  transform: null,
46
40
  testMatch: ['**/__tests__/**/*.js?(x)', '**/?(*.)+(spec|test).js?(x)'],
47
41
  moduleFileExtensions: ['js', 'json', 'jsx', 'node'],
@@ -0,0 +1,2 @@
1
+ import { Logger } from 'bs-logger';
2
+ export declare function getJestConfigPkg<TJestConfig>(logger: Logger): TJestConfig;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var fs_1 = require("fs");
4
+ var path_1 = require("path");
5
+ var resolve_1 = require("resolve");
6
+ var messages_1 = require("../util/messages");
7
+ function getJestConfigPkg(logger) {
8
+ try {
9
+ var jestPath = resolvePackagePath('jest', __dirname);
10
+ var jestCliPath = resolvePackagePath('jest-cli', jestPath);
11
+ var jestConfigPath = resolvePackagePath('jest-config', jestCliPath);
12
+ var jestConfigPackageJson = require(path_1.join(jestConfigPath, 'package.json'));
13
+ var jestConfigMainPath = path_1.resolve(jestConfigPath, jestConfigPackageJson.main);
14
+ return require(jestConfigMainPath);
15
+ }
16
+ catch (error) {
17
+ logger.error({ error: error }, messages_1.Errors.UnableToResolveJestConfig);
18
+ return {};
19
+ }
20
+ }
21
+ exports.getJestConfigPkg = getJestConfigPkg;
22
+ function resolvePackagePath(packageName, baseDir) {
23
+ var packageJsonPath = resolve_1.sync(packageName, {
24
+ basedir: baseDir,
25
+ packageFilter: function (packageJson) {
26
+ packageJson.main = 'package.json';
27
+ return packageJson;
28
+ },
29
+ readFileSync: fs_1.readFileSync,
30
+ isFile: isFile,
31
+ });
32
+ var realPackageJsonPath = fs_1.realpathSync(packageJsonPath);
33
+ return path_1.dirname(realPackageJsonPath);
34
+ }
35
+ function isFile(filePath) {
36
+ if (fs_1.existsSync(filePath)) {
37
+ var stats = fs_1.statSync(filePath);
38
+ return stats.isFile();
39
+ }
40
+ else {
41
+ return false;
42
+ }
43
+ }
package/dist/types.d.ts CHANGED
@@ -95,4 +95,7 @@ export interface AstTransformerDesc {
95
95
  version: number;
96
96
  factory(cs: ConfigSet): TransformerFactory<SourceFile>;
97
97
  }
98
+ export interface IPackageJson {
99
+ main: string;
100
+ }
98
101
  export {};
@@ -20,6 +20,7 @@ var Errors;
20
20
  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.";
21
21
  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.";
22
22
  Errors["UnableToFindProjectRoot"] = "Unable to find the root of the project where ts-jest has been installed.";
23
+ Errors["UnableToResolveJestConfig"] = "Unable to resolve jest-config. Ensure Jest is properly installed.";
23
24
  })(Errors = exports.Errors || (exports.Errors = {}));
24
25
  var Helps;
25
26
  (function (Helps) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-jest",
3
- "version": "23.10.4",
3
+ "version": "23.10.5",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "bin": "cli.js",
@@ -65,6 +65,7 @@
65
65
  "json5": "2.x",
66
66
  "make-error": "1.x",
67
67
  "mkdirp": "0.x",
68
+ "resolve": "1.x",
68
69
  "semver": "^5.5",
69
70
  "yargs-parser": "10.x"
70
71
  },
@@ -86,6 +87,7 @@
86
87
  "@types/lodash.set": "4.x",
87
88
  "@types/mkdirp": "latest",
88
89
  "@types/node": "10.x",
90
+ "@types/resolve": "latest",
89
91
  "@types/semver": "latest",
90
92
  "@types/yargs": "latest",
91
93
  "conventional-changelog-cli": "2.x",