Skip to content

Commit 86a8b82

Browse files
committed
add js file test
1 parent c9d91c8 commit 86a8b82

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

test/lib/compiler.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,25 @@ describe('Compiler', () => {
2525
cache.mfs.unlinkSync(filePath);
2626
});
2727
});
28+
it('Compiler.compile() should be ok with js file', done => {
29+
const filePath = path.resolve(__dirname, '../vue_file/test.js');
30+
const compiler = new Compiler();
31+
compiler.compile(filePath).then(() => {
32+
const file = cache.mfs.readFileSync(filePath);
33+
if (file) {
34+
done();
35+
} else {
36+
done('compiler file write fail');
37+
}
38+
39+
cache.storage.delete(filePath);
40+
cache.mfs.unlinkSync(filePath);
41+
}).catch(e => {
42+
done(e);
43+
cache.storage.delete(filePath);
44+
cache.mfs.unlinkSync(filePath);
45+
});
46+
});
2847
it('Compiler.constructor() should be ok with options.watch', done => {
2948
const filePath = path.resolve(__dirname, '../vue_file/simple.vue');
3049
const compiler = new Compiler({watch: true});

test/vue_file/test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const config = {
2+
install(Vue) {
3+
}
4+
};
5+
export default config;

0 commit comments

Comments
 (0)