Comparing version 2.0.0-alpha.0 to 2.0.0-alpha.1
{ | ||
"name": "tap-bark", | ||
"version": "2.0.0-alpha.0", | ||
"version": "2.0.0-alpha.1", | ||
"description": "TAP parser for Alsatian", | ||
"main": "src/tap-bark.js", | ||
"typings": "src/tap-bark.d.ts", | ||
"main": "dist/tap-bark.js", | ||
"typings": "dist/tap-bark.d.ts", | ||
"bin": { | ||
"tap-bark": "index.js" | ||
"tap-bark": "dist/cli.js" | ||
}, | ||
"scripts": { | ||
"pretest": "npm run install-self && npm run build-integration-tests && npm run build-with-maps", | ||
"install-self": "npm run build && install-self", | ||
"test": "npm run tests-with-coverage", | ||
"tests-with-coverage": "nyc --reporter=lcov --reporter=html alsatian \"./test/**/*.test.js\" && nyc report", | ||
"review": "tslint \"./**/*.ts\" --exclude \"./**/*.d.ts\" --exclude \"./node_modules/**/*.ts\"", | ||
"build": "tsc", | ||
"build-with-maps": "tsc --sourceMap -p ./", | ||
"build-integration-tests": "tsc -p test/integration-tests" | ||
"build": "npm run build:code && npm run build:tests", | ||
"build:code": "tsc", | ||
"build:tests": "tsc -p test", | ||
"build:integration-tests": "install-self && tsc -p test/integration-tests", | ||
"lint": "tslint \"./**/*.ts\" --exclude \"./**/*.d.ts\" --exclude \"./**/*.test.ts\" --exclude \"./node_modules/**/*.ts\"", | ||
"lint:fix": "npm run lint -- --fix", | ||
"prepublishOnly": "npm test && npm run build", | ||
"pretest": "npm run build:integration-tests && npm run build", | ||
"test": "npm run lint && npm run test:coverage", | ||
"test:coverage": "nyc --reporter=lcov --reporter=html npm run test:unit -- --hide-progress && nyc report", | ||
"test:unit": "alsatian \"./test-build/**/*.test.js\"" | ||
}, | ||
@@ -42,12 +45,13 @@ "repository": { | ||
"@types/through2": "^2.0.34", | ||
"alsatian": "^1.0.0-beta.4", | ||
"alsatian": "^3.0.0-alpha.1", | ||
"chalk": "^2.4.1", | ||
"codeclimate-test-reporter": "^0.4.0", | ||
"coveralls": "^2.11.15", | ||
"in-publish": "^2.0.0", | ||
"install-self": "^1.0.0-beta.6", | ||
"install-self": "^1.0.0-beta.7", | ||
"nyc": "^10.0.0", | ||
"tslint": "^4.0.2", | ||
"prettier": "^1.10.2", | ||
"tslint": "^5.11.0", | ||
"tslint-plugin-prettier": "^1.3.0", | ||
"typescript": "^2.0.3" | ||
} | ||
} |
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const chalk_1 = require("chalk"); | ||
const through = require("through2"); | ||
const parser = require("tap-parser"); | ||
const duplexer = require("duplexer"); | ||
const { h, render, Component, Color, Indent } = require("ink"); | ||
const TAP_PARSER = parser(); | ||
class TapBarkOutput extends Component { | ||
constructor() { | ||
super(); | ||
this.FIXTURE_REGEXP = /^# FIXTURE (.*)/; | ||
this.CONSOLE_WARNING_REGEXP = /^# WARN: (.*)/; | ||
this._completeCalled = false; | ||
this.warnings = []; | ||
this.state = { | ||
var chalk_1 = require("chalk"); | ||
var through = require("through2"); | ||
var parser = require("tap-parser"); | ||
var duplexer = require("duplexer"); | ||
var _a = require("ink"), h = _a.h, render = _a.render, Component = _a.Component, Color = _a.Color, Indent = _a.Indent; | ||
exports.Component = Component; | ||
var TAP_PARSER = parser(); | ||
var TapBarkOutput = (function (_super) { | ||
__extends(TapBarkOutput, _super); | ||
function TapBarkOutput(props) { | ||
var _this = _super.call(this, props) || this; | ||
_this.FIXTURE_REGEXP = /^# FIXTURE (.*)/; | ||
_this.CONSOLE_WARNING_REGEXP = /^# WARN: (.*)/; | ||
_this._completeCalled = false; | ||
_this.warnings = []; | ||
_this.state = { | ||
logs: [], | ||
warnings: [] | ||
}; | ||
this.setupListeners(); | ||
_this.setupListeners(); | ||
return _this; | ||
} | ||
getFailureMessage(assertion) { | ||
const failureTitle = chalk_1.default.red("FAIL: ") + chalk_1.default.bold(assertion.name) + "\n"; | ||
TapBarkOutput.prototype.getPipeable = function () { | ||
return duplexer(TAP_PARSER, through()); | ||
}; | ||
TapBarkOutput.prototype.getFailureMessage = function (assertion) { | ||
var failureTitle = chalk_1.default.red("FAIL: ") + chalk_1.default.bold(assertion.name) + "\n"; | ||
if (assertion.diag) { | ||
const data = assertion.diag.data; | ||
const details = data.details; | ||
const title = `${failureTitle} ${assertion.diag.message}\n`; | ||
if (details && Object.keys(details).length > 0) { | ||
return `${title}${Object.keys(details) | ||
.map(key => `\n${chalk_1.default.underline(key)}:\n${details[key]}`) | ||
.join("\n")}`; | ||
var data = assertion.diag.data; | ||
var details_1 = data.details; | ||
var title = failureTitle + " " + assertion.diag.message + "\n"; | ||
if (details_1 && Object.keys(details_1).length > 0) { | ||
return "" + title + Object.keys(details_1) | ||
.map(function (key) { return "\n" + chalk_1.default.underline(key) + ":\n" + details_1[key]; }) | ||
.join("\n"); | ||
} | ||
return `${title}\nexpected:\n${data.expect}\nactual:\n${data.got}`; | ||
return title + "\nexpected:\n" + data.expect + "\nactual:\n" + data.got; | ||
} | ||
return failureTitle + "Failure reason unknown."; | ||
} | ||
render() { | ||
const results = this.state.results; | ||
const total = this.state.totalTests; | ||
}; | ||
TapBarkOutput.prototype.render = function () { | ||
var results = this.state.results; | ||
var total = this.state.totalTests; | ||
if (this.state.results) { | ||
@@ -64,13 +88,16 @@ return h(Indent, null, | ||
} | ||
if (this.props.showProgress === false) { | ||
return h(Indent, null, "running alsatian tests"); | ||
} | ||
return h(Indent, null, | ||
Math.floor(this.state.currentTest / total * 100 || 0), | ||
"% complete"); | ||
} | ||
handleNewPlan(plan) { | ||
}; | ||
TapBarkOutput.prototype.handleNewPlan = function (plan) { | ||
this.setState({ | ||
totalTests: plan.end | ||
}); | ||
} | ||
handleComment(comment) { | ||
let fixtureParse = this.FIXTURE_REGEXP.exec(comment); | ||
}; | ||
TapBarkOutput.prototype.handleComment = function (comment) { | ||
var fixtureParse = this.FIXTURE_REGEXP.exec(comment); | ||
if (fixtureParse !== null) { | ||
@@ -82,3 +109,3 @@ this.setState({ | ||
else { | ||
const message = comment.replace("# ", ""); | ||
var message = comment.replace("# ", ""); | ||
if (this.CONSOLE_WARNING_REGEXP.test(comment)) { | ||
@@ -91,4 +118,4 @@ this.warnings.push(chalk_1.default.yellow(message)); | ||
} | ||
} | ||
handleAssert(assertion) { | ||
}; | ||
TapBarkOutput.prototype.handleAssert = function (assertion) { | ||
this.setState({ | ||
@@ -98,5 +125,5 @@ currentTest: assertion.id, | ||
}); | ||
} | ||
handleComplete(results) { | ||
let _results = { | ||
}; | ||
TapBarkOutput.prototype.handleComplete = function (results) { | ||
var _results = { | ||
pass: results.pass || 0, | ||
@@ -109,3 +136,3 @@ fail: (results.fail || (results.failures || []).length), | ||
this._completeCalled = true; | ||
this.setState(Object.assign({}, this.state, { results: _results }), setTimeout(() => { | ||
this.setState(__assign({}, this.state, { results: _results }), setTimeout(function () { | ||
if (results.ok) { | ||
@@ -119,20 +146,26 @@ process.exit(0); | ||
} | ||
} | ||
setupListeners() { | ||
}; | ||
TapBarkOutput.prototype.setupListeners = function () { | ||
if (this.props.showProgress) { | ||
TAP_PARSER.on("comment", this.handleComment.bind(this)); | ||
TAP_PARSER.on("assert", this.handleAssert.bind(this)); | ||
} | ||
TAP_PARSER.on("plan", this.handleNewPlan.bind(this)); | ||
TAP_PARSER.on("comment", this.handleComment.bind(this)); | ||
TAP_PARSER.on("assert", this.handleAssert.bind(this)); | ||
TAP_PARSER.on("complete", this.handleComplete.bind(this)); | ||
}; | ||
return TapBarkOutput; | ||
}(Component)); | ||
exports.TapBarkOutput = TapBarkOutput; | ||
var TapBark = (function () { | ||
function TapBark() { | ||
} | ||
} | ||
class TapBark { | ||
static create() { | ||
render(h(TapBarkOutput, null)); | ||
return { | ||
getPipeable() { | ||
return duplexer(TAP_PARSER, through()); | ||
} | ||
}; | ||
} | ||
} | ||
TapBark.create = function (showProgress) { | ||
if (showProgress === void 0) { showProgress = true; } | ||
var tapBarkOutput = h(TapBarkOutput, { showProgress: showProgress }); | ||
render(tapBarkOutput); | ||
return tapBarkOutput.instance; | ||
}; | ||
TapBark.tapParser = TAP_PARSER; | ||
return TapBark; | ||
}()); | ||
exports.TapBark = TapBark; |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
152312
47
1590
11