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

Troubles using it with TS3 and composite project #669

Closed
emirotin opened this issue Aug 8, 2018 · 11 comments
Closed

Troubles using it with TS3 and composite project #669

emirotin opened this issue Aug 8, 2018 · 11 comments
Milestone

Comments

@emirotin
Copy link

emirotin commented Aug 8, 2018

Issue :

I'm unable to use it with TypeScript 3.0 and composite project

Expected behavior :

I expect the tests to work

Output from debug log :

I didn't get the debug.txt, but here's the test output.

a) with enableTsDiagnostics: true

 FAIL  test/testing.test.ts
  ● Test suite failed to run

    error TS6304: Composite projects may not disable declaration emit.

      at Object.runTsDiagnostics [as default] (../../node_modules/ts-jest/src/utils/run-ts-diagnostics.ts:16:11)
      at Object.preprocess [as process] (../../node_modules/ts-jest/src/preprocess.ts:46:21)

Test Suites: 1 failed, 1 total

b) with enableTsDiagnostics: false

 FAIL  test/testing.test.ts
  ● Test suite failed to run

    Debug Failure. Expected "use strict";
    describe('Testing a test', function () {
        it('should be true', function () {
            expect(true).toBeTruthy();
        });
    });
    //# sourceMappingURL=testing.test.js.map === undefined. Unexpected multiple outputs, file: /Users/emirotin/work/learn-a/packages/pkg2/test/testing.test.d.ts

      at Object.assertEqual (../../node_modules/typescript/lib/typescript.js:1389:17)
      at Object.writeFile (../../node_modules/typescript/lib/typescript.js:100504:30)
      at Object.__assign.writeFile (../../node_modules/typescript/lib/typescript.js:83117:596)
      at Object.writeFile (../../node_modules/typescript/lib/typescript.js:10573:14)
      at printSourceFileOrBundle (../../node_modules/typescript/lib/typescript.js:78709:16)
      at emitDeclarationFileOrBundle (../../node_modules/typescript/lib/typescript.js:78671:17)
      at emitSourceFileOrBundle (../../node_modules/typescript/lib/typescript.js:78589:13)
      at forEachEmittedFile (../../node_modules/typescript/lib/typescript.js:78497:30)
      at Object.emitFiles (../../node_modules/typescript/lib/typescript.js:78578:9)
      at emitWorker (../../node_modules/typescript/lib/typescript.js:83228:33)

Test Suites: 1 failed, 1 total

The latter coming from here: https://github.com/Microsoft/TypeScript/blob/master/src/services/transpile.ts#L79

Minimal repo :

https://github.com/emirotin/learn-a

@dotbear
Copy link

dotbear commented Aug 9, 2018

The first bug is a problem with ts-node which has been fixed here (awaiting release):
TypeStrong/ts-node#657

The second bug is one that I am currently also experiencing and have been unable to solve.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Aug 9, 2018

hi, we haven't looked into supporting TypeScript 3.x yet. We will take into account of this.

@gombosg
Copy link

gombosg commented Aug 21, 2018

Yup, turning off "composite": true in tsconfig.json solved this issue (we're still just experimenting with the composite project feature anyway).

@justinwaite
Copy link

I am receiving the same error (b). Hope to see support for this soon! Using TS3's new Project References feature along with Lerna in a monorepo.

@huafu
Copy link
Collaborator

huafu commented Sep 1, 2018

@emirotin I am having issues cloning your minimal repo. At the step yarn build (after prepare):

❯ yarn build
yarn run v1.9.4
warning package.json: No license field
$ tsc -b packages
error TS6059: File '/Users/huafu/tools/tests/ts-jest/learn-a/packages/pkg2/test/testing.test.ts' is not under 'rootDir' '/Users/huafu/tools/tests/ts-jest/learn-a/packages/pkg2/src'. 'rootDir' is expected to contain all source files.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I'll try to change the exclude section... but why do we need to build to run tests?

@emirotin
Copy link
Author

emirotin commented Sep 1, 2018

It's just part of my original setup in the real project. Also it ensures TS config is fine.

@huafu
Copy link
Collaborator

huafu commented Sep 1, 2018

@emirotin if you feel like it, you can test our latest beta with your full project. See #697 ;-)

@hassankhan
Copy link

Hi @huafu, I just gave it a try in my project and it seems to work fine 👍

@huafu
Copy link
Collaborator

huafu commented Sep 2, 2018

thanks, one thing to start with is remove most ts-jest specific config fom jest.config.js and replace it with the preset. Example:

huafu/bs-logger@4b480a0#diff-2d0cd5d10b9604941c38c6aac608178a

@hassankhan
Copy link

Would it be possible to add *.integ.ts to the preset?

@huafu
Copy link
Collaborator

huafu commented Sep 2, 2018

@hassankhan it's not one used by jest for JS files, ie not a standard one, so I don't think it's a good idea to add it to the preset. But it's a preset, and you can also grain extend it. Please for further question(s) related to beta or suggestions, use the new slack channel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants