purs-pkg-deps
Version:
Query package dependencies in PureScript package-sets
210 lines (209 loc) • 14.3 kB
JavaScript
// Generated by purs version 0.14.3
;
var Control_Applicative = require("../Control.Applicative/index.js");
var Control_Bind = require("../Control.Bind/index.js");
var Control_Monad_State_Class = require("../Control.Monad.State.Class/index.js");
var Control_Monad_State_Trans = require("../Control.Monad.State.Trans/index.js");
var Control_Monad_Writer_Trans = require("../Control.Monad.Writer.Trans/index.js");
var Data_Boolean = require("../Data.Boolean/index.js");
var Data_Eq = require("../Data.Eq/index.js");
var Data_Foldable = require("../Data.Foldable/index.js");
var Data_Function = require("../Data.Function/index.js");
var Data_Generic_Rep = require("../Data.Generic.Rep/index.js");
var Data_Identity = require("../Data.Identity/index.js");
var Data_Map_Internal = require("../Data.Map.Internal/index.js");
var Data_Maybe = require("../Data.Maybe/index.js");
var Data_Monoid = require("../Data.Monoid/index.js");
var Data_Ord = require("../Data.Ord/index.js");
var Data_Semigroup = require("../Data.Semigroup/index.js");
var Data_Show = require("../Data.Show/index.js");
var Data_Show_Generic = require("../Data.Show.Generic/index.js");
var Data_Symbol = require("../Data.Symbol/index.js");
var Data_Unit = require("../Data.Unit/index.js");
var Effect_Exception = require("../Effect.Exception/index.js");
var Test_Spec_Console = require("../Test.Spec.Console/index.js");
var Test_Spec_Reporter_Base = require("../Test.Spec.Reporter.Base/index.js");
var Test_Spec_Result = require("../Test.Spec.Result/index.js");
var Test_Spec_Runner_Event = require("../Test.Spec.Runner.Event/index.js");
var Test_Spec_Style = require("../Test.Spec.Style/index.js");
var Test_Spec_Summary = require("../Test.Spec.Summary/index.js");
var Test_Spec_Tree = require("../Test.Spec.Tree/index.js");
var PrintTest = (function () {
function PrintTest(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
PrintTest.create = function (value0) {
return function (value1) {
return new PrintTest(value0, value1);
};
};
return PrintTest;
})();
var PrintPending = (function () {
function PrintPending(value0) {
this.value0 = value0;
};
PrintPending.create = function (value0) {
return new PrintPending(value0);
};
return PrintPending;
})();
var printSummary = function (dictMonadWriter) {
var pluralize = function (s) {
return function (v) {
if (v === 1) {
return s;
};
return s + "s";
};
};
var printPassedFailed = function (p) {
return function (f) {
var total = p + f | 0;
var testStr = pluralize("test")(total);
var color = (function () {
var $19 = f > 0;
if ($19) {
return Test_Spec_Style.red;
};
return Test_Spec_Style.dim;
})();
var amount = Data_Show.show(Data_Show.showInt)(p) + ("/" + (Data_Show.show(Data_Show.showInt)(total) + (" " + (testStr + " passed"))));
return Test_Spec_Console.tellLn(dictMonadWriter)(Test_Spec_Style.styled(color)(amount));
};
};
var printPending = function (p) {
if (p > 0) {
return Test_Spec_Console.tellLn(dictMonadWriter)(Test_Spec_Style.styled(Test_Spec_Style.yellow)(Data_Show.show(Data_Show.showInt)(p) + (" " + (pluralize("test")(p) + " pending"))));
};
if (Data_Boolean.otherwise) {
return Control_Applicative.pure(((dictMonadWriter.MonadTell1()).Monad1()).Applicative0())(Data_Unit.unit);
};
throw new Error("Failed pattern match at Test.Spec.Reporter.Console (line 67, column 5 - line 67, column 34): " + [ p.constructor.name ]);
};
return function ($64) {
return (function (v) {
return Control_Bind.discard(Control_Bind.discardUnit)(((dictMonadWriter.MonadTell1()).Monad1()).Bind1())(Test_Spec_Console.tellLn(dictMonadWriter)(""))(function () {
return Control_Bind.discard(Control_Bind.discardUnit)(((dictMonadWriter.MonadTell1()).Monad1()).Bind1())(Test_Spec_Console.tellLn(dictMonadWriter)(Test_Spec_Style.styled(Test_Spec_Style.bold)("Summary")))(function () {
return Control_Bind.discard(Control_Bind.discardUnit)(((dictMonadWriter.MonadTell1()).Monad1()).Bind1())(printPassedFailed(v.passed)(v.failed))(function () {
return Control_Bind.discard(Control_Bind.discardUnit)(((dictMonadWriter.MonadTell1()).Monad1()).Bind1())(printPending(v.pending))(function () {
return Test_Spec_Console.tellLn(dictMonadWriter)("");
});
});
});
});
})(Test_Spec_Summary.summarize($64));
};
};
var printActionGeneric = new Data_Generic_Rep.Generic(function (x) {
if (x instanceof PrintTest) {
return new Data_Generic_Rep.Inl(new Data_Generic_Rep.Product(x.value0, x.value1));
};
if (x instanceof PrintPending) {
return new Data_Generic_Rep.Inr(x.value0);
};
throw new Error("Failed pattern match at Test.Spec.Reporter.Console (line 80, column 1 - line 80, column 60): " + [ x.constructor.name ]);
}, function (x) {
if (x instanceof Data_Generic_Rep.Inl) {
return new PrintTest(x.value0.value0, x.value0.value1);
};
if (x instanceof Data_Generic_Rep.Inr) {
return new PrintPending(x.value0);
};
throw new Error("Failed pattern match at Test.Spec.Reporter.Console (line 80, column 1 - line 80, column 60): " + [ x.constructor.name ]);
});
var printActionShow = new Data_Show.Show(Data_Show_Generic.genericShow(printActionGeneric)(Data_Show_Generic.genericShowSum(Data_Show_Generic.genericShowConstructor(Data_Show_Generic.genericShowArgsProduct(Data_Show_Generic.genericShowArgsArgument(Data_Show.showString))(Data_Show_Generic.genericShowArgsArgument(Test_Spec_Result.showResult)))(new Data_Symbol.IsSymbol(function () {
return "PrintTest";
})))(Data_Show_Generic.genericShowConstructor(Data_Show_Generic.genericShowArgsArgument(Data_Show.showString))(new Data_Symbol.IsSymbol(function () {
return "PrintPending";
})))));
var print = function (dictMonadState) {
return function (dictMonadWriter) {
return function (path) {
return function (a) {
return Control_Bind.discard(Control_Bind.discardUnit)((dictMonadState.Monad0()).Bind1())(Data_Foldable.for_((dictMonadState.Monad0()).Applicative0())(Data_Foldable.foldableMaybe)(Test_Spec_Tree.parentSuite(path))(function (suite) {
return Control_Bind.bind((dictMonadState.Monad0()).Bind1())(Control_Monad_State_Class.get(dictMonadState))(function (s) {
if (s.lastPrintedSuitePath instanceof Data_Maybe.Just && Data_Eq.eq(Data_Eq.eqArray(Test_Spec_Tree.pathItemEq))(s.lastPrintedSuitePath.value0)(suite.path)) {
return Control_Applicative.pure((dictMonadState.Monad0()).Applicative0())(Data_Unit.unit);
};
return Control_Bind.discard(Control_Bind.discardUnit)((dictMonadState.Monad0()).Bind1())(Test_Spec_Console.tellLn(dictMonadWriter)(Test_Spec_Style.styled(Data_Semigroup.append(Data_Semigroup.semigroupArray)(Test_Spec_Style.bold)(Test_Spec_Style.magenta))(Data_Foldable.intercalate(Data_Foldable.foldableArray)(Data_Monoid.monoidString)(" \xbb ")(Data_Semigroup.append(Data_Semigroup.semigroupArray)(Test_Spec_Tree.parentSuiteName(suite.path))([ suite.name ])))))(function () {
return Control_Monad_State_Class.put(dictMonadState)((function () {
var $36 = {};
for (var $37 in s) {
if ({}.hasOwnProperty.call(s, $37)) {
$36[$37] = s[$37];
};
};
$36.lastPrintedSuitePath = new Data_Maybe.Just(suite.path);
return $36;
})());
});
});
}))(function () {
if (a instanceof PrintTest && a.value1 instanceof Test_Spec_Result.Success) {
return Test_Spec_Console.tellLn(dictMonadWriter)(" " + (Test_Spec_Style.styled(Test_Spec_Style.green)("\u2713\ufe0e ") + Test_Spec_Style.styled(Test_Spec_Style.dim)(a.value0)));
};
if (a instanceof PrintTest && a.value1 instanceof Test_Spec_Result.Failure) {
return Control_Bind.discard(Control_Bind.discardUnit)((dictMonadState.Monad0()).Bind1())(Test_Spec_Console.tellLn(dictMonadWriter)(" " + Test_Spec_Style.styled(Test_Spec_Style.red)("\u2717 " + (a.value0 + ":"))))(function () {
return Control_Bind.discard(Control_Bind.discardUnit)((dictMonadState.Monad0()).Bind1())(Test_Spec_Console.tellLn(dictMonadWriter)(""))(function () {
return Test_Spec_Console.tellLn(dictMonadWriter)(" " + Test_Spec_Style.styled(Test_Spec_Style.red)(Effect_Exception.message(a.value1.value0)));
});
});
};
if (a instanceof PrintPending) {
return Test_Spec_Console.tellLn(dictMonadWriter)(" " + Test_Spec_Style.styled(Test_Spec_Style.cyan)("~ " + a.value0));
};
throw new Error("Failed pattern match at Test.Spec.Reporter.Console (line 99, column 3 - line 107, column 56): " + [ a.constructor.name ]);
});
};
};
};
};
var initialState = {
runningItems: Data_Map_Internal.empty,
lastPrintedSuitePath: Data_Maybe.Nothing.value
};
var consoleReporter = Test_Spec_Reporter_Base.defaultReporter(initialState)(Test_Spec_Reporter_Base.defaultUpdate({
getRunningItems: function (v) {
return v.runningItems;
},
putRunningItems: Data_Function.flip(function (v) {
return function (v1) {
return {
runningItems: v1,
lastPrintedSuitePath: v.lastPrintedSuitePath
};
};
}),
printFinishedItem: function (path) {
return function (v) {
if (v instanceof Test_Spec_Reporter_Base.RunningTest && v.value1 instanceof Data_Maybe.Just) {
return print(Control_Monad_State_Trans.monadStateStateT(Control_Monad_Writer_Trans.monadWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(Control_Monad_State_Trans.monadWriterStateT(Control_Monad_Writer_Trans.monadWriterWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(path)(new PrintTest(v.value0, v.value1.value0));
};
if (v instanceof Test_Spec_Reporter_Base.RunningPending) {
return print(Control_Monad_State_Trans.monadStateStateT(Control_Monad_Writer_Trans.monadWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(Control_Monad_State_Trans.monadWriterStateT(Control_Monad_Writer_Trans.monadWriterWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(path)(new PrintPending(v.value0));
};
return Control_Applicative.pure(Control_Monad_State_Trans.applicativeStateT(Control_Monad_Writer_Trans.monadWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(Data_Unit.unit);
};
},
update: function (v) {
if (v instanceof Test_Spec_Runner_Event.TestEnd) {
return Control_Bind.bind(Control_Monad_State_Trans.bindStateT(Control_Monad_Writer_Trans.monadWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(Control_Monad_State_Class.get(Control_Monad_State_Trans.monadStateStateT(Control_Monad_Writer_Trans.monadWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity))))(function (v1) {
return Control_Applicative.when(Control_Monad_State_Trans.applicativeStateT(Control_Monad_Writer_Trans.monadWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(Data_Maybe.isNothing(Data_Map_Internal.lookup(Data_Ord.ordArray(Test_Spec_Tree.pathItemOrd))(v.value0)(v1.runningItems)))(print(Control_Monad_State_Trans.monadStateStateT(Control_Monad_Writer_Trans.monadWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(Control_Monad_State_Trans.monadWriterStateT(Control_Monad_Writer_Trans.monadWriterWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(v.value0)(new PrintTest(v.value1, v.value2)));
});
};
if (v instanceof Test_Spec_Runner_Event.Pending) {
return Control_Bind.bind(Control_Monad_State_Trans.bindStateT(Control_Monad_Writer_Trans.monadWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(Control_Monad_State_Class.get(Control_Monad_State_Trans.monadStateStateT(Control_Monad_Writer_Trans.monadWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity))))(function (v1) {
return Control_Applicative.when(Control_Monad_State_Trans.applicativeStateT(Control_Monad_Writer_Trans.monadWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(Data_Map_Internal.isEmpty(v1.runningItems))(print(Control_Monad_State_Trans.monadStateStateT(Control_Monad_Writer_Trans.monadWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(Control_Monad_State_Trans.monadWriterStateT(Control_Monad_Writer_Trans.monadWriterWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(v.value0)(new PrintPending(v.value1)));
});
};
if (v instanceof Test_Spec_Runner_Event.End) {
return printSummary(Control_Monad_State_Trans.monadWriterStateT(Control_Monad_Writer_Trans.monadWriterWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(v.value0);
};
return Control_Applicative.pure(Control_Monad_State_Trans.applicativeStateT(Control_Monad_Writer_Trans.monadWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(Data_Unit.unit);
}
}));
module.exports = {
consoleReporter: consoleReporter
};