-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Provide installation instructions on missing language preproces…
…sors (#10) * feat: Provide installation instructions on missing language preprocessors * Updating error, tip messages * Fixing test name
- Loading branch information
1 parent
581ce48
commit 97e772c
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { parse } from '../lib/parse' | ||
import { compileTemplate } from '../lib/compileTemplate' | ||
import * as compiler from 'vue-template-compiler' | ||
|
||
test('preprocess pug', () => { | ||
const template = parse({ | ||
source: | ||
'<template lang="pug">\n' + | ||
'body\n' + | ||
' h1 Pug Examples\n' + | ||
' div.container\n' + | ||
' p Cool Pug example!\n' + | ||
'</template>\n', | ||
filename: 'example.vue', | ||
needMap: true | ||
}).template | ||
|
||
const result = compileTemplate({ | ||
filename: 'example.vue', | ||
source: template.content, | ||
preprocessLang: template.lang, | ||
compiler: compiler | ||
}) | ||
|
||
expect(result.errors.length).toBe(0) | ||
}) | ||
|
||
test('warn missing preprocessor', () => { | ||
const template = parse({ | ||
source: | ||
'<template lang="unknownLang">\n' + | ||
'</template>\n', | ||
filename: 'example.vue', | ||
needMap: true | ||
}).template | ||
|
||
const result = compileTemplate({ | ||
filename: 'example.vue', | ||
source: template.content, | ||
preprocessLang: template.lang, | ||
compiler: compiler | ||
}) | ||
|
||
expect(result.errors.length).toBe(1) | ||
}) |