When running jasmine
it only presents dot(.
) for successful tests, and only verbose if the test fails.
JavaScript
x
6
1
//test.spec.js
2
describe('jasmine', ()=>{
3
it('should show this text', () =>{
4
});
5
})
6
My running command is: jasmine-node test.spec.js
The result:
JavaScript
1
4
1
.
2
Finished in 0.003 seconds
3
1 test, 1 assertion, 0 failures, 0 skipped
4
How to make jasmine
display this test result like jasmine should show this text
?
Advertisement
Answer
Use the --verbose
flag:
JavaScript
1
8
1
> jasmine-node test.spec.js --verbose
2
3
jasmine - 0 ms
4
should show this test - 0 ms
5
6
Finished in 0.007 seconds
7
1 test, 1 assertion, 0 failures, 0 skipped
8
Note: jasmine-node
doesn’t seem to be actively maintained. The jasmine
CLI supports tests run from the command line.
Although jasmine
doesn’t have a verbose flag, you can use a custom terminal reporter (example: jasmine-terminal-reporter
). From jasmine’s documentation, add a helper file to load the custom reporter and include the helper in your configuration file.
helpers/terminal-reporter.js
JavaScript
1
5
1
var Reporter = require('jasmine-terminal-reporter');
2
var reporter = new Reporter(options);
3
4
jasmine.addReporter(reporter);
5
spec/support/jasmine.json
JavaScript
1
12
12
1
{
2
"spec_dir": "spec",
3
"spec_files": [
4
"**/*[sS]pec.js",
5
],
6
"helpers": [
7
"helpers/**/*.js"
8
],
9
stopSpecOnExpectationFailure: false,
10
random: false
11
}
12