Skip to content
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

Adding more error information #26

Merged
merged 9 commits into from
Aug 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ module.exports = function(source, map) {
} catch (err) {
// wrap error to provide correct
// context when logging to console
this.callback(new Error(err.toString()));
this.callback(new Error(err.toString() + '\n' + err.frame));
}
};
12 changes: 6 additions & 6 deletions test/loader.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('loader', function() {
expect(err).to.exist;

expect(err.message).to.eql(
'Expected }}} (1:18)\n' +
'ParseError: Expected }}}\n' +
'1: <p>Count: {{{count}}</p>\n' +
' ^\n' +
'2: <button on:click=\'set({ count: count + 1 })\'>+1</button>'
Expand All @@ -75,7 +75,7 @@ describe('loader', function() {
expect(err).to.exist;

expect(err.message).to.eql(
'Unexpected token (5:7)\n' +
'ParseError: Unexpected token\n' +
'3: <script>\n' +
'4: export {\n' +
'5: foo: \'BAR\'\n' +
Expand All @@ -96,7 +96,7 @@ describe('loader', function() {
expect(err).to.exist;

expect(err.message).to.eql(
'Computed properties can be function expressions or arrow function expressions (6:11)\n' +
'ValidationError: Computed properties can be function expressions or arrow function expressions\n' +
'4: export default {\n' +
'5: computed: {\n' +
'6: foo: \'BAR\'\n' +
Expand Down Expand Up @@ -151,15 +151,15 @@ describe('loader', function() {
it('should configure css (default)',
testLoader('test/fixtures/css.html', function(err, code, map) {
expect(err).not.to.exist;
expect(code).to.contain('if ( !addedCss ) addCss();');
expect(code).to.contain('function add_css ()');
})
);


it('should configure no css',
testLoader('test/fixtures/css.html', function(err, code, map) {
expect(err).not.to.exist;
expect(code).not.to.contain('if ( !addedCss ) addCss();');
expect(code).not.to.contain('function add_css ()');
}, { css: false })
);

Expand Down Expand Up @@ -203,7 +203,7 @@ describe('loader', function() {
testLoader('test/fixtures/good.html', function(err, code, map) {
expect(err).not.to.exist;

expect(code).to.contain('.render = function ( root, options ) {');
expect(code).to.contain('.render = function ( state, options ) {');
}, { generate: 'ssr' })
);

Expand Down