Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

mocked helper function implicitly requires config / dependencies #782

Closed
kwonoj opened this issue Oct 1, 2018 · 1 comment · Fixed by #795 · May be fixed by procrafts/kata-diamond#20, procrafts/kata-diamond#21 or procrafts/kata-diamond#22
Labels
Milestone

Comments

@kwonoj
Copy link
Contributor

kwonoj commented Oct 1, 2018

I just tried latest mocked helper and noticed couple of things, prevents to use it.

Issue :

node_modules/ts-jest/dist/types.d.ts:2:25 - error TS2307: Cannot find module 'babel__core'.

2 import * as _babel from 'babel__core';
                          ~~~~~~~~~~~~~

node_modules/ts-jest/dist/types.d.ts:3:8 - error TS1192: Module '"/Users/ojkwon/github/xxx/node_modules/typescript/lib/typescript"' has no default export.

3 import _ts, { CompilerOptions, SourceFile, TransformerFactory } from 'typescript';

Expected behavior :

  1. @types/babel__core is devDependency (https://github.com/kulshekhar/ts-jest/blob/master/package.json#L77), so if consumer doesn't have those types it'll break.

  2. import _ts
    if consumer's codebase do not use esModuleInterop, can't make this work.

Debug log:

log file content
# content of ts-jest.log :

Minimal repo :

@huafu huafu added this to the 23.10.4 milestone Oct 1, 2018
@huafu huafu added the 🐛 Bug label Oct 1, 2018
@huafu
Copy link
Collaborator

huafu commented Oct 1, 2018

Thanks @kwonoj for reporting the issue!

huafu added a commit to huafu/ts-jest that referenced this issue Oct 3, 2018
Importing from `ts-jest` everything will possibly make collision with
future jest API. Also any star export or import might not be compatible
with the target project. Now all helpers to be used in tests or config
files have been moved to `ts-jest/utils`. Original ones have been kept
in `ts-jest` for now, with a deprecation warning when using them.

Closes kulshekhar#782
@huafu huafu closed this as completed in 33ff29f Oct 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment