From 9ff9a5921d8d22144eb0343737fb4bc24b3427e8 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Thu, 2 Feb 2017 16:25:18 -0500 Subject: [PATCH] use options.name for easier debugging --- test/generate.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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