Skip to content

Commit 61fa6e8

Browse files
committed
various test fixes
1 parent 1868d72 commit 61fa6e8

File tree

13 files changed

+120
-22
lines changed

13 files changed

+120
-22
lines changed

fixtures/vuejs3-typescript/App.vue

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<template>
2+
<div id="app">
3+
<img src="./assets/logo.png">
4+
<hello></hello>
5+
</div>
6+
</template>
7+
8+
<script lang="ts">
9+
import Hello from './components/Hello.vue'
10+
11+
class TestClassSyntax {
12+
13+
}
14+
15+
export default {
16+
name: 'app',
17+
components: {
18+
Hello
19+
}
20+
}
21+
</script>
22+
23+
<style>
24+
#app {
25+
font-family: 'Avenir', Helvetica, Arial, sans-serif;
26+
-webkit-font-smoothing: antialiased;
27+
-moz-osx-font-smoothing: grayscale;
28+
text-align: center;
29+
color: #2c3e50;
30+
margin-top: 60px;
31+
}
32+
</style>
33+
34+
<style lang="scss">
35+
#app {
36+
display: flex;
37+
color: #2c3e90;
38+
}
39+
</style>
40+
41+
<style lang="less">
42+
#app {
43+
margin-top: 40px;
44+
}
45+
</style>
6.69 KB
Loading
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<template>
2+
<div class="hello">
3+
<h1>{{ msg }}</h1>
4+
<h2>Essential Links</h2>
5+
<ul>
6+
<li><a href="https://vuejs.org" target="_blank">Core Docs</a></li>
7+
<li><a href="https://forum.vuejs.org" target="_blank">Forum</a></li>
8+
<li><a href="https://gitter.im/vuejs/vue" target="_blank">Gitter Chat</a></li>
9+
<li><a href="https://twitter.com/vuejs" target="_blank">Twitter</a></li>
10+
<br>
11+
<li><a href="https://vuejs-templates.github.io/webpack/" target="_blank">Docs for This Template</a></li>
12+
</ul>
13+
<h2>Ecosystem</h2>
14+
<ul>
15+
<li><a href="https://router.vuejs.org/" target="_blank">vue-router</a></li>
16+
<li><a href="https://vuex.vuejs.org/" target="_blank">vuex</a></li>
17+
<li><a href="https://vue-loader.vuejs.org/" target="_blank">vue-loader</a></li>
18+
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank">awesome-vue</a></li>
19+
</ul>
20+
</div>
21+
</template>
22+
23+
<script lang="ts">
24+
export default {
25+
name: 'hello',
26+
data () {
27+
return {
28+
msg: 'Welcome to Your Vue.js App'
29+
}
30+
}
31+
}
32+
</script>
33+
34+
<!-- Add "scoped" attribute to limit CSS to this component only -->
35+
<style scoped>
36+
h1, h2 {
37+
font-weight: normal;
38+
}
39+
40+
ul {
41+
list-style-type: none;
42+
padding: 0;
43+
}
44+
45+
li {
46+
display: inline-block;
47+
margin: 0 10px;
48+
}
49+
50+
a {
51+
color: #42b983;
52+
}
53+
</style>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es6",
4+
"strict": true,
5+
"module": "es2015",
6+
"moduleResolution": "node",
7+
"allowSyntheticDefaultImports": true
8+
},
9+
"include": [
10+
"./**/*.ts"
11+
]
12+
}

lib/plugins/vue.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,7 @@ module.exports = function(plugins, webpackConfig) {
2323
return;
2424
}
2525

26-
const vueVersion = getVueVersion(webpackConfig);
27-
let VueLoaderPlugin;
28-
switch (vueVersion) {
29-
case 2:
30-
VueLoaderPlugin = require('vue-loader/lib/plugin'); // eslint-disable-line
31-
break;
32-
case 3:
33-
({ VueLoaderPlugin } = require('vue-loader'));
34-
break;
35-
default:
36-
throw new Error(`Invalid vue version ${vueVersion}`);
37-
}
26+
const { VueLoaderPlugin } = require('vue-loader');
3827

3928
plugins.push({
4029
plugin: new VueLoaderPlugin(),

test/friendly-errors/transformers/missing-loader.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@
1010
'use strict';
1111

1212
const expect = require('chai').expect;
13-
const transform = require('../../../lib/friendly-errors/transformers/missing-loader');
13+
const transformFactory = require('../../../lib/friendly-errors/transformers/missing-loader');
14+
const RuntimeConfig = require('../../../lib/config/RuntimeConfig');
15+
const WebpackConfig = require('../../../lib/WebpackConfig');
16+
17+
const runtimeConfig = new RuntimeConfig();
18+
runtimeConfig.context = __dirname;
19+
runtimeConfig.babelRcFileExists = false;
20+
const transform = transformFactory(new WebpackConfig(runtimeConfig));
1421

1522
describe('transform/missing-loader', () => {
1623

test/functional.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,10 +1686,9 @@ module.exports = {
16861686
);
16871687

16881688
const config = testSetup.createWebpackConfig(appDir, 'www/build', 'dev');
1689-
const vueVersion = getVueVersion(config);
16901689
config.enableSingleRuntimeChunk();
16911690
config.setPublicPath('/build');
1692-
config.addEntry('main', `./vuejs-typescript/main_v${vueVersion}`);
1691+
config.addEntry('main', `./vuejs-typescript${getVueVersion(config)}/main`);
16931692
config.enableVueLoader();
16941693
config.enableSassLoader();
16951694
config.enableLessLoader();
@@ -1704,13 +1703,6 @@ module.exports = {
17041703
];
17051704
});
17061705

1707-
// to avoid typescript breaking on the "invalid" file, delete it.
1708-
if (vueVersion === 3) {
1709-
fs.unlinkSync(path.join(config.getContext(), 'vuejs-typescript', 'main_v2.ts'));
1710-
} else {
1711-
fs.unlinkSync(path.join(config.getContext(), 'vuejs-typescript', 'main_v3.ts'));
1712-
}
1713-
17141706
testSetup.runWebpack(config, (webpackAssert) => {
17151707
expect(config.outputPath).to.be.a.directory().with.deep.files([
17161708
'main.js',

0 commit comments

Comments
 (0)