New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@travetto/test

Package Overview
Dependencies
Maintainers
1
Versions
355
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.83 to 0.1.1

src/runner/executor/executor.ts

9

package.json

@@ -10,6 +10,5 @@ {

"dependencies": {
"@travetto/base": "^0.0.162",
"@travetto/exec": "^0.0.39",
"@travetto/pool": "^0.0.16",
"@travetto/registry": "^0.0.50",
"@travetto/exec": "^0.1.1",
"@travetto/pool": "^0.1.1",
"@travetto/registry": "^0.1.1",
"@types/js-yaml": "^3.11.1",

@@ -39,3 +38,3 @@ "@types/minimist": "^1.2.0",

},
"version": "0.0.83"
"version": "0.1.1"
}

@@ -1,6 +0,6 @@

import { TestEvent, EventPhase, EventEntity } from '../model';
import { ExecUtil, LocalExecution } from '@travetto/exec';
import { TestEvent } from '../model';
import { Consumer } from './types';
import { serializeError, LocalExecution } from '@travetto/exec';
export class ExecutionEmitter extends LocalExecution<TestEvent> implements Consumer {

@@ -12,7 +12,7 @@ onEvent(event: TestEvent) {

if (out.test.error) {
out.test.error = serializeError(out.test.error);
out.test.error = ExecUtil.serializeError(out.test.error);
}
} else if (out.type === 'assertion') {
if (out.assertion.error) {
out.assertion.error = serializeError(out.assertion.error);
out.assertion.error = ExecUtil.serializeError(out.assertion.error);
}

@@ -19,0 +19,0 @@ }

import * as yaml from 'js-yaml';
import { TestEvent, SuiteResult, AllSuitesResult, EventEntity, EventPhase } from '../model';
import { Consumer } from './types';
import { deserializeError } from '@travetto/exec';
import { ExecUtil } from '@travetto/exec';

@@ -58,3 +58,3 @@ export class TapEmitter implements Consumer {

if (test.error && test.error.stack && !test.error.stack.includes('AssertionError')) {
this.logMeta({ error: deserializeError(test.error).stack });
this.logMeta({ error: ExecUtil.deserializeError(test.error).stack });
}

@@ -61,0 +61,0 @@ }

@@ -1,5 +0,6 @@

import { AppEnv, isPlainObject, isFunction, isPrimitive, simplifyStack } from '@travetto/base';
import * as assert from 'assert';
import * as util from 'util';
import * as path from 'path';
import { Env, Util, Stacktrace } from '@travetto/base';
import { Assertion, TestConfig } from '../model';

@@ -38,6 +39,6 @@

function clean(val: any) {
if (val === null || val === undefined || (!(val instanceof RegExp) && isPrimitive(val)) || isPlainObject(val) || Array.isArray(val)) {
if (val === null || val === undefined || (!(val instanceof RegExp) && Util.isPrimitive(val)) || Util.isPlainObject(val) || Array.isArray(val)) {
return JSON.stringify(val);
} else {
if (!val.constructor || (!val.constructor.__id && isFunction(val))) {
if (!val.constructor || (!val.constructor.__id && Util.isFunction(val))) {
return val.name;

@@ -59,3 +60,3 @@ } else {

static readFilePosition(err: Error, filename: string) {
const base = AppEnv.cwd;
const base = Env.cwd;

@@ -172,3 +173,3 @@ const lines = (err.stack || new Error().stack!).split('\n').filter(x => !excludeNode.test(x) && x.includes(base));

if (e instanceof Error) {
(e as Error).stack = simplifyStack(e as Error);
(e as Error).stack = Stacktrace.simplifyStack(e as Error);
}

@@ -175,0 +176,0 @@ this.add(assertion);

@@ -1,4 +0,4 @@

import { LocalExecution, ChildExecution, serializeError } from '@travetto/exec';
import { LocalExecution, ChildExecution, ExecUtil } from '@travetto/exec';
import { ConcurrentPool, IdleManager } from '@travetto/pool';
import { PhaseManager } from '@travetto/base';
import { PhaseManager, Env } from '@travetto/base';

@@ -82,3 +82,3 @@ /***

for (const k of Object.keys(require.cache)) {
if (/node_modules/.test(k) && !/@travetto/.test(k)) {
if (/node_modules/.test(k) && (!/@travetto/.test(k) || /@travetto\/[^/]+\/node_modules/.test(k))) {
continue;

@@ -89,9 +89,9 @@ }

!(k.startsWith(__filename.replace(/.[tj]s$/, ''))) &&
!/[\/\\](phase|transformer)[\/\\]/.test(k) &&
!/transformer\..*\.ts/.test(k)) {
Compiler.unload(k);
!/(phase|transformer)[.]/.test(k)
) {
Compiler.unload(k, false);
}
}
// Relaod runner
// Reload runner
Compiler.workingSets = [data.file!];

@@ -107,3 +107,3 @@ Compiler.reset();

} catch (e) {
worker.send(Events.RUN_COMPLETE, { error: serializeError(e) });
worker.send(Events.RUN_COMPLETE, { error: ExecUtil.serializeError(e) });
}

@@ -121,3 +121,5 @@ }

return new ConcurrentPool(async () => {
const worker = new ChildExecution(require.resolve('../../bin/travetto-test.js'), true);
const worker = new ChildExecution(require.resolve('../../bin/travetto-test.js'), true, {
cwd: Env.cwd
});
worker.init();

@@ -124,0 +126,0 @@ await worker.listenOnce(Events.READY);

import * as util from 'util';
import { simplifyStack } from '@travetto/base';
import { Stacktrace } from '@travetto/base';

@@ -19,3 +19,3 @@ const OG_CONSOLE = {

if (x instanceof Error) {
return simplifyStack(x);
return Stacktrace.simplifyStack(x);
} else if (typeof x === 'string') {

@@ -22,0 +22,0 @@ return x;

export * from './runner';
export * from './execute';
export * from './executor';
export * from './console';

@@ -5,6 +5,6 @@ import * as minimist from 'minimist';

import { ArrayDataSource } from '@travetto/pool';
import { deserializeError } from '@travetto/exec';
import { ExecUtil } from '@travetto/exec';
import { Class } from '@travetto/registry';
import { ExecuteUtil } from './execute';
import { TestExecutor } from './executor';
import { ExecutionEmitter, Consumer, AllResultsCollector, TapEmitter, JSONEmitter } from '../consumer';

@@ -90,3 +90,3 @@ import { client, Events } from './communication';

// Glob to module path
const files = await ExecuteUtil.getTests(globs.map(x => new RegExp(`${x}`.replace(/[\\\/]/g, '/'))));
const files = await TestExecutor.getTests(globs.map(x => new RegExp(`${x}`.replace(/[\\\/]/g, '/'))));
return files;

@@ -113,3 +113,3 @@ }

errors.push((deserializeError(error)));
errors.push((ExecUtil.deserializeError(error)));
}

@@ -126,3 +126,3 @@ );

const args: string[] = this.state._;
return await ExecuteUtil.execute(consumer, args);
return await TestExecutor.execute(consumer, args);
}

@@ -129,0 +129,0 @@

@@ -1,13 +0,10 @@

import * as util from 'util';
import * as fs from 'fs';
import { TestRegistry } from '../service';
import { RootRegistry, MethodSource, Class } from '@travetto/registry';
import { TestConfig, SuiteConfig } from '../model';
import { ExecutionEmitter, Consumer } from '../consumer';
import { ChildExecution } from '@travetto/exec';
import { QueueDataSource } from '@travetto/pool';
import { client, Events } from './communication';
import { bulkRequire } from '@travetto/base';
import { TestRegistry } from '../service';
import { TestConfig, SuiteConfig } from '../model';
import { Consumer } from '../consumer';
function getConf(o?: [Class, Function]) {

@@ -115,3 +112,3 @@ if (o) {

// bulkRequire('test/**/*.ts');
// ScanFs.bulkRequire('test/**/*.ts');

@@ -118,0 +115,0 @@ console.debug('Waiting');

import * as ts from 'typescript';
import { TransformUtil, State } from '@travetto/compiler';
import { AppEnv } from '@travetto/base/src/env';
import { Env } from '@travetto/base/src/env';

@@ -51,3 +51,3 @@ const TEST_IMPORT = '@travetto/test';

// Only apply to test files
if (AppEnv.test &&
if (Env.test &&
name.includes('/test/') &&

@@ -54,0 +54,0 @@ !name.includes('/src/') &&

import * as ts from 'typescript';
import * as assert from 'assert';
import { TransformUtil, State } from '@travetto/compiler';
import { AppEnv } from '@travetto/base/src/env';
import { Env } from '@travetto/base/src/env';

@@ -177,3 +176,3 @@ const OPTOKEN_ASSERT_FN: { [key: number]: string } = {

// Only apply to test files
if (AppEnv.test &&
if (Env.test &&
name.includes('/test/') &&

@@ -180,0 +179,0 @@ !name.includes('/src/') &&

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