Skip to content

Commit

Permalink
Add failing test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
danoc authored and ljharb committed Oct 19, 2018
1 parent 7ba334c commit 1525b2e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
12 changes: 12 additions & 0 deletions test/fixtures/test-import-read-file.jsx
@@ -0,0 +1,12 @@
import React from 'react';
import MySvg from './close.svg';

export default function MyFunctionIcon() {
return <MySvg />;
}

export class MyClassIcon extends React.Component {
render() {
return <MySvg />;
}
}
12 changes: 11 additions & 1 deletion test/sanity.js
@@ -1,4 +1,4 @@
import { transformFile } from '@babel/core';
import { transformFile, transform } from '@babel/core';
import fs from 'fs';
import path from 'path';
import inlineReactSvgPlugin from '../src';
Expand Down Expand Up @@ -122,3 +122,13 @@ transformFile('test/fixtures/test-dynamic-require.jsx', {
if (err) throw err;
console.log('test/fixtures/test-dynamic-require.jsx', result.code);
});

transform(fs.readFileSync('test/fixtures/test-import-read-file.jsx'), {
presets: ['airbnb'],
plugins: [
inlineReactSvgPlugin,
],
}, (err, result) => {
if (err) throw err;
console.log('test/fixtures/test-import-read-file.jsx', result.code);
});

0 comments on commit 1525b2e

Please sign in to comment.