-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4709413
commit b96af0f
Showing
3 changed files
with
56 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/// <reference types="cypress" /> | ||
|
||
describe('Output compact logs', ()=>{ | ||
// create logs to check that using outputCompactLogs overrides compactLogs for output file | ||
it('Output compact logs', ()=>{ | ||
for (let i = 0; i <20 ; i++) { | ||
expect(1).to.equal(1) | ||
} | ||
|
||
expect(1).to.equal(0) | ||
}) | ||
}) |
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,38 @@ | ||
import { | ||
ICONS, | ||
runTest, | ||
commandBase, | ||
logLastRun, | ||
clean | ||
} from "../utils"; | ||
|
||
const {expect} = require('chai'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
describe('Output compact logs.', () => { | ||
|
||
afterEach(function () { | ||
if (this.currentTest.state == 'failed') { | ||
logLastRun(); | ||
} | ||
}); | ||
|
||
it('Should compact output file logs to length specified by outputCompactLogs', async () => { | ||
await runTest(commandBase(['outputCompactLogs=1'], ['outputCompactLogs.spec.js']), (error, stdout, stderr) => { | ||
// failure occurs on 21st log, compactLogs=1, outputCompactLogs=5 | ||
|
||
// test console is correct | ||
expect(stdout).to.contain(`[ ... 19 omitted logs ... ]`); | ||
expect(stdout).to.not.contain(`[ ... 15 omitted logs ... ]`); | ||
|
||
// test output log is correct | ||
const outputFile = path.join(__dirname, '../output/out.txt'); | ||
expect(fs.existsSync(outputFile), `Expected output file ${outputFile} to exist.`).to.be.true; | ||
const valueBuffer = fs.readFileSync(outputFile); | ||
let value = clean(valueBuffer.toString()); | ||
expect(value).to.contain(`[ ... 15 omitted logs ... ]`); | ||
expect(value).to.not.contain(`[ ... 19 omitted logs ... ]`); | ||
}); | ||
}).timeout(60000); | ||
}); |