Open franklin-ross opened 7 years ago
im currently working on extracting all parsing and UI into separate package so i can use same code also for other test frameworks (specially jest). There i replaced typescript with babylon as source parser (typescript used here only because i didnt know better) and sourcemaps (almost always) works ... (except when vscode tries to load sourcemaps from src dir and not from out dir - wut?)
BTW: sourceFile.getLineAndCharacterOfPosition(pos).line
it is used only for showing lenses - so it returns line from source not from bundle so sourcemaps arent neseseary...
But if the tests are run on a JS file that has source maps inside/beside it, then sourceFile.getLineAndCharacterOfPosition(pos).line
is going to put lenses in the JS file, right? Not in wherever the source maps point.
Basically I want to be able to build a JS file however I want and run tests on it, then have the code lenses automatically follow source maps from that JS file back to whatever they were built from. So I might have 5 Typescript files and some build system producing 1 JS file with a source map. No other files. I don't want this extension to run on my Typescript files, I just want it to run on the JS file whenever that gets changed, but I want to see the codelenses in my Typescript files (or indeed, whatever strange language the source maps might point back to).
Lenses are shown only in file, that is currently active. Extension is mainly focused on debugging specific test (running all test is just 'bonus')
If u wanna run test on js when changes why not use plain old mocha cli in watch mode?
Ahhh, I see what you're saying. Running mocha in CLI watch mode is what I'm currently doing, I'd just love it if I had an extension that would mark up the file I'm currently viewing with the results as lenses.
Maybe I should think about writing a different extension, since it seems a little different from what you're aiming for.
I could add ability to load test states from JSON file and watch that file for changes. (that would require some wrapper around mocha/Jest/whatever, that will save test results in 'my' json format - probably another set of packages and also some code that will update JSON when tests are executed from editor)
Hmmm. Seems like a lot of work, considering you're going through a rewrite at the moment.
it was suprisingly simple to add json file for storing state and watch for changes ... in refactored code :/
Hi! How it is going? I've tried TypeScript example and looks like it is still not working
Hey, I'd kill for source map support in this as we use Webpack to build a single output file. I don't think there's any way I can get this working as is.
Would you accept a PR for this? I don't think it'd be too hard from a cursory glance. Just replacing the 2 calls to
sourceFile.getLineAndCharacterOfPosition(pos).line
with something that goes further and pulls the source maps in. Does that sound right? The code I've seen using the source-map module seems fairly straightforward, and there's plenty of examples of it in the wild.