Skip to content

Commit 5f749aa

Browse files
committed
add functional test for svelte
1 parent b7c9b74 commit 5f749aa

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

fixtures/js/hello_world.svelte

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<script>
2+
let name = 'world';
3+
</script>
4+
5+
<h1>Hello {name}!</h1>

lib/config-generator.js

-2
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,6 @@ class ConfigGenerator {
394394
}
395395

396396
if (this.webpackConfig.useSvelte) {
397-
loaderFeatures.ensurePackagesExistAndAreCorrectVersion('svelte');
398-
399397
rules.push(applyRuleConfigurationCallback('svelte', {
400398
resolve: {
401399
mainFields: ['svelte', 'browser', 'module', 'main'],

test/functional.js

+17
Original file line numberDiff line numberDiff line change
@@ -1330,6 +1330,23 @@ module.exports = {
13301330
});
13311331
});
13321332

1333+
it('When enabled, svelte is transformed', (done) => {
1334+
const config = createWebpackConfig('www/build', 'dev');
1335+
config.setPublicPath('/build');
1336+
config.addEntry('main', './js/hello_world.svelte');
1337+
config.enableSvelte();
1338+
1339+
testSetup.runWebpack(config, (webpackAssert) => {
1340+
// check that babel transformed the svelte files
1341+
webpackAssert.assertOutputFileContains(
1342+
'main.js',
1343+
'SvelteComponent'
1344+
);
1345+
1346+
done();
1347+
});
1348+
});
1349+
13331350
it('When enabled, preact JSX is transformed with preact-compat!', (done) => {
13341351
const config = createWebpackConfig('www/build', 'dev');
13351352
config.setPublicPath('/build');

0 commit comments

Comments
 (0)