diff --git a/test/generate.js b/test/generate.js index 17a8aba7e3..bba18f4d2e 100644 --- a/test/generate.js +++ b/test/generate.js @@ -9,8 +9,13 @@ import { addLineNumbers, loadConfig, svelte, env, setupHtmlEqual } from './helpe let showCompiledCode = false; let compileOptions = null; +function getName ( filename ) { + const base = path.basename( filename ).replace( '.html', '' ); + return base[0].toUpperCase() + base.slice( 1 ); +} + require.extensions[ '.html' ] = function ( module, filename ) { - const options = Object.assign({ filename }, compileOptions ); + const options = Object.assign({ filename, name: getName( filename ) }, compileOptions ); const { code } = svelte.compile( fs.readFileSync( filename, 'utf-8' ), options ); if ( showCompiledCode ) console.log( addLineNumbers( code ) ); // eslint-disable-line no-console