@NickTomlin I added a flakey test output file for jasmine-spec-reporter, and the following unit test:
it('isolates individual failed specs from jasmine-spec-reporter output', () => {
protractorFlake({maxAttempts: 3})
spawnStub.dataCallback(failedJasmineSpecReporterTestOutput)
spawnStub.endCallback(1)
expect(spawnStub).to.have.been.calledWith('node', [pathToProtractor(), '--params.flake.retry', true, '--specs', '/tests/a-flakey.test.js'])
})
but it's failing with this error:
1) Protractor Flake failed specs isolates individual failed specs from jasmine-spec-reporter output:
AssertionError: expected stub to have been called with arguments node, ["/Users/brine/protractor-flake/node_modules/protractor/bin/protractor", "--params.flake.retry", true, "--specs", "/tests/a-flakey.test.js"]%D
at Context.<anonymous> (test/unit/index.test.js:103:38)
What am I doon wrong?
const protractorFlake = require('protractor-flake');
// skip first two passed args (node and self)
let protractorArgs = process.argv.splice(2);
protractorFlake({
protractorPath: 'node_modules/.bin/protractor',
maxAttempts: 2,
parser: 'multi',
nodeBin: 'node',
protractorArgs: protractorArgs
}, (status, output) => {
process.exit(status);
});
module default {
name: 'rerun',
parse (protractorTestOutput) {
let failedSpecs = new Set()
// ... analyze protractor test output
// ... and add to specFiles
failedSpecs.add('specfile')
// specFiles to be re-run by protractor-flake
// if an empty array is returned, all specs will be re-run
return [...failedSpecs]
}
}
because what should happen is the following
Your setup:
A test in file test-1.e2e.ts
and test-2.e2e.ts
fail. The generate a loggin which tells that the files failed
Protractor-flake should read that logging and see that 2 files files, he should provide them again to protractor to do the rerun
test-3.e2e.ts
should not be ran