Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
with
2,312 additions
and 3 deletions.
- +1 −0 documentation/website/package.json
- +7 −0 integration/jasmine/.gitignore
- +21 −0 integration/jasmine/examples/custom-reporter-requirements/jasmine_exclusions.js
- +21 −0 integration/jasmine/examples/custom-reporter-requirements/jasmine_failure_types.js
- +9 −0 integration/jasmine/examples/failing/assertion-fails.spec.js
- +9 −0 integration/jasmine/examples/failing/error-thrown.spec.js
- +9 −0 integration/jasmine/examples/failing/marked-as-failing.spec.js
- +13 −0 integration/jasmine/examples/failing/multiple-failures.spec.js
- +9 −0 integration/jasmine/examples/location.spec.js
- +9 −0 integration/jasmine/examples/passing.spec.js
- +9 −0 integration/jasmine/examples/pending/marked-as-pending-with-reason.spec.js
- +8 −0 integration/jasmine/examples/pending/marked-as-pending-xdescribe.spec.js
- +8 −0 integration/jasmine/examples/pending/marked-as-pending-xit.spec.js
- +7 −0 integration/jasmine/examples/pending/missing-implementation.spec.js
- +8 −0 integration/jasmine/examples/setup.js
- +39 −0 integration/jasmine/package.json
- +81 −0 integration/jasmine/spec/custom_reporter.spec.ts
- +57 −0 integration/jasmine/spec/detecting_file_system_location.spec.ts
- +122 −0 integration/jasmine/spec/failing_scenarios.spec.ts
- +25 −0 integration/jasmine/spec/passing_scenario.spec.ts
- +91 −0 integration/jasmine/spec/pending_scenarios.spec.ts
- +33 −0 integration/jasmine/src/jasmine.ts
- +10 −0 integration/jasmine/tsconfig-lint.json
- +13 −0 integration/jasmine/tsconfig.json
- +4 −0 packages/core/src/events/TestRunFinished.ts
- +24 −0 packages/core/src/events/TestSuiteFinished.ts
- +21 −0 packages/core/src/events/TestSuiteStarts.ts
- +2 −0 packages/core/src/events/index.ts
- +15 −0 packages/core/src/io/ErrorStackParser.ts
- +1 −0 packages/core/src/io/index.ts
- +22 −0 packages/core/src/model/TestSuiteDetails.ts
- +1 −0 packages/core/src/model/index.ts
- +4 −3 packages/core/src/stage/crew/serenity-bdd-reporter/reports/ErrorRenderer.ts
- +1 −0 packages/jasmine/.esdoc.js
- +9 −0 packages/jasmine/.gitignore
- +14 −0 packages/jasmine/.npmignore
- +201 −0 packages/jasmine/LICENSE.md
- +1 −0 packages/jasmine/NOTICE.md
- +26 −0 packages/jasmine/README.md
- +78 −0 packages/jasmine/package.json
- +708 −0 packages/jasmine/spec/SerenityReporterForJasmine.spec.ts
- +66 −0 packages/jasmine/spec/monkeyPatched.spec.ts
- +190 −0 packages/jasmine/src/SerenityReporterForJasmine.ts
- +28 −0 packages/jasmine/src/bootstrap.ts
- +3 −0 packages/jasmine/src/index.ts
- +24 −0 packages/jasmine/src/jasmine/Expectation.ts
- +27 −0 packages/jasmine/src/jasmine/JasmineDoneInfo.ts
- +17 −0 packages/jasmine/src/jasmine/JasmineStartedInfo.ts
- +11 −0 packages/jasmine/src/jasmine/Location.ts
- +11 −0 packages/jasmine/src/jasmine/Order.ts
- +25 −0 packages/jasmine/src/jasmine/Result.ts
- +33 −0 packages/jasmine/src/jasmine/SpecResult.ts
- +32 −0 packages/jasmine/src/jasmine/SuiteResult.ts
- +6 −0 packages/jasmine/src/jasmine/index.ts
- +56 −0 packages/jasmine/src/mokeyPatched.ts
- +10 −0 packages/jasmine/tsconfig-lint.json
- +22 −0 packages/jasmine/tsconfig.json
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
@@ -0,0 +1,7 @@ | ||
# Node | ||
node_modules | ||
*.log | ||
|
||
# Build artifacts | ||
.nyc_output | ||
lib |
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
@@ -0,0 +1,21 @@ | ||
describe('excluded suite', function () { | ||
it('will be excluded', function () { | ||
expect(1).toBe(2); | ||
}); | ||
}); | ||
|
||
fdescribe('focused suite, excludes other suites and specs', function () { | ||
xdescribe('pending suite', function () { | ||
it('will be pending', function () { | ||
expect(2).toBe(1); | ||
}); | ||
}); | ||
|
||
xit('pending spec', function () { | ||
expect(2).toBe(4); | ||
}); | ||
|
||
it('spec', function () { | ||
expect(1).toBe(1); | ||
}); | ||
}); |
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
@@ -0,0 +1,21 @@ | ||
beforeAll(function () { | ||
fail('beforeAll') | ||
}); | ||
|
||
afterAll(function () { | ||
fail('afterAll'); | ||
}); | ||
|
||
describe('a suite', function () { | ||
beforeAll(function () { | ||
fail('suite beforeAll'); | ||
}); | ||
|
||
afterAll(function () { | ||
fail('suite afterAll'); | ||
}); | ||
|
||
it('a spec', function () { | ||
fail('spec'); | ||
}); | ||
}); |
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
@@ -0,0 +1,9 @@ | ||
describe('Jasmine', () => { | ||
|
||
describe('A scenario', () => { | ||
|
||
it('fails when the assertion fails', () => { | ||
expect(false).toEqual(true); | ||
}); | ||
}); | ||
}); |
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
@@ -0,0 +1,9 @@ | ||
describe('Jasmine', () => { | ||
|
||
describe('A scenario', () => { | ||
|
||
it('fails when an error is thrown', () => { | ||
throw new Error(`Something happened`); // fail with throw | ||
}); | ||
}); | ||
}); |
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
@@ -0,0 +1,9 @@ | ||
describe('Jasmine', () => { | ||
|
||
describe('A scenario', () => { | ||
|
||
it('fails when marked as failed', () => { | ||
fail(`Something happened`); | ||
}); | ||
}); | ||
}); |
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
@@ -0,0 +1,13 @@ | ||
describe('Jasmine', () => { | ||
|
||
describe('A scenario', () => { | ||
|
||
it('can fail with multiple failures', () => { | ||
expect(true).toEqual(true); | ||
|
||
fail(`first issue`); | ||
fail(`second issue`); | ||
expect(false).toEqual(true); | ||
}); | ||
}); | ||
}); |
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
@@ -0,0 +1,9 @@ | ||
describe('Jasmine', () => { | ||
|
||
describe('Detecting file system location', () => { | ||
|
||
it('works for both the suites and the individual specs', () => { | ||
// no-op | ||
}); | ||
}); | ||
}); |
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
@@ -0,0 +1,9 @@ | ||
describe('Jasmine', () => { | ||
|
||
describe('A scenario', () => { | ||
|
||
it('passes', () => { | ||
expect(true).toBe(true); | ||
}); | ||
}); | ||
}); |
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
@@ -0,0 +1,9 @@ | ||
describe('Jasmine', () => { | ||
|
||
describe('A scenario', () => { | ||
|
||
it(`is marked as pending`, () => { | ||
pending('implementation missing'); | ||
}); | ||
}); | ||
}); |
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
@@ -0,0 +1,8 @@ | ||
describe('Jasmine', () => { | ||
|
||
xdescribe('A scenario', () => { | ||
|
||
it(`is marked as pending`, () => { | ||
}); | ||
}); | ||
}); |
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
@@ -0,0 +1,8 @@ | ||
describe('Jasmine', () => { | ||
|
||
describe('A scenario', () => { | ||
|
||
xit(`is marked as pending`, () => { | ||
}); | ||
}); | ||
}); |
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
@@ -0,0 +1,7 @@ | ||
describe('Jasmine', () => { | ||
|
||
describe('A scenario', () => { | ||
|
||
it(`is marked as pending when it hasn't been implemented yet`); | ||
}); | ||
}); |
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
@@ -0,0 +1,8 @@ | ||
const | ||
{ ChildProcessReporter } = require('@integration/testing-tools'), | ||
{ serenity, DebugReporter } = require('@serenity-js/core'); | ||
|
||
serenity.setTheStage( | ||
new ChildProcessReporter(), | ||
new DebugReporter(), | ||
); |
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
@@ -0,0 +1,39 @@ | ||
{ | ||
"name": "@integration/jasmine", | ||
"version": "2.0.1-alpha.64", | ||
"description": "Jasmine integration tests", | ||
"author": { | ||
"name": "Jan Molak", | ||
"email": "jan.molak@smartcodeltd.co.uk", | ||
"url": "https://janmolak.com" | ||
}, | ||
"homepage": "http://serenity-js.org", | ||
"license": "Apache-2.0", | ||
"private": true, | ||
"config": { | ||
"access": "private" | ||
}, | ||
"scripts": { | ||
"clean": "rimraf lib", | ||
"lint": "tslint --project tsconfig-lint.json --config ../../tslint.json --format stylish", | ||
"test": "parallel-mocha --opts ../../mocha.opts 'spec/**/*.spec.*'", | ||
"test:parallel": "mocha-parallel-tests --opts ../../mocha.opts 'spec/**/*.spec.*'" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/jan-molak/serenity-js.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/jan-molak/serenity-js/issues" | ||
}, | ||
"engines": { | ||
"node": ">= 6.9.x", | ||
"npm": ">= 3" | ||
}, | ||
"dependencies": { | ||
"@integration/testing-tools": "2.0.1-alpha.64", | ||
"@serenity-js/core": "2.0.1-alpha.64", | ||
"@serenity-js/jasmine": "2.0.1-alpha.64", | ||
"jasmine": "^3.4.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
@@ -0,0 +1,81 @@ | ||
import { expect, ifExitCodeIsOtherThan, logOutput, PickEvent } from '@integration/testing-tools'; | ||
import { SceneFinished, SceneStarts, SceneTagged, TestRunnerDetected, TestSuiteFinished, TestSuiteStarts } from '@serenity-js/core/lib/events'; | ||
import { ExecutionFailedWithError, ExecutionSkipped, ExecutionSuccessful, FeatureTag, ImplementationPending, Name, ProblemIndication } from '@serenity-js/core/lib/model'; | ||
import 'mocha'; | ||
import { jasmine } from '../src/jasmine'; | ||
|
||
describe('@serenity-js/jasmine', function () { | ||
|
||
this.timeout(5000); | ||
|
||
/** | ||
* @see https://jasmine.github.io/tutorials/custom_reporter | ||
*/ | ||
describe('to meet the requirements for custom reporters', () => { | ||
|
||
/** | ||
* @see https://jasmine.github.io/examples/jasmine_failure_types.js | ||
*/ | ||
it('recognises "all the possible" failure modes', () => | ||
jasmine( | ||
'examples/custom-reporter-requirements/jasmine_failure_types.js', | ||
'--random=false', | ||
) | ||
.then(ifExitCodeIsOtherThan(1, logOutput)) | ||
.then(res => { | ||
|
||
expect(res.exitCode).to.equal(1); | ||
|
||
PickEvent.from(res.events) | ||
.next(TestSuiteStarts, event => expect(event.value.name).to.equal(new Name(`a suite`))) | ||
.next(SceneStarts, event => expect(event.value.name).to.equal(new Name(`a spec`))) | ||
.next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag('a suite'))) | ||
.next(TestRunnerDetected, event => expect(event.value).to.equal(new Name('Jasmine'))) | ||
.next(SceneFinished, event => { | ||
const outcome = event.outcome as ProblemIndication; | ||
expect(outcome).to.be.instanceOf(ExecutionFailedWithError); | ||
|
||
expect(outcome.error).to.be.instanceof(Error); | ||
expect(outcome.error.message).to.equal('Failed: spec'); // there's no message when the spec body is missing | ||
}) | ||
.next(TestSuiteFinished, event => { | ||
expect(event.value.name).to.equal(new Name(`a suite`)); | ||
expect(event.outcome).to.be.instanceof(ExecutionFailedWithError); | ||
expect((event.outcome as ExecutionFailedWithError).error.message).to.equal('Failed: suite beforeAll'); | ||
}) | ||
; | ||
})); | ||
|
||
/** | ||
* @see https://jasmine.github.io/examples/jasmine_exclusions.js | ||
*/ | ||
it('recognises the pending, excluded and skipped scenarios', () => | ||
jasmine( | ||
'examples/custom-reporter-requirements/jasmine_exclusions.js', | ||
'--random=false', | ||
) | ||
.then(ifExitCodeIsOtherThan(1, logOutput)) | ||
.then(res => { | ||
|
||
expect(res.exitCode).to.equal(1); | ||
|
||
PickEvent.from(res.events) | ||
.next(SceneStarts, event => expect(event.value.name).to.equal(new Name(`pending suite will be pending`))) | ||
.next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag(`focused suite, excludes other suites and specs`))) | ||
.next(SceneFinished, event => expect(event.outcome).to.be.instanceof(ImplementationPending)) | ||
|
||
.next(SceneStarts, event => expect(event.value.name).to.equal(new Name(`pending spec`))) | ||
.next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag(`focused suite, excludes other suites and specs`))) | ||
.next(SceneFinished, event => expect(event.outcome).to.be.instanceof(ImplementationPending)) | ||
|
||
.next(SceneStarts, event => expect(event.value.name).to.equal(new Name(`spec`))) | ||
.next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag(`focused suite, excludes other suites and specs`))) | ||
.next(SceneFinished, event => expect(event.outcome).to.be.instanceof(ExecutionSuccessful)) | ||
|
||
.next(SceneStarts, event => expect(event.value.name).to.equal(new Name(`will be excluded`))) | ||
.next(SceneTagged, event => expect(event.tag).to.equal(new FeatureTag(`excluded suite`))) | ||
.next(SceneFinished, event => expect(event.outcome).to.be.instanceof(ExecutionSkipped)) | ||
; | ||
})); | ||
}); | ||
}); |
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
@@ -0,0 +1,57 @@ | ||
import 'mocha'; | ||
|
||
import { expect, ifExitCodeIsOtherThan, logOutput, PickEvent } from '@integration/testing-tools'; | ||
import { SceneFinished, SceneStarts, TestSuiteFinished, TestSuiteStarts } from '@serenity-js/core/lib/events'; | ||
import { Name } from '@serenity-js/core/lib/model'; | ||
import { jasmine } from '../src/jasmine'; | ||
|
||
describe('@serenity-js/jasmine', function () { | ||
|
||
this.timeout(5000); | ||
|
||
it('detects the filesystem location of a test suite and individual specs', () => jasmine('examples/location.spec.js') | ||
.then(ifExitCodeIsOtherThan(0, logOutput)) | ||
.then(res => { | ||
|
||
expect(res.exitCode).to.equal(0); | ||
|
||
PickEvent.from(res.events) | ||
.next(TestSuiteStarts, event => { | ||
expect(event.value.name).to.equal(new Name('Jasmine')); | ||
expect(event.value.location.path.value).to.match(/location.spec.js$/); | ||
expect(event.value.location.line).to.equal(1); | ||
// expect(event.value.location.column).to.equal(1); | ||
}) | ||
.next(TestSuiteStarts, event => { | ||
expect(event.value.name).to.equal(new Name('Detecting file system location')); | ||
expect(event.value.location.path.value).to.match(/location.spec.js$/); | ||
expect(event.value.location.line).to.equal(3); | ||
expect(event.value.location.column).to.equal(5); | ||
}) | ||
.next(SceneStarts, event => { | ||
expect(event.value.name).to.equal(new Name('Detecting file system location works for both the suites and the individual specs')); | ||
expect(event.value.location.path.value).to.match(/location.spec.js$/); | ||
expect(event.value.location.line).to.equal(5); | ||
expect(event.value.location.column).to.equal(9); | ||
}) | ||
.next(SceneFinished, event => { | ||
expect(event.value.name).to.equal(new Name('Detecting file system location works for both the suites and the individual specs')); | ||
expect(event.value.location.path.value).to.match(/location.spec.js$/); | ||
expect(event.value.location.line).to.equal(5); | ||
expect(event.value.location.column).to.equal(9); | ||
}) | ||
.next(TestSuiteFinished, event => { | ||
expect(event.value.name).to.equal(new Name('Detecting file system location')); | ||
expect(event.value.location.path.value).to.match(/location.spec.js$/); | ||
expect(event.value.location.line).to.equal(3); | ||
expect(event.value.location.column).to.equal(5); | ||
}) | ||
.next(TestSuiteFinished, event => { | ||
expect(event.value.name).to.equal(new Name('Jasmine')); | ||
expect(event.value.location.path.value).to.match(/location.spec.js$/); | ||
expect(event.value.location.line).to.equal(1); | ||
// expect(event.value.location.column).to.equal(1); | ||
}) | ||
; | ||
})); | ||
}); |
Oops, something went wrong.