Code Monkey home page Code Monkey logo

Comments (4)

monounity avatar monounity commented on June 3, 2024 2

@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.

RickCarlino avatar RickCarlino commented on June 3, 2024

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.

monounity avatar monounity commented on June 3, 2024

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.

monounity avatar monounity commented on June 3, 2024

Oh, and any help actually fixing issues in the dev branch is also welcome of course!

from karma-typescript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.