-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Errors without stack traces coming from karma-electron? #35
Comments
Looking at our resolution in #32, I'm going to assume we're still using The error looks like it's coming from the Babel transpiler reading in For reference, here's what a normal runtime error stacktrace looks like:
|
@twolfson Alright, I've done some debugging. I've found out that the errors are being thrown from within the However, the stack traces are deep, and I can see the stack traces if I modify the code to catch them and log them manually. Here's that part of my karma config. I modified that part of my karma config so it looks like the following: testFiles.forEach(file => {
const relativeFile = file.replace(CWD, '')
const relativePath = dirname(relativeFile)
mkdirp.sync( CWD + '/.karma-test-build' + relativePath )
const nodeModulesToCompile = config.nodeModulesToCompile
fs.writeFileSync( CWD + '/.karma-test-build' + relativeFile, `
// NOTE, we don't use babel.config.js settings here, we can target a
// more modern environment.
require('@babel/register')({
presets: [ ['@babel/preset-env', { targets: { node: 9 } }] ],
plugins: [
// We need to transpile the not-yet-official re-export syntax.
'@babel/plugin-proposal-export-namespace-from',
'@babel/plugin-proposal-export-default-from',
],
sourceMap: 'inline',
${config.nodeModulesToCompile ? `
ignore: [
// don't compile node_modules except for ones specified in the config
${nodeModulesToCompile.map(moduleName => {
return r`/node_modules(?!\/${r.escape(moduleName)}\/)/`
})}
],
` : ''}
})
// RIGHT HERE, LOG THE ERROR ----------------------------
try {
require( '${ file }' )
} catch(e) {
console.log(e)
process.exit()
}
` )
}) Before doing this, I was seeing an error like:
Then after adding the try-catch and logging the error I was able to see:
So my question is, if I don't catch the error and log it my self, what in the stack is deciding to display such a limited version of the error? |
Seems like something in karma or karma-electron is choosing not to log the full error output? |
I can't think of anything off the top of my head. Pretty confident it's
either Karma or your repo since we do nothing to tweak errors in
karma-electron
Easiest way to find out would be to try another Karma engine (would
disqualify/prove karma-electron) and use a simpler repo (would
disqualify/prove your repo)
…On Tue, Apr 9, 2019, 2:57 PM Joe Pea ***@***.***> wrote:
Seems like something in karma or karma-electron is choosing not to log the
full error output?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#35 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA3FWDkER8iZFZLANlBqLgfGPexmUk1Lks5vfQzJgaJpZM4bT8NW>
.
|
Alright, after disabling karma-electron, and using default values for the browser, karma.config.jsmodule.exports = function(config) {
config.set({
frameworks: ['jasmine', 'stacktrace'],
port: 9876, // karma web server port
colors: true,
logLevel: config.LOG_INFO,
autoWatch: false,
singleRun: debugMode ? false : true,
concurrency: Infinity,
basePath: CWD,
files: [
'tests/**/*.js',
],
client: {
useIframe: false,
loadScriptsViaRequire: true,
},
})
} the errors are still in the same format. So for this simple test file, test fileconsole.log( 'test.js' )
throw new Error('test error')
describe('Tests...', () => {
it('needs to be implemented', () => {
expect(true).toBe(true)
})
}) the error output is in the same format, but they are now tagged with error output:
Longer errors can be even worse: longer error:
So it seems like it is something to do with Karma. |
When I get errors in my test code, I often see them formatted in the console like so:
I noticed that the errors are the same format regardless which karma reporter I use.
Is it karma-electron outputting them like that? If so, how can I get it to output full formatted stack traces
The text was updated successfully, but these errors were encountered: