Socket
Socket
Sign inDemoInstall

ava-ts

Package Overview
Dependencies
440
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.24.6 to 0.25.0

2

cli.js

@@ -11,3 +11,3 @@ #!/usr/bin/env node

if (debug.enabled) {
require('time-require'); // eslint-disable-line import/no-unassigned-import
require('@ladjs/time-require'); // eslint-disable-line import/no-unassigned-import
}

@@ -14,0 +14,0 @@

@@ -52,2 +52,7 @@ 'use strict';

this.stack = opts.stack;
} else {
const limitBefore = Error.stackTraceLimit;
Error.stackTraceLimit = Infinity;
Error.captureStackTrace(this);
Error.stackTraceLimit = limitBefore;
}

@@ -59,4 +64,7 @@ }

function getStack() {
const limitBefore = Error.stackTraceLimit;
Error.stackTraceLimit = Infinity;
const obj = {};
Error.captureStackTrace(obj, getStack);
Error.stackTraceLimit = limitBefore;
return obj.stack;

@@ -127,4 +135,12 @@ }

log(text) {
log(this, text);
log() {
const args = Array.from(arguments, value => {
return typeof value === 'string' ?
value :
concordance.format(value, concordanceOptions);
});
if (args.length > 0) {
log(this, args.join(' '));
}
},

@@ -131,0 +147,0 @@

@@ -26,4 +26,2 @@ 'use strict';

Error.stackTraceLimit = Infinity;
function test(props) {

@@ -30,0 +28,0 @@ if (isFailed) {

@@ -51,3 +51,3 @@ 'use strict';

if (debug.enabled) {
// Forward the `time-require` `--sorted` flag.
// Forward the `@ladjs/time-require` `--sorted` flag.
// Intended for internal optimization tests only.

@@ -58,3 +58,3 @@ if (opts._sorted) {

require('time-require'); // eslint-disable-line import/no-unassigned-import
require('@ladjs/time-require'); // eslint-disable-line import/no-unassigned-import
}

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

'use strict';
const format = require('util').format;
const indentString = require('indent-string');
const supertap = require('supertap');
const stripAnsi = require('strip-ansi');
const yaml = require('js-yaml');

@@ -35,3 +33,3 @@ function dumpError(error, includeMessage) {

return ` ---\n${indentString(yaml.safeDump(obj).trim(), 4)}\n ...`;
return obj;
}

@@ -45,75 +43,38 @@

start() {
return 'TAP version 13';
return supertap.start();
}
test(test) {
const output = [];
let directive = '';
const passed = test.todo ? 'not ok' : 'ok';
if (test.todo) {
directive = '# TODO';
} else if (test.skip) {
directive = '# SKIP';
}
const title = stripAnsi(test.title);
const appendLogs = () => {
if (test.logs) {
test.logs.forEach(log => {
const logLines = indentString(log, 4);
const logLinesWithLeadingFigure = logLines.replace(
/^ {4}/,
' * '
);
output.push(logLinesWithLeadingFigure);
});
}
};
output.push(`# ${title}`);
if (test.error) {
output.push(format('not ok %d - %s', ++this.i, title));
appendLogs();
output.push(dumpError(test.error, true));
} else {
output.push(format('%s %d - %s %s', passed, ++this.i, title, directive).trim());
appendLogs();
}
return output.join('\n');
return supertap.test(test.title, {
passed: !test.error,
index: ++this.i,
todo: test.todo,
skip: test.skip,
comment: test.logs,
error: test.error ? dumpError(test.error, true) : null
});
}
unhandledError(err) {
const output = [
`# ${err.message}`,
format('not ok %d - %s', ++this.i, err.message)
];
let error;
// AvaErrors don't have stack traces
if (err.type !== 'exception' || err.name !== 'AvaError') {
output.push(dumpError(err, false));
error = dumpError(err, false);
}
return output.join('\n');
return supertap.test(err.message, {
passed: false,
index: ++this.i,
error
});
}
finish(runStatus) {
const output = [
'',
'1..' + (runStatus.passCount + runStatus.failCount + runStatus.skipCount),
'# tests ' + (runStatus.passCount + runStatus.failCount + runStatus.skipCount),
'# pass ' + runStatus.passCount
];
if (runStatus.skipCount > 0) {
output.push(`# skip ${runStatus.skipCount}`);
}
output.push('# fail ' + (runStatus.failCount + runStatus.rejectionCount + runStatus.exceptionCount), '');
return output.join('\n');
return supertap.finish({
passed: runStatus.passCount,
failed: runStatus.failCount,
skipped: runStatus.skipCount,
crashed: runStatus.rejectionCount + runStatus.exceptionCount
});
}

@@ -120,0 +81,0 @@

@@ -31,4 +31,11 @@ 'use strict';

process.env.TS_NODE_TYPE_CHECK = true;
(opts.require || []).forEach(x => require(x));
(opts.require || []).forEach(x => {
if (/[/\\]@std[/\\]esm[/\\]index\.js$/.test(x)) {
require = require(x)(module); // eslint-disable-line no-global-assign
} else {
require(x);
}
});
adapter.installSourceMapSupport();

@@ -35,0 +42,0 @@ adapter.installPrecompilerHook();

{
"name": "ava-ts",
"version": "0.24.6",
"version": "0.25.0",
"description": "Fork of the AVA test runner with native typescript support 🚀",

@@ -34,2 +34,3 @@ "license": "MIT",

"@concordance/react": "^1.0.0",
"@ladjs/time-require": "^0.1.4",
"ansi-escapes": "^3.0.0",

@@ -43,4 +44,4 @@ "ansi-styles": "^3.1.0",

"ava-init": "^0.2.0",
"babel-core": "^6.17.0",
"babel-generator": "^6.26.0",
"babel-core": "^6.26.3",
"babel-generator": "^6.26.1",
"babel-plugin-syntax-object-rest-spread": "^6.13.0",

@@ -50,3 +51,3 @@ "bluebird": "^3.0.0",

"chalk": "^2.0.1",
"chokidar": "^1.4.2",
"chokidar": "^2.0.4",
"clean-stack": "^1.1.1",

@@ -58,9 +59,9 @@ "clean-yaml-object": "^0.1.0",

"co-with-promise": "^4.6.0",
"code-excerpt": "^2.1.0",
"code-excerpt": "^2.1.1",
"common-path-prefix": "^1.0.0",
"concordance": "^3.0.0",
"convert-source-map": "^1.2.0",
"convert-source-map": "^1.5.1",
"core-assert": "^0.2.0",
"currently-unhandled": "^0.4.1",
"debug": "^3.0.1",
"debug": "^3.1.0",
"dot-prop": "^4.1.0",

@@ -75,3 +76,3 @@ "empower-core": "^0.6.1",

"has-flag": "^2.0.0",
"hullabaloo-config-manager": "^1.1.0",
"hullabaloo-config-manager": "^1.1.1",
"ignore-by-default": "^1.0.0",

@@ -85,3 +86,2 @@ "import-local": "^0.1.1",

"is-promise": "^2.1.0",
"js-yaml": "^3.8.2",
"last-line-stream": "^1.0.0",

@@ -114,4 +114,4 @@ "lodash.clonedeepwith": "^4.5.0",

"strip-bom-buf": "^1.0.0",
"supertap": "^1.0.0",
"supports-color": "^5.0.0",
"time-require": "^0.1.2",
"trim-off-newlines": "^1.0.1",

@@ -122,5 +122,6 @@ "unique-temp-dir": "^1.0.0",

"devDependencies": {
"ava": "^0.23.0",
"@std/esm": "^0.19.1",
"ava": "^0.25.0",
"cli-table2": "^0.2.0",
"codecov": "^3.0.0",
"codecov": "^3.0.4",
"del": "^3.0.0",

@@ -149,3 +150,3 @@ "delay": "^2.0.0",

"typescript": "^2.2.2",
"xo": "^0.18.2",
"xo": "^0.19.0",
"zen-observable": "^0.6.0"

@@ -152,0 +153,0 @@ },

@@ -10,2 +10,5 @@ export type ErrorValidator

}
export interface SnapshotOptions {
id?: string;
}
export type Test = (t: TestContext) => PromiseLike<void> | Iterator<any> | Observable | void;

@@ -82,2 +85,3 @@ export type GenericTest<T> = (t: GenericTestContext<T>) => PromiseLike<void> | Iterator<any> | Observable | void;

snapshot(contents: any, message?: string): void;
snapshot(contents: any, options: SnapshotOptions, message?: string): void;
/**

@@ -105,5 +109,5 @@ * Assert that contents does not match regex.

/**
* Print a log message contextually alongside the test result instead of immediately printing it to stdout like console.log.
* Log values contextually alongside the test result instead of immediately printing them to `stdout`.
*/
log(message: string): void;
log(...values: any[]): void;
}

@@ -110,0 +114,0 @@ export interface CallbackTestContext extends TestContext {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc