一种选择是在您的配置中创建您自己的茉莉花记者。一个新的 winston 文件将在每个测试开始时声明并在结束时完成。
jasmine.getEnv().addReporter({
jasmineStarted: function (options) {
console.log(`jas start: ${options}`);
},
suiteStarted: function (options) {
console.log(`suite start: ${options}`);
//start your log here.
},
specStarted: function (options) {
console.log(`spec start: ${options}`);
},
specDone: function (result) {
console.log(`spec done: ${result}`);
},
suiteDone: function (result) {
},
jasmineDone: async function (result) {
}
}
挂钩顺序
--- beforeLaunch
--- onPrepare
--- jasmineStarted (set in jasmine reporter)
--- beforeAll
--- suiteStarted (set in jasmine reporter)
--- specStarted (set in jasmine reporter)
--- beforeEach
+++ afterEach
+++ specDone (set in jasmine reporter)
+++ suiteDone (set in jasmine reporter)
+++ afterAll
+++ jasmineDone (set in jasmine reporter)
+++ onComplete
+++ afterLaunch