diff --git a/test/preprocess/index.js b/test/preprocess/index.js
index 29eaff67f1..6ed452f672 100644
--- a/test/preprocess/index.js
+++ b/test/preprocess/index.js
@@ -126,6 +126,41 @@ describe('preprocess', () => {
});
});
+ it('provides filename to processing hooks', () => {
+ const source = `
+
Hello __MARKUP_FILENAME__!
+
+
+ `;
+
+ const expected = `
+ Hello file.html!
+
+
+ `;
+
+ return svelte.preprocess(source, {
+ filename: 'file.html',
+ markup: ({ content, filename }) => {
+ return {
+ code: content.replace('__MARKUP_FILENAME__', filename)
+ };
+ },
+ style: ({ content, filename }) => {
+ return {
+ code: content.replace('__STYLE_FILENAME__', filename)
+ };
+ },
+ script: ({ content, filename }) => {
+ return {
+ code: content.replace('__SCRIPT_FILENAME__', filename)
+ };
+ }
+ }).then(processed => {
+ assert.equal(processed.toString(), expected);
+ });
+ });
+
it('ignores null/undefined returned from preprocessor', () => {
const source = `