-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add low-level print configuration option.
Defaults to console.log. Set to function process.stdout.write(log + '\n'); to avoid output to devtools console while still reporting jasmine results to command line.
- Loading branch information
1 parent
bf1a2bf
commit bf404a0
Showing
6 changed files
with
134 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
describe("spec reporter", () => { | ||
|
||
let outputs: string[]; | ||
|
||
describe("with custom print", () => { | ||
beforeEach(() => { | ||
outputs = []; | ||
this.reporter = new global.SpecReporter({ | ||
colors: { | ||
enabled: false, | ||
}, | ||
print: line => { | ||
outputs.push(line); | ||
}, | ||
spec: { | ||
displayPending: true | ||
} | ||
}); | ||
}); | ||
|
||
describe("when jasmine started", () => { | ||
it("should report start with ", () => { | ||
expect(new Test(this.reporter, function() { | ||
this.describe("suite", () => { | ||
this.it("successful spec", () => { | ||
this.passed(); | ||
}); | ||
}); | ||
}).outputs.length).toEqual(0); | ||
expect(outputs).contains(/Spec started/); | ||
}); | ||
}); | ||
|
||
describe("when suite", () => { | ||
it("should report suite with custom print", () => { | ||
expect(new Test(this.reporter, function() { | ||
this.describe("suite", () => { | ||
this.it("successful spec", () => { | ||
this.passed(); | ||
}); | ||
}); | ||
}).outputs.length).toEqual(0); | ||
expect(outputs).contains(/suite/); | ||
}); | ||
}); | ||
|
||
describe("when spec started", () => { | ||
it("should report start", () => { | ||
expect(new Test(this.reporter, function() { | ||
this.describe("suite", () => { | ||
this.it("spec to be started", () => { | ||
this.passed(); | ||
}); | ||
}); | ||
}).outputs.length).toEqual(0); | ||
expect(outputs).contains([ | ||
" suite", | ||
" " + "✓ spec to be started".green | ||
]); | ||
}); | ||
}); | ||
|
||
describe("when spec done", () => { | ||
it("should report success with custom print", () => { | ||
expect(new Test(this.reporter, function() { | ||
this.describe("suite", () => { | ||
this.it("successful spec", () => { | ||
this.passed(); | ||
}); | ||
}); | ||
}).outputs.length).toEqual(0); | ||
expect(outputs).contains(/successful spec/); | ||
}); | ||
|
||
it("should report failure with custom print", () => { | ||
expect(new Test(this.reporter, function() { | ||
this.describe("suite", () => { | ||
this.it("failed spec", () => { | ||
this.failed(); | ||
}); | ||
}); | ||
}).outputs.length).toEqual(0); | ||
expect(outputs).contains([/failed spec/]); | ||
}); | ||
|
||
it("should display spec error messages with custom print", () => { | ||
expect(new Test(this.reporter, function() { | ||
this.describe("suite", () => { | ||
this.it("failed spec", () => { | ||
this.failed(); | ||
}); | ||
}); | ||
}).outputs.length).toEqual(0); | ||
expect(outputs).contains([" - Expected true to be false."]); | ||
}); | ||
|
||
it("should report pending with custom print", () => { | ||
expect(new Test(this.reporter, function() { | ||
this.describe("suite", () => { | ||
this.xit("pending spec", () => { | ||
this.passed(); | ||
}); | ||
}); | ||
}).outputs.length).toEqual(0); | ||
expect(outputs).contains(/pending spec/); | ||
}); | ||
}); | ||
|
||
describe("when summary", () => { | ||
it("should display summary error messages with custom print", () => { | ||
expect(new Test(this.reporter, function() { | ||
this.describe("suite", () => { | ||
this.it("failed spec", () => { | ||
this.failed(); | ||
}); | ||
}); | ||
}).summary.length).toEqual(0); | ||
expect(outputs).contains([" - Expected true to be false."]); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters