Open jthegedus opened 6 years ago
Hey @jthegedus, thanks for the kudos 😃. Recently I've not been able to run through that scenario. I may try it out in the future, and if it is relatively simple to explain, we may consider adding it to the starter/walkthrough.
We're also open to taking PRs, or if you or someone else have a set of steps, we could adapt that to the starter.
I've been trying. If I get something to work I will certainly PR it for discussion here :+1:
Just found this btw https://github.com/damassi/babel-7-typescript-example
Ooh, thanks, that covers almost everything I was after I was after.
Feel free to close this unless you would still like to cover that scenario in this code.
In my case, Jest/ts-Jest doesn't seem to like my declaration only introduced by TypeScript 2.8 (demo repo : https://github.com/jy95/mediaScan/tree/prettier )
Logs : https://travis-ci.org/jy95/mediaScan/jobs/364394183#L529
Debug Failure. False expression: Output generation failed
at Object.transpileModule (node_modules/typescript/lib/typescript.js:93386:18)
at process (node_modules/ts-jest/dist/preprocessor.js:27:28)
at Object.process (node_modules/ts-jest/index.js:8:51)
tsconfig.json :
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"module": "commonjs",
"target": "es5",
"lib": ["ES6","ES2017","ESNext"],
"downlevelIteration": true,
"moduleResolution": "node",
"declaration": true,
"emitDeclarationOnly": true,
"declarationDir": "./lib"
},
"exclude": [
"node_modules"
],
"include": [
"src/**/*"
],
"strict": true
}
jest.config.js :
// jest.config.js
module.exports = {
verbose: true,
"moduleFileExtensions": [
"ts",
"tsx",
"js"
],
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"testMatch": [
"<rootDir>/__tests__/**/*.(ts|tsx|js)"
],
"testPathIgnorePatterns": ["<rootDir>/node_modules/", "<rootDir>/__tests__/__helpers__/"],
"collectCoverage": true
};
It seems these guys eat some .d.ts when they are doing the moduleFileExtensions search...
This example is a great start towards equalizing the usage of TS and Flow for type checking and allowing the integration of TS into Babel projects :tada: Kudos :+1:
I am however having issues with integrating Jest tests into this setup. With TS I would normally use ts-jest, however now that the compilation is being handled by Babel I would think I would need babel-jest so I could run the tests against the Babel output and not the TSC output as I'll be deploying the Babel output, not TSC.
Are there plans to expand this example to include Babel-Jest or is that beyond the scope of this example? If so, has anyone tried this yet and have any pointers?
If this is the right place for the discussion I will update this issue with terminal logs etc.