Skip to content

Commit

Permalink
fix: include original source location. Fixes #24
Browse files Browse the repository at this point in the history
  • Loading branch information
artberri committed Nov 2, 2022
1 parent 68ce793 commit d73e02b
Show file tree
Hide file tree
Showing 13 changed files with 2,482 additions and 5 deletions.
2 changes: 2 additions & 0 deletions examples/karma-ts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/
coverage/
52 changes: 52 additions & 0 deletions examples/karma-ts/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
const istanbul = require("rollup-plugin-istanbul")
const typescript = require("@rollup/plugin-typescript")

module.exports = (config) => {
config.set({
// It seems that plugins are not loaded automatically using PNPM
plugins: [
require("karma-rollup-preprocessor"),
require("karma-mocha"),
require("karma-mocha-reporter"),
require("karma-chai"),
require("karma-coverage"),
require("karma-jsdom-launcher"),
],
basePath: "./",
frameworks: ["mocha", "chai"],
files: [{ pattern: "spec/**/*.spec.ts", watched: false }],
preprocessors: {
"spec/**/*.spec.ts": ["rollup"],
},
reporters: ["mocha", "coverage"],

browsers: ["jsdom"],

rollupPreprocessor: {
plugins: [
typescript(),
istanbul({
exclude: ["spec/**/*.spec.ts"],
sourceMap: true,
instrumenterConfig: {
produceSourceMap: true,
},
}),
],
output: {
format: "iife",
sourcemap: "inline",
},
},

coverageReporter: {
dir: "coverage",
includeAllSources: true,
reporters: [
{ type: "text" },
{ type: "html", subdir: "html" },
{ type: "lcov", subdir: "./" },
],
},
})
}
36 changes: 36 additions & 0 deletions examples/karma-ts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "rollup-plugin-istanbul-karma-example",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"clean": "rm -rf dist/*",
"build": "rollup -c",
"test": "karma start --single-run"
},
"author": {
"name": "Alberto Varela",
"email": "hello@albertovarela.net",
"url": "https://www.albertovarela.net"
},
"license": "MIT",
"devDependencies": {
"@rollup/plugin-typescript": "^9.0.2",
"@types/chai": "^4.3.3",
"@types/mocha": "^10.0.0",
"chai": "^4.2.0",
"jsdom": "^20.0.2",
"karma": "^6.4.1",
"karma-chai": "^0.1.0",
"karma-coverage": "^2.0.3",
"karma-jsdom-launcher": "^13.0.0",
"karma-mocha": "^2.0.1",
"karma-mocha-reporter": "^2.2.5",
"karma-rollup-preprocessor": "^7.0.5",
"mocha": "^10.1.0",
"rollup": "^3.2.5",
"rollup-plugin-istanbul": "file:../..",
"tslib": "^2.4.1",
"typescript": "^4.8.4"
}
}

0 comments on commit d73e02b

Please sign in to comment.