diff --git a/packages/core/integration-tests/test/integration/markdown/100x100.png b/packages/core/integration-tests/test/integration/markdown/100x100.png new file mode 100644 index 00000000000..8a1daa0121d Binary files /dev/null and b/packages/core/integration-tests/test/integration/markdown/100x100.png differ diff --git a/packages/core/integration-tests/test/integration/markdown/index.md b/packages/core/integration-tests/test/integration/markdown/index.md index c641f4265c9..d1d6628f15c 100644 --- a/packages/core/integration-tests/test/integration/markdown/index.md +++ b/packages/core/integration-tests/test/integration/markdown/index.md @@ -1,3 +1,5 @@ # heading1 content content content + +[image](./100x100.png) diff --git a/packages/core/integration-tests/test/markdown.js b/packages/core/integration-tests/test/markdown.js new file mode 100644 index 00000000000..017e8fe9d33 --- /dev/null +++ b/packages/core/integration-tests/test/markdown.js @@ -0,0 +1,33 @@ +const assert = require('assert'); +const path = require('path'); +const fs = require('@parcel/fs'); +const {bundle, run, assertBundleTree} = require('./utils'); + +describe('markdown', function() { + it('should support bundling Markdown', async function() { + let b = await bundle( + path.join(__dirname, '/integration/markdown/index.md') + ); + + await assertBundleTree(b, { + name: 'index.html', + assets: ['index.md'], + childBundles: [ + { + type: 'png', + assets: ['100x100.png'], + childBundles: [] + } + ] + }); + + let files = await fs.readdir(path.join(__dirname, '/dist')); + let html = await fs.readFile(path.join(__dirname, '/dist/index.html')); + for (let file of files) { + let ext = file.match(/\.([0-9a-z]+)(?:[?#]|$)/i)[0]; + if (file !== 'index.html' && ext !== '.map') { + assert(html.includes(file)); + } + } + }); +});