forked from kirillrogovoy/parcel
/
markdown.js
33 lines (30 loc) 路 922 Bytes
/
markdown.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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));
}
}
});
});