Created
May 3, 2018 10:54
-
-
Save DeMoorJasper/b4a62eae80f6db0f78c4f342dc32213b to your computer and use it in GitHub Desktop.
Parcel plugin test
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
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