0.0.4 • Published 4 years ago

@superevilmegaco/jest-evil-svg-transformer v0.0.4

Weekly downloads
54
License
MIT
Repository
github
Last release
4 years ago

Evil Jest SVG Transformer

Make SVGs work with Jest (just make Jest not error out).

Install with either yarn or npm

Yarn

yarn add --dev @superevilmegaco/jest-evil-svg-transformer

NPM

npm i --save-dev @superevilmegaco/jest-evil-svg-transformer

Put this in your jest.config.json:

{
	"transform": {
		"^.+\\.js$": "babel-jest",
		"^.+\\.svg$": "@superevilmegaco/jest-evil-svg-transformer"
	}
}

And Jest won't error out on lines like this:

import UIIcons from "./icons.svg";

if (!document.getElementById("evil-icons")) {
	const iconContainer = document.createElement("div");
	iconContainer.id = "evil-icons";
	iconContainer.style.display = "none";
	iconContainer.innerHTML = UIIcons;
	document.body.appendChild(iconContainer);
}
0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago