(err, cachePath, basePath)
| 94 | }; |
| 95 | |
| 96 | const logPrettyError = (err, cachePath, basePath) => { |
| 97 | let hasOutput = false; |
| 98 | if (err.loc) { |
| 99 | // Code error |
| 100 | switch (err.plugin) { |
| 101 | case 'babel': |
| 102 | err.frame = err.message.substr(err.message.indexOf('\n') + 1); |
| 103 | err.message = err.message.substr(0, err.message.indexOf('\n')).slice(2).replace(/^([^:]*): /, ''); |
| 104 | break; |
| 105 | default: |
| 106 | hasOutput = true; |
| 107 | console.error(err.toString()); |
| 108 | } |
| 109 | if (!hasOutput) { |
| 110 | console.error(err.toString()); |
| 111 | console.error(`Line: ${err.loc.line}, Col: ${err.loc.column}, File: ${err.id.replace(cwd, '')}`); |
| 112 | console.error(err.frame); |
| 113 | hasOutput = true; |
| 114 | } |
| 115 | } |
| 116 | if (!hasOutput) { |
| 117 | cache = null; |
| 118 | saveCache(cachePath, basePath, cache); |
| 119 | console.error(err.toString()); |
| 120 | } |
| 121 | }; |
| 122 | |
| 123 | grunt.registerMultiTask('javascript', 'Compile JavaScript files', async function() { |
| 124 | const Helpers = require('../helpers')(grunt); |
no test coverage detected