-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests for named-asset-imports plugin (#5575)
* add tests for named-asset-imports plugin * add ticketFormats store/saga * change import to require on test file to avoid using babel when running tests * remove all babel dependencies as not needed more for running tests * update tests and rename file to index.test.js * remove npmignore as it is whitelisted in package.json * add babel-plugin-named-asset-import tests to e2e
- Loading branch information
Showing
3 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
const pluginTester = require('babel-plugin-tester'); | ||
const namedAssetImport = require('./index'); | ||
|
||
pluginTester({ | ||
plugin: namedAssetImport, | ||
pluginOptions: { | ||
loaderMap: { | ||
svg: { | ||
ReactComponent: '@svgr/webpack?-prettier,-svgo![path]', | ||
}, | ||
}, | ||
}, | ||
pluginName: 'named-asset-import', | ||
snapshot: false, | ||
tests: { | ||
defaultImport: { | ||
code: 'import logo from "logo";', | ||
output: 'import logo from "logo";', | ||
}, | ||
namedImport: { | ||
code: 'import { logo } from "logo";', | ||
output: 'import { logo } from "logo";', | ||
}, | ||
namedImportRenamed: { | ||
code: 'import { Url as logo1 } from "logo";', | ||
output: 'import { Url as logo1 } from "logo";', | ||
}, | ||
svgDefaultImport: { | ||
code: 'import logo from "logo.svg";', | ||
output: 'import logo from "logo.svg";', | ||
}, | ||
svgNamedImport: { | ||
code: 'import { logo } from "logo.svg";', | ||
output: 'import { logo } from "logo.svg";', | ||
}, | ||
svgReactComponentNamedImport: { | ||
code: 'import { ReactComponent as logo } from "logo.svg";', | ||
output: | ||
'import { ReactComponent as logo } from "@svgr/webpack?-prettier,-svgo!logo.svg";', | ||
}, | ||
svgMultipleImport: { | ||
code: | ||
'import logo, { logoUrl , ReactComponent as Logo } from "logo.svg";', | ||
output: | ||
'import logo from "logo.svg";\n' + | ||
'import { logoUrl } from "logo.svg";\n' + | ||
'import { ReactComponent as Logo } from "@svgr/webpack?-prettier,-svgo!logo.svg";', | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters