diff --git a/e2e/3.x/basic/components/CompilerDirective.vue b/e2e/3.x/basic/components/CompilerDirective.vue new file mode 100644 index 00000000..9ae9a9a2 --- /dev/null +++ b/e2e/3.x/basic/components/CompilerDirective.vue @@ -0,0 +1,5 @@ + diff --git a/e2e/3.x/basic/jest.config.js b/e2e/3.x/basic/jest.config.js new file mode 100644 index 00000000..4552a185 --- /dev/null +++ b/e2e/3.x/basic/jest.config.js @@ -0,0 +1,26 @@ +const vTestDirective = require('./v-test-directive') + +module.exports = { + testEnvironment: 'jsdom', + moduleFileExtensions: ['js', 'json', 'vue', 'ts'], + transform: { + '^.+\\.ts$': 'ts-jest', + '^.+\\.js$': 'babel-jest', + '^.+\\.vue$': '@vue/vue3-jest' + }, + moduleNameMapper: { + '^~?__styles/(.*)$': '/components/styles/$1' + }, + globals: { + 'vue-jest': { + pug: { + basedir: './' + }, + compilerOptions: { + directiveTransforms: { + test: vTestDirective + } + } + } + } +} diff --git a/e2e/3.x/basic/package.json b/e2e/3.x/basic/package.json index 229fed83..e1707edf 100644 --- a/e2e/3.x/basic/package.json +++ b/e2e/3.x/basic/package.json @@ -25,29 +25,5 @@ "vue-class-component": "^8.0.0-beta.4", "@vue/vue3-jest": "^27.0.0-alpha.1", "vue-property-decorator": "^10.0.0-rc.3" - }, - "jest": { - "testEnvironment": "jsdom", - "moduleFileExtensions": [ - "js", - "json", - "vue", - "ts" - ], - "transform": { - "^.+\\.ts$": "ts-jest", - "^.+\\.js$": "babel-jest", - "^.+\\.vue$": "@vue/vue3-jest" - }, - "moduleNameMapper": { - "^~?__styles/(.*)$": "/components/styles/$1" - }, - "globals": { - "vue-jest": { - "pug": { - "basedir": "./" - } - } - } } } diff --git a/e2e/3.x/basic/test.js b/e2e/3.x/basic/test.js index 3a940af9..553ec119 100644 --- a/e2e/3.x/basic/test.js +++ b/e2e/3.x/basic/test.js @@ -22,6 +22,7 @@ import { randomExport } from './components/NamedExport.vue' import ScriptSetup from './components/ScriptSetup.vue' import ScriptSetupSugarRef from './components/ScriptSetupSugarRef.vue' import FunctionalRenderFn from './components/FunctionalRenderFn.vue' +import CompilerDirective from './components/CompilerDirective.vue' // TODO: JSX for Vue 3? TSX? import Jsx from './components/Jsx.vue' @@ -36,7 +37,9 @@ function mount(Component, props, slots) { return h(Component, props, slots) } } - createApp(Parent).mount(el) + const app = createApp(Parent) + app.directive('test', el => el.setAttribute('data-test', 'value')) + app.mount(el) } test('supports