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

Update TypeScript recipe given new extensions support #1822

Closed
novemberborn opened this issue May 31, 2018 · 9 comments
Closed

Update TypeScript recipe given new extensions support #1822

novemberborn opened this issue May 31, 2018 · 9 comments

Comments

@novemberborn
Copy link
Member

It'd be good to update the TypeScript recipe in light of AVA's new extensions support.

I'm suggesting the following in the release notes, but I must admit I haven't actually tested it, and it's not mentioned in the recipe yet:

{
    "ava": {
        "compileEnhancements": false,
        "extensions": ["ts"],
        "require": [
            "ts-node/register"
        ]
    }
}

Shout if you're up for trying the snippet and updating the recipe 😄

@vladimiry
Copy link

vladimiry commented Jun 3, 2018

I had to add "babel": false, option to the above config, otherwise it gives the following error:

 ✖ Internal error
  Error: Cannot apply enhancement-only precompilation, possible bad usage

"ava": "1.0.0-beta.5.1",

@novemberborn
Copy link
Member Author

@vladimiry could you share your full AVA config, and any Babel config you may have? If configured correctly these files should skip the regular Babel pipeline so you shouldn't have to disable it.

@vladimiry
Copy link

vladimiry commented Jun 4, 2018

@novemberborn here it's https://github.com/vladimiry/protonmail-desktop-app/tree/06ac40ee0c537e536b9fa82623e7a8864c98fdef, tests can be executed running yarn && yarn test:electron:main. I don't use babel for this project, but it comes with ava, would be great ava uses it as an optional dependency if that's possible.

Besides what I noticed is that output is not informative enough. For example I explicitly cause a TS error, like using nonexistent / not imported type (TS2304):
ts error

and I then get the output that doesn't show me what error and on which line is happened, but just the non-zero exit code: 1 thing:

  TSError: ⨯ Unable to compile TypeScript:

  createTSError (node_modules/ts-node/src/index.ts:250:12)
  getOutput (node_modules/ts-node/src/index.ts:358:40)
  Object.compile (node_modules/ts-node/src/index.ts:545:11)
  Module.m._compile (node_modules/ts-node/src/index.ts:430:43)
  Object.require.extensions.(anonymous function) [as .ts] (node_modules/ts-node/src/index.ts:433:12)

  ✖ src/electron/main/ipc-main-api.spec.ts exited with a non-zero exit code: 1

@vladimiry

This comment has been minimized.

@btkostner

This comment has been minimized.

@vladimiry

This comment has been minimized.

@novemberborn

This comment has been minimized.

@novemberborn

This comment has been minimized.

@novemberborn
Copy link
Member Author

@vladimiry OK I figured out the problem. See #1836.

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

No branches or pull requests

3 participants