From 46ffb4d377dbb60a182d1af4c217b224889e767e Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Fri, 11 Nov 2022 16:29:02 +0800 Subject: [PATCH] test: add a test case for https://github.com/vuejs/vue/issues/12828 --- test/template.spec.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/test/template.spec.js b/test/template.spec.js index b0c0c4cdb..e9bb56383 100644 --- a/test/template.spec.js +++ b/test/template.spec.js @@ -340,3 +340,40 @@ test('postLoaders support', done => { done() }) }) + +// https://github.com/vuejs/vue/issues/12828 +test('should skip thread-loader in the template compilation pipeline', done => { + mockBundleAndRun({ + entry: 'custom-directive.vue', + vue: { + compilerOptions: { + directives: { + i18n (el, dir) { + if (dir.name === 'i18n' && dir.value) { + el.i18n = dir.value + if (!el.props) { + el.props = [] + } + el.props.push({ name: 'textContent', value: `_s(${JSON.stringify(dir.value)})` }) + } + } + } + } + }, + module: { + rules: [{ + test: /\.js$/, + use: [{ + loader: 'thread-loader', + options: { + workers: 2 + } + }] + }] + } + }, ({ window, module }) => { + const vnode = mockRender(module) + expect(vnode.data.domProps.textContent).toBe('keypath') + done() + }) +})