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

coverageRanges without using the filesystem #196

Open
FranckFreiburger opened this issue Dec 1, 2020 · 2 comments
Open

coverageRanges without using the filesystem #196

FranckFreiburger opened this issue Dec 1, 2020 · 2 comments

Comments

@FranckFreiburger
Copy link

FranckFreiburger commented Dec 1, 2020

Description

According to the types definition file :

/** Represents single bundle */
export interface Bundle {
code: File;
map?: File;
coverageRanges?: ColumnsRange[][];
}

Bundle accepts code, map and coverageRanges.
But it seems to not being taken in account in the output html file.

Steps to reproduce

        // page is a puppeteer page object
	const coverageData = await page.coverage.stopJSCoverage();
	const bundle = {
		code: await fetch('http://127.0.0.1:8182/vue3-sfc-loader.js').then(res => res.buffer()),
		map: await fetch('http://127.0.0.1:8182/vue3-sfc-loader.js.map').then(res => res.buffer()),
		coverageRanges: coverageData.find(e => e.url === 'http://127.0.0.1:8182/vue3-sfc-loader.js').ranges;
	}
	const result = await explore(bundle, {
		output: { format: 'html' },
	});
	fs.writeFileSync('exploreOutput.html', result.output);

Expected behavior
coverage information to be included in exploreOutput.html

Environment

  • OS: win7
  • source-map-explorer Version 2.5.1
@FranckFreiburger
Copy link
Author

oh, I missed convertRangesToLinesRanges() !

Can you consider exporting it?

@nikolay-borzov
Copy link
Collaborator

nikolay-borzov commented Dec 30, 2020

Exporting convertRangesToLinesRanges() won't help. We need to allow passing coverage data as an alternative to a coverage file path.
And yes, the typing is kind of wrong

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

2 participants