Skip to content

Instantly share code, notes, and snippets.

@DeMoorJasper
Created May 3, 2018 10:54
Show Gist options
  • Save DeMoorJasper/b4a62eae80f6db0f78c4f342dc32213b to your computer and use it in GitHub Desktop.
Save DeMoorJasper/b4a62eae80f6db0f78c4f342dc32213b to your computer and use it in GitHub Desktop.
Parcel plugin test
const assertBundleTree = require('parcel-assert-bundle-tree');
const path = require('path');
const SveltePlugin = require('../src/index');
describe('basic', function() {
it('Should create a basic svelte bundle', async function() {
// Init bundler
const bundler = new Bundler(input, Object.assign({
outDir: path.join(__dirname, 'dist'),
watch: false,
cache: false,
hmr: false,
logLevel: 0
}, options));
// Registers the plugins asset types
await SveltePlugin(bundler);
// Bundle the code
const bundle = await bundler.bundle();
// Compare bundle to expected
assertBundleTree(bundle, {
name: 'index.html',
assets: ['index.html'],
childBundles: [
{
type: 'js',
assets: ['index.js', 'Demo.svelte', 'Header.svelte'],
childBundles: [
{
type: 'map'
}
]
}
]
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment