From fe9e33278692f2f0edcbcd576db708832f018ca0 Mon Sep 17 00:00:00 2001 From: Ivan Demidov Date: Fri, 21 Aug 2020 14:56:49 +0300 Subject: [PATCH] test: for posthtml options, issue #124 --- test/fixtures/options/directives/fixture.html | 1 + test/fixtures/options/directives/fixture.js | 1 + .../__snapshots__/directives.test.js.snap | 3 ++ test/options/directives.test.js | 30 +++++++++++++++++++ 4 files changed, 35 insertions(+) create mode 100644 test/fixtures/options/directives/fixture.html create mode 100644 test/fixtures/options/directives/fixture.js create mode 100644 test/options/__snapshots__/directives.test.js.snap create mode 100644 test/options/directives.test.js diff --git a/test/fixtures/options/directives/fixture.html b/test/fixtures/options/directives/fixture.html new file mode 100644 index 0000000..05402e3 --- /dev/null +++ b/test/fixtures/options/directives/fixture.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test/fixtures/options/directives/fixture.js b/test/fixtures/options/directives/fixture.js new file mode 100644 index 0000000..310cfd2 --- /dev/null +++ b/test/fixtures/options/directives/fixture.js @@ -0,0 +1 @@ +import html from './fixture.html' // eslint-disable-line diff --git a/test/options/__snapshots__/directives.test.js.snap b/test/options/__snapshots__/directives.test.js.snap new file mode 100644 index 0000000..28578a0 --- /dev/null +++ b/test/options/__snapshots__/directives.test.js.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Options directives {Array} 1`] = `"export default \`\`"`; diff --git a/test/options/directives.test.js b/test/options/directives.test.js new file mode 100644 index 0000000..971914f --- /dev/null +++ b/test/options/directives.test.js @@ -0,0 +1,30 @@ +'use strict' + +const webpack = require('../helpers/compiler') + +describe('Options', () => { + describe('directives', () => { + test('{Array}', () => { + const config = { + loader: { + test: /\.html$/, + options: { + directives: [{ + name: '?php', + start: '<', + end: '>', + }] + } + } + } + + return webpack('options/directives/fixture.js', config) + .then((stats) => { + const [module] = stats.toJson().modules + + expect(module.source).toMatchSnapshot() + }) + .catch((err) => err) + }) + }) +})