-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
E2E tests fails on projects generated with typescript and vue-router. #5695
Comments
I found that this is caused by plugins order in GereratorAPI. So, I crated dirty patch like this to swap these plugin's order. diff --git a/packages/@vue/cli/lib/Creator.js b/packages/@vue/cli/lib/Creator.js
index 04275937..8cd021f0 100644
--- a/packages/@vue/cli/lib/Creator.js
+++ b/packages/@vue/cli/lib/Creator.js
@@ -183,6 +183,13 @@ module.exports = class Creator extends EventEmitter {
log(`🚀 Invoking generators...`)
this.emit('creation', { event: 'invoking-generators' })
const plugins = await this.resolvePlugins(preset.plugins, pkg)
+ const tsPluginIdx = plugins.findIndex(p => p.id === '@vue/cli-plugin-typescript')
+ const tsPlugin = plugins[tsPluginIdx]
+ // Remove ts plugin
+ plugins.splice(tsPluginIdx, 1)
+ // Insert ts plugin after router
+ const routerPluginIdx = plugins.findIndex(p => p.id === '@vue/cli-plugin-router')
+ plugins.splice(routerPluginIdx + 1, 0, tsPlugin)
const generator = new Generator(context, {
pkg,
plugins, Plugins are sorted like this with this patch. I created new project with same options. // src/views/Home.vue
<template>
<div class="home">
<img alt="Vue logo" src="../assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js + TypeScript App"/>
</div>
</template>
<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
import HelloWorld from '@/components/HelloWorld.vue'; // @ is an alias to /src
... Entire project is available here. |
This will be fixed in df93f46 |
Fixed in v4.5.3 |
Version
4.4.6
Reproduction link
https://github.com/TETRA2000/vue-ts-app
Environment info
Steps to reproduce
1.Create a new project with these configuration.
(Others are off)
2.Run
yarn test:e2e
.What is expected?
E2E should pass without errors.
What is actually happening?
E2E fails to match h1 text.
src/views/Home.vue
tests/e2e/specs/test.js
I suspected that these replacement code aren't running correctly.
vue-cli/packages/@vue/cli-plugin-typescript/generator/template/src/views/Home.vue
Lines 1 to 11 in c98f76a
The text was updated successfully, but these errors were encountered: