Comments (4)
@RickCarlino: There is support for React and automatic loading of imported modules from node_modules in the upcoming 2.1 release, if you want to try it out you can pull in the latest from this repo in your package.json:
"karma-typescript": "git://github.com/monounity/karma-typescript.git#2.1"
There are examples for running unit tests with React in the integration tests, please look at the karma.conf.react.js and the package.json files.
Integration tests for [email protected]
Integration tests for Typescript@latest
A beta release for 2.1 is expected within the next week or two, you can follow progress and status in the wiki.
Please report any bugs you find as separate issues, that way I can keep track of everything, and give you credit in the release notes.
from karma-typescript.
Was able to fix the issue by modifying the source in preprocessor.js
as follows:
var transpileOutput = tsc.transpileModule(
content, {
compilerOptions: {
target: tsc.ScriptTarget.ES5,
module: tsc.ModuleKind.CommonJS,
sourceMap: true,
jsx: "react" // <=== I added this.
}
}
);
This won't be perfect for people who use other JSX libraries (eg: Mithril with MSX), but it will solve the problem for most JSX users.
Please let me know if you would like to merge this or make it an optional setting. I could submit a PR.
from karma-typescript.
Hey @RickCarlino, thanks! There's already rudimentary support for react/jsx together with automatic loading of modules from node_modules in this dev branch.
It runs jasmine tests with react on osx and produces remapped coverage, but it's still kind of shaky and haven't been tested on windows so there are probably windows path backslash issues still to be wrinkled out.
Any help testing it would be much appreciated, so feel free to clone it and try running the react example :)
I'll keep this issue open until the jsx/node_module loading features are released.
from karma-typescript.
Oh, and any help actually fixing issues in the dev branch is also welcome of course!
from karma-typescript.
Related Issues (20)
- Failed build under TypeScript 4.5.2 HOT 3
- `lcovonly` does not create `lcov.info`
- karma-typescript attempts to process `node_modules` TS by default config
- request: v5.5.3 release HOT 3
- Acorn parser Ecmaversion doesn't follow Typescript target HOT 2
- The process of Decorator has mistake make the PropertyDescriptor with undefined value
- 'karmaTypescriptConfig' does not exist in type 'ConfigOptions'
- error TS2582: Cannot find name 'describe'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha`. HOT 3
- Coverage report not showing files with zero coverage
- `browser` field of `package.json` not used?
- KarmaTypescript Thresholds not working on TS files rather taking coverage from JS files
- Avoid adding __esModule and default properties for JSON files loaded with require
- error TS18003: No inputs were found in config file 'tsconfig.json'
- Is karma-typescript compatible with Angular 13+ ?
- npm link karma
- Typescript 5 Integration HOT 7
- Add doc deprecation for karma-typescript with recommendations HOT 2
- Exports not define error on latest typescript version
- Error: No source found for .d.ts file
- Can't find sockjs-client/dist/sockjs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from karma-typescript.