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

@travetto/test

Package Overview
Dependencies
Maintainers
1
Versions
352
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@travetto/test - npm Package Compare versions

Comparing version 0.0.30 to 0.0.31

2

package.json

@@ -31,3 +31,3 @@ {

},
"version": "0.0.30"
"version": "0.0.31"
}

@@ -16,2 +16,4 @@ import { Class } from '@travetto/registry/src/model/types';

export interface Assertion {
className: string;
methodName: string;
actual?: any;

@@ -18,0 +20,0 @@ expected?: any;

import { AppEnv } from '@travetto/base';
import * as assert from 'assert';
import { Assertion } from '../model';
import { Assertion, TestConfig } from '../model';
import * as _ from 'lodash';

@@ -54,2 +54,3 @@

static listener?: (a: Assertion) => void;
static test: TestConfig;

@@ -79,3 +80,4 @@ static readFilePosition(err: Error, filename: string) {

static start(listener?: (a: Assertion) => void) {
static start(test: TestConfig, listener?: (a: Assertion) => void) {
this.test = test;
this.listener = listener;

@@ -88,3 +90,8 @@ this.asserts = [];

const assertion: Assertion = { file, line, text, operator: ASSERT_FN_OPERATOR[name] };
const assertion: Assertion = {
className: this.test.className,
methodName: this.test.methodName,
file, line, text,
operator: ASSERT_FN_OPERATOR[name]
};
if (name === 'fail') {

@@ -169,5 +176,5 @@ if (args.length > 1) {

this.asserts = [];
this.listener = undefined;
delete this.listener, this.test;
return ret;
}
}

@@ -24,3 +24,3 @@ import * as fs from 'fs';

static async generateSuiteError(consumer: Consumer, suite: SuiteConfig, description: string, error: Error) {
static async generateSuiteError(consumer: Consumer, suite: SuiteConfig, methodName: string, error: Error) {
const { line, file } = AssertUtil.readFilePosition(error, suite.file);

@@ -31,4 +31,6 @@ const badAssert: Assertion = {

error,
className: suite.className,
methodName,
message: error.message,
text: '(outer)',
text: methodName,
operator: 'throws'

@@ -39,4 +41,4 @@ };

className: suite.className,
methodName: description,
description,
methodName,
description: methodName,
lines: { start: line, end: line },

@@ -51,4 +53,4 @@ file,

class: suite.class,
className: badTest.className,
file: badTest.file,
className: suite.className,
file: suite.file,
lines: badTest.lines,

@@ -74,6 +76,7 @@ methodName: badTest.methodName,

if (error === TIMEOUT) {
error = new Error(`${suite.className}: ${phase} timed out`);;
error = new Error(`${suite.className}: ${phase} timed out`);
}
const res = await this.generateSuiteError(consumer, suite, phase, error);
result.tests.push(res);
result.fail++;
throw BREAKOUT;

@@ -148,3 +151,5 @@ }

AssertUtil.start((a) => consumer.onEvent({ type: 'assertion', phase: 'after', assertion: a }));
AssertUtil.start(test, (a) => {
consumer.onEvent({ type: 'assertion', phase: 'after', assertion: a });
});

@@ -175,5 +180,9 @@ const timeout = this.asyncTimeout(test.timeout);

const { file, line } = AssertUtil.readFilePosition(err, test.file);
const assertion: Assertion = { file, line, operator: 'throws', text: '(uncaught)', error: err, message: err.message };
// result.output = result.output || {};
// result.output['error'] = `${(result.output['error'] || '')}\n${err.stack}`;
const assertion: Assertion = {
className: test.className,
methodName: test.methodName,
file, line,
operator: 'throws', text: '(uncaught)',
error: err, message: err.message
};
result.assertions.push(assertion);

@@ -207,7 +216,6 @@ }

} catch (e) {
if (e === BREAKOUT) {
// Done
} else {
if (e !== BREAKOUT) {
const res = await this.generateSuiteError(consumer, suite, 'all', e);
result.tests.push(res);
result.fail++;
}

@@ -246,7 +254,6 @@ }

} catch (e) {
if (e === BREAKOUT) {
// Done
} else {
if (e !== BREAKOUT) {
const res = await this.generateSuiteError(consumer, suite, 'all', e);
result.tests.push(res);
result.fail++;
}

@@ -253,0 +260,0 @@ }

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