Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@serenity-js/assertions

Package Overview
Dependencies
Maintainers
1
Versions
360
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@serenity-js/assertions - npm Package Compare versions

Comparing version 2.0.1-alpha.57 to 2.0.1-alpha.58

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

## [2.0.1-alpha.58](https://github.com/jan-molak/serenity-js/compare/v2.0.1-alpha.57...v2.0.1-alpha.58) (2019-04-26)
### Features
* **assertions:** Ensure reports the actual value if the expectation is not met ([4d00be3](https://github.com/jan-molak/serenity-js/commit/4d00be3))
## [2.0.1-alpha.57](https://github.com/jan-molak/serenity-js/compare/v2.0.1-alpha.56...v2.0.1-alpha.57) (2019-04-25)

@@ -8,0 +19,0 @@

5

lib/Ensure.d.ts

@@ -1,2 +0,2 @@

import { Answerable, AnswersQuestions, AssertionError, Interaction, RuntimeError } from '@serenity-js/core';
import { Answerable, AnswersQuestions, AssertionError, CollectsArtifacts, Interaction, RuntimeError, UsesAbilities } from '@serenity-js/core';
import { Expectation } from './Expectation';

@@ -9,3 +9,3 @@ import { Outcome } from './outcomes';

constructor(actual: Answerable<Actual>, expectation: Expectation<Actual>);
performAs(actor: AnswersQuestions): PromiseLike<void>;
performAs(actor: UsesAbilities & AnswersQuestions & CollectsArtifacts): PromiseLike<void>;
toString(): string;

@@ -15,2 +15,3 @@ otherwiseFailWith(typeOfRuntimeError: new (message: string, cause?: Error) => RuntimeError, message?: string): Interaction;

protected asAssertionError(outcome: Outcome<any, Actual>): AssertionError;
private artifactFrom;
}

@@ -22,2 +22,4 @@ "use strict";

var io_1 = require("@serenity-js/core/lib/io");
var inspected_1 = require("@serenity-js/core/lib/io/inspected");
var model_1 = require("@serenity-js/core/lib/model");
var tiny_types_1 = require("tiny-types");

@@ -47,2 +49,3 @@ var outcomes_1 = require("./outcomes");

.when(outcomes_1.ExpectationNotMet, function (o) {
actor.collect(_this.artifactFrom(actual), new model_1.Name("Actual value"));
throw _this.errorForOutcome(o);

@@ -69,2 +72,8 @@ })

};
Ensure.prototype.artifactFrom = function (actual) {
return model_1.TextData.fromJSON({
contentType: 'text/plain',
data: inspected_1.inspected(actual),
});
};
return Ensure;

@@ -71,0 +80,0 @@ }(core_1.Interaction));

10

package.json
{
"name": "@serenity-js/assertions",
"version": "2.0.1-alpha.57",
"version": "2.0.1-alpha.58",
"description": "Screenplay-style assertion library",

@@ -48,5 +48,5 @@ "author": {

"devDependencies": {
"@documentation/esdoc-template": "2.0.1-alpha.57",
"@integration/testing-tools": "2.0.1-alpha.57",
"@serenity-js/core": "2.0.1-alpha.57",
"@documentation/esdoc-template": "2.0.1-alpha.58",
"@integration/testing-tools": "2.0.1-alpha.58",
"@serenity-js/core": "2.0.1-alpha.58",
"tiny-types": "1.12.1"

@@ -77,3 +77,3 @@ },

},
"gitHead": "f36b1fe28f2930412465587d1c59aa59aab586b7"
"gitHead": "22c12bf9d03c8059da5606904868305456e8f4b3"
}

@@ -1,3 +0,5 @@

import { Answerable, AnswersQuestions, AssertionError, Interaction, LogicError, RuntimeError } from '@serenity-js/core';
import { Answerable, AnswersQuestions, AssertionError, CollectsArtifacts, Interaction, LogicError, RuntimeError, UsesAbilities } from '@serenity-js/core';
import { formatted } from '@serenity-js/core/lib/io';
import { inspected } from '@serenity-js/core/lib/io/inspected';
import { Artifact, Name, TextData } from '@serenity-js/core/lib/model';
import { match } from 'tiny-types';

@@ -20,3 +22,3 @@

performAs(actor: AnswersQuestions): PromiseLike<void> {
performAs(actor: UsesAbilities & AnswersQuestions & CollectsArtifacts): PromiseLike<void> {
return Promise.all([

@@ -30,2 +32,4 @@ actor.answer(this.actual),

.when(ExpectationNotMet, o => {
actor.collect(this.artifactFrom(actual), new Name(`Actual value`));
throw this.errorForOutcome(o);

@@ -60,2 +64,9 @@ })

}
private artifactFrom(actual: Actual): Artifact {
return TextData.fromJSON({
contentType: 'text/plain',
data: inspected(actual),
});
}
}

@@ -62,0 +73,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc