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

txtgen

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

txtgen - npm Package Compare versions

Comparing version 2.2.4 to 2.2.6

27

dist/txtgen.js
/**
* txtgen@2.2.4
* built on: Tue, 22 Oct 2019 06:04:33 GMT
* txtgen@2.2.6
* built on: Sat, 02 May 2020 14:23:17 GMT
* repository: https://github.com/ndaidong/txtgen

@@ -12,3 +12,3 @@ * maintainer: @ndaidong

(global = global || self, factory(global.txtgen = {}));
}(this, function (exports) {
}(this, (function (exports) {
const unique = (a) => {

@@ -129,6 +129,12 @@ const r = [];

const random = (min, max) => {
let random;
const setRandom = (newRandom) => {
random = newRandom;
};
setRandom(Math.random);
const randfloat = () => random();
const randint = (min, max) => {
const offset = min;
const range = max - min + 1;
const rd = Math.floor(Math.random() * range) + offset;
const rd = Math.floor(randfloat() * range) + offset;
return rd;

@@ -139,3 +145,3 @@ };

while (!w) {
w = a[random(0, a.length - 1)];
w = a[randint(0, a.length - 1)];
}

@@ -210,3 +216,3 @@ return w;

const randomStartingPhrase = () => {
if (Math.random() < 0.33) {
if (randfloat() < 0.33) {
return rand(phrases);

@@ -228,3 +234,3 @@ }

if (!len) {
len = random(3, 10);
len = randint(3, 10);
}

@@ -241,3 +247,3 @@ const t = Math.min(len, 15);

if (!len) {
len = random(3, 10);
len = randint(3, 10);
}

@@ -264,2 +270,3 @@ const t = Math.min(len, 15);

exports.setNouns = setNouns;
exports.setRandom = setRandom;
exports.setTemplates = setTemplates;

@@ -269,2 +276,2 @@

}));
})));

@@ -1,2 +0,2 @@

// txtgen@2.2.4, by @ndaidong - built on Tue, 22 Oct 2019 06:04:33 GMT - published under MIT license
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).txtgen={})}(this,(function(e){const n=e=>{const n=[];for(let t=0;t<e.length;t++)-1===n.indexOf(e[t])&&n.push(e[t]);return n};var t=["alligator","ant","bear","bee","bird","camel","cat","cheetah","chicken","chimpanzee","cow","crocodile","deer","dog","dolphin","duck","eagle","elephant","fish","fly","fox","frog","giraffe","goat","goldfish","hamster","hippopotamus","horse","kangaroo","kitten","lion","lobster","monkey","octopus","owl","panda","pig","puppy","rabbit","rat","scorpion","seal","shark","sheep","snail","snake","spider","squirrel","tiger","turtle","wolf","zebra","apple","apricot","banana","blackberry","blueberry","cherry","cranberry","currant","fig","grape","grapefruit","grapes","kiwi","kumquat","lemon","lime","melon","nectarine","orange","peach","pear","persimmon","pineapple","plum","pomegranate","prune","raspberry","strawberry","tangerine","watermelon"],a=["adaptable","adventurous","affable","affectionate","agreeable","alert","alluring","ambitious","ambitious","amiable","amicable","amused","amusing","boundless","brave","brave","bright","bright","broad-minded","calm","calm","capable","careful","charming","charming","cheerful","coherent","comfortable","communicative","compassionate","confident","conscientious","considerate","convivial","cooperative","courageous","courageous","courteous","creative","credible","cultured","dashing","dazzling","debonair","decisive","decisive","decorous","delightful","detailed","determined","determined","diligent","diligent","diplomatic","discreet","discreet","dynamic","dynamic","eager","easygoing","efficient","elated","eminent","emotional","enchanting","encouraging","endurable","energetic","energetic","entertaining","enthusiastic","enthusiastic","excellent","excited","exclusive","exuberant","exuberant","fabulous","fair","fair-minded","faithful","faithful","fantastic","fearless","fearless","fine","forceful","frank","frank","friendly","friendly","funny","funny","generous","generous","gentle","gentle","glorious","good","good","gregarious","happy","hard-working","harmonious","helpful","helpful","hilarious","honest","honorable","humorous","imaginative","impartial","impartial","independent","industrious","instinctive","intellectual","intelligent","intuitive","inventive","jolly","joyous","kind","kind","kind-hearted","knowledgeable","level","likeable","lively","lovely","loving","loving","loyal","lucky","mature","modern","modest","neat","nice","nice","obedient","optimistic","painstaking","passionate","patient","peaceful","perfect","persistent","philosophical","pioneering","placid","placid","plausible","pleasant","plucky","plucky","polite","powerful","practical","pro-active","productive","protective","proud","punctual","quick-witted","quiet","quiet","rational","receptive","reflective","reliable","relieved","reserved","resolute","resourceful","responsible","rhetorical","righteous","romantic","romantic","sedate","seemly","selective","self-assured","self-confident","self-disciplined","sensible","sensitive","sensitive","shrewd","shy","silly","sincere","sincere","skillful","smiling","sociable","splendid","steadfast","stimulating","straightforward","successful","succinct","sympathetic","talented","thoughtful","thoughtful","thrifty","tidy","tough","tough","trustworthy","unassuming","unbiased","understanding","unusual","upbeat","versatile","vigorous","vivacious","warm","warmhearted","willing","willing","wise","witty","witty","wonderful"],i=["a","e","i","o","u","y"],o=["the {{noun}} is {{a_noun}}","{{a_noun}} is {{an_adjective}} {{noun}}","the first {{adjective}} {{noun}} is, in its own way, {{a_noun}}","their {{noun}} was, in this moment, {{an_adjective}} {{noun}}","{{a_noun}} is {{a_noun}} from the right perspective","the literature would have us believe that {{an_adjective}} {{noun}} is not but {{a_noun}}","{{an_adjective}} {{noun}} is {{a_noun}} of the mind","the {{adjective}} {{noun}} reveals itself as {{an_adjective}} {{noun}} to those who look","authors often misinterpret the {{noun}} as {{an_adjective}} {{noun}}, when in actuality it feels more like {{an_adjective}} {{noun}}","we can assume that any instance of {{a_noun}} can be construed as {{an_adjective}} {{noun}}","they were lost without the {{adjective}} {{noun}} that composed their {{noun}}","the {{adjective}} {{noun}} comes from {{an_adjective}} {{noun}}","{{a_noun}} can hardly be considered {{an_adjective}} {{noun}} without also being {{a_noun}}","few can name {{an_adjective}} {{noun}} that isn't {{an_adjective}} {{noun}}","some posit the {{adjective}} {{noun}} to be less than {{adjective}}","{{a_noun}} of the {{noun}} is assumed to be {{an_adjective}} {{noun}}","{{a_noun}} sees {{a_noun}} as {{an_adjective}} {{noun}}","the {{noun}} of {{a_noun}} becomes {{an_adjective}} {{noun}}","{{a_noun}} is {{a_noun}}'s {{noun}}","{{a_noun}} is the {{noun}} of {{a_noun}}","{{an_adjective}} {{noun}}'s {{noun}} comes with it the thought that the {{adjective}} {{noun}} is {{a_noun}}","{{nouns}} are {{adjective}} {{nouns}}","{{adjective}} {{nouns}} show us how {{nouns}} can be {{nouns}}","before {{nouns}}, {{nouns}} were only {{nouns}}","those {{nouns}} are nothing more than {{nouns}}","some {{adjective}} {{nouns}} are thought of simply as {{nouns}}","one cannot separate {{nouns}} from {{adjective}} {{nouns}}","the {{nouns}} could be said to resemble {{adjective}} {{nouns}}","{{an_adjective}} {{noun}} without {{nouns}} is truly a {{noun}} of {{adjective}} {{nouns}}"],s=["to be more specific, ","in recent years, ","however, ","by the way","of course, ","some assert that ","if this was somewhat unclear, ","unfortunately, that is wrong; on the contrary, ","it's very tricky, if not impossible, ","this could be, or perhaps ","this is not to discredit the idea that ","we know that ","it's an undeniable fact, really; ","framed in a different way, ","what we don't know for sure is whether or not ","as far as we can estimate, ","as far as he is concerned, ","the zeitgeist contends that ","though we assume the latter, ","far from the truth, ","extending this logic, ","nowhere is it disputed that ","in modern times ","in ancient times ","recent controversy aside, ","washing and polishing the car,","having been a gymnast, ","after a long day at school and work, ","waking to the buzz of the alarm clock, ","draped neatly on a hanger, ","shouting with happiness, "];const r=(e,n)=>{const t=e,a=n-e+1;return Math.floor(Math.random()*a)+t},u=e=>{let n;for(;!n;)n=e[r(0,e.length-1)];return n},c=e=>{let n="a";return e.match(/^(a|e|i|o)/)&&(n="an"),`${n} ${e}`},l=["noun","a_noun","nouns","adjective","an_adjective"],d={noun:()=>u(t),a_noun:()=>c(u(t)),nouns:()=>(e=>e.endsWith("s")?e:(e.match(/(ss|ish|ch|x|us)$/)?e+="e":e.endsWith("y")&&!i.includes(e.charAt(e.length-2))&&(e=e.slice(0,e.length-1),e+="ie"),e+"s"))(u(t)),adjective:()=>u(a),an_adjective:()=>c(u(a))},h=e=>e.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").replace(/\r?\n|\r/g," ").replace(/\s\s+|\r/g," "),p=()=>(e=>{let n=e;const t=e.match(/\{\{(.+?)\}\}/g);if(t&&t.length)for(let e=0;e<t.length;e++){const a=h(t[e].replace("{{","").replace("}}",""));let i;l.includes(a)&&(i=d[a]()),n=n.replace(t[e],i)}return n})(u(o)),f=()=>{let e=(()=>Math.random()<.33?u(s):"")()+p();return e=e.charAt(0).toUpperCase()+e.slice(1),e+=(()=>{const e=".......!?!?;...".split("");return u(e)})()},g=(e=0)=>{e||(e=r(3,10));const n=Math.min(e,15),t=[];for(;t.length<n;){const e=f();t.push(e)}return t.join(" ")};e.addAdjectives=(e=[])=>{const t=a.concat(e);return(a=n(t)).length},e.addNouns=(e=[])=>{const a=t.concat(e);return(t=n(a)).length},e.addTemplates=(e=[])=>{const t=o.concat(e);return(o=n(t)).length},e.article=(e=0)=>{e||(e=r(3,10));const n=Math.min(e,15),t=[];for(;t.length<n;){const e=g();t.push(e)}return t.join("\n\n")},e.getAdjectives=()=>[...a],e.getNouns=()=>[...t],e.getTemplates=()=>[...o],e.paragraph=g,e.sentence=f,e.setAdjectives=(e=[])=>(a=n(e)).length,e.setNouns=(e=[])=>(t=n(e)).length,e.setTemplates=(e=[])=>(o=n(e)).length,Object.defineProperty(e,"__esModule",{value:!0})}));
// txtgen@2.2.6, by @ndaidong - built on Sat, 02 May 2020 14:23:17 GMT - published under MIT license
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).txtgen={})}(this,(function(e){const n=e=>{const n=[];for(let t=0;t<e.length;t++)-1===n.indexOf(e[t])&&n.push(e[t]);return n};var t=["alligator","ant","bear","bee","bird","camel","cat","cheetah","chicken","chimpanzee","cow","crocodile","deer","dog","dolphin","duck","eagle","elephant","fish","fly","fox","frog","giraffe","goat","goldfish","hamster","hippopotamus","horse","kangaroo","kitten","lion","lobster","monkey","octopus","owl","panda","pig","puppy","rabbit","rat","scorpion","seal","shark","sheep","snail","snake","spider","squirrel","tiger","turtle","wolf","zebra","apple","apricot","banana","blackberry","blueberry","cherry","cranberry","currant","fig","grape","grapefruit","grapes","kiwi","kumquat","lemon","lime","melon","nectarine","orange","peach","pear","persimmon","pineapple","plum","pomegranate","prune","raspberry","strawberry","tangerine","watermelon"],a=["adaptable","adventurous","affable","affectionate","agreeable","alert","alluring","ambitious","ambitious","amiable","amicable","amused","amusing","boundless","brave","brave","bright","bright","broad-minded","calm","calm","capable","careful","charming","charming","cheerful","coherent","comfortable","communicative","compassionate","confident","conscientious","considerate","convivial","cooperative","courageous","courageous","courteous","creative","credible","cultured","dashing","dazzling","debonair","decisive","decisive","decorous","delightful","detailed","determined","determined","diligent","diligent","diplomatic","discreet","discreet","dynamic","dynamic","eager","easygoing","efficient","elated","eminent","emotional","enchanting","encouraging","endurable","energetic","energetic","entertaining","enthusiastic","enthusiastic","excellent","excited","exclusive","exuberant","exuberant","fabulous","fair","fair-minded","faithful","faithful","fantastic","fearless","fearless","fine","forceful","frank","frank","friendly","friendly","funny","funny","generous","generous","gentle","gentle","glorious","good","good","gregarious","happy","hard-working","harmonious","helpful","helpful","hilarious","honest","honorable","humorous","imaginative","impartial","impartial","independent","industrious","instinctive","intellectual","intelligent","intuitive","inventive","jolly","joyous","kind","kind","kind-hearted","knowledgeable","level","likeable","lively","lovely","loving","loving","loyal","lucky","mature","modern","modest","neat","nice","nice","obedient","optimistic","painstaking","passionate","patient","peaceful","perfect","persistent","philosophical","pioneering","placid","placid","plausible","pleasant","plucky","plucky","polite","powerful","practical","pro-active","productive","protective","proud","punctual","quick-witted","quiet","quiet","rational","receptive","reflective","reliable","relieved","reserved","resolute","resourceful","responsible","rhetorical","righteous","romantic","romantic","sedate","seemly","selective","self-assured","self-confident","self-disciplined","sensible","sensitive","sensitive","shrewd","shy","silly","sincere","sincere","skillful","smiling","sociable","splendid","steadfast","stimulating","straightforward","successful","succinct","sympathetic","talented","thoughtful","thoughtful","thrifty","tidy","tough","tough","trustworthy","unassuming","unbiased","understanding","unusual","upbeat","versatile","vigorous","vivacious","warm","warmhearted","willing","willing","wise","witty","witty","wonderful"],i=["a","e","i","o","u","y"],o=["the {{noun}} is {{a_noun}}","{{a_noun}} is {{an_adjective}} {{noun}}","the first {{adjective}} {{noun}} is, in its own way, {{a_noun}}","their {{noun}} was, in this moment, {{an_adjective}} {{noun}}","{{a_noun}} is {{a_noun}} from the right perspective","the literature would have us believe that {{an_adjective}} {{noun}} is not but {{a_noun}}","{{an_adjective}} {{noun}} is {{a_noun}} of the mind","the {{adjective}} {{noun}} reveals itself as {{an_adjective}} {{noun}} to those who look","authors often misinterpret the {{noun}} as {{an_adjective}} {{noun}}, when in actuality it feels more like {{an_adjective}} {{noun}}","we can assume that any instance of {{a_noun}} can be construed as {{an_adjective}} {{noun}}","they were lost without the {{adjective}} {{noun}} that composed their {{noun}}","the {{adjective}} {{noun}} comes from {{an_adjective}} {{noun}}","{{a_noun}} can hardly be considered {{an_adjective}} {{noun}} without also being {{a_noun}}","few can name {{an_adjective}} {{noun}} that isn't {{an_adjective}} {{noun}}","some posit the {{adjective}} {{noun}} to be less than {{adjective}}","{{a_noun}} of the {{noun}} is assumed to be {{an_adjective}} {{noun}}","{{a_noun}} sees {{a_noun}} as {{an_adjective}} {{noun}}","the {{noun}} of {{a_noun}} becomes {{an_adjective}} {{noun}}","{{a_noun}} is {{a_noun}}'s {{noun}}","{{a_noun}} is the {{noun}} of {{a_noun}}","{{an_adjective}} {{noun}}'s {{noun}} comes with it the thought that the {{adjective}} {{noun}} is {{a_noun}}","{{nouns}} are {{adjective}} {{nouns}}","{{adjective}} {{nouns}} show us how {{nouns}} can be {{nouns}}","before {{nouns}}, {{nouns}} were only {{nouns}}","those {{nouns}} are nothing more than {{nouns}}","some {{adjective}} {{nouns}} are thought of simply as {{nouns}}","one cannot separate {{nouns}} from {{adjective}} {{nouns}}","the {{nouns}} could be said to resemble {{adjective}} {{nouns}}","{{an_adjective}} {{noun}} without {{nouns}} is truly a {{noun}} of {{adjective}} {{nouns}}"],s=["to be more specific, ","in recent years, ","however, ","by the way","of course, ","some assert that ","if this was somewhat unclear, ","unfortunately, that is wrong; on the contrary, ","it's very tricky, if not impossible, ","this could be, or perhaps ","this is not to discredit the idea that ","we know that ","it's an undeniable fact, really; ","framed in a different way, ","what we don't know for sure is whether or not ","as far as we can estimate, ","as far as he is concerned, ","the zeitgeist contends that ","though we assume the latter, ","far from the truth, ","extending this logic, ","nowhere is it disputed that ","in modern times ","in ancient times ","recent controversy aside, ","washing and polishing the car,","having been a gymnast, ","after a long day at school and work, ","waking to the buzz of the alarm clock, ","draped neatly on a hanger, ","shouting with happiness, "];let r;const u=e=>{r=e};u(Math.random);const c=()=>r(),l=(e,n)=>{const t=e,a=n-e+1;return Math.floor(c()*a)+t},d=e=>{let n;for(;!n;)n=e[l(0,e.length-1)];return n},h=e=>{let n="a";return e.match(/^(a|e|i|o)/)&&(n="an"),`${n} ${e}`},p=["noun","a_noun","nouns","adjective","an_adjective"],f={noun:()=>d(t),a_noun:()=>h(d(t)),nouns:()=>{return(e=d(t)).endsWith("s")?e:(e.match(/(ss|ish|ch|x|us)$/)?e+="e":e.endsWith("y")&&!i.includes(e.charAt(e.length-2))&&(e=e.slice(0,e.length-1),e+="ie"),e+"s");var e},adjective:()=>d(a),an_adjective:()=>h(d(a))},g=()=>(e=>{let n=e;const t=e.match(/\{\{(.+?)\}\}/g);if(t&&t.length)for(let e=0;e<t.length;e++){const a=t[e].replace("{{","").replace("}}","").replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").replace(/\r?\n|\r/g," ").replace(/\s\s+|\r/g," ");let i;p.includes(a)&&(i=f[a]()),n=n.replace(t[e],i)}return n})(d(o)),m=()=>{let e=(c()<.33?d(s):"")+g();return e=e.charAt(0).toUpperCase()+e.slice(1),e+=(()=>{const e=".......!?!?;...".split("");return d(e)})(),e},v=(e=0)=>{e||(e=l(3,10));const n=Math.min(e,15),t=[];for(;t.length<n;){const e=m();t.push(e)}return t.join(" ")};e.addAdjectives=(e=[])=>{const t=a.concat(e);return(a=n(t)).length},e.addNouns=(e=[])=>{const a=t.concat(e);return(t=n(a)).length},e.addTemplates=(e=[])=>{const t=o.concat(e);return(o=n(t)).length},e.article=(e=0)=>{e||(e=l(3,10));const n=Math.min(e,15),t=[];for(;t.length<n;){const e=v();t.push(e)}return t.join("\n\n")},e.getAdjectives=()=>[...a],e.getNouns=()=>[...t],e.getTemplates=()=>[...o],e.paragraph=v,e.sentence=m,e.setAdjectives=(e=[])=>(a=n(e)).length,e.setNouns=(e=[])=>(t=n(e)).length,e.setRandom=u,e.setTemplates=(e=[])=>(o=n(e)).length,Object.defineProperty(e,"__esModule",{value:!0})}));
{
"version": "2.2.4",
"version": "2.2.6",
"name": "txtgen",

@@ -26,7 +26,6 @@ "description": "Util for generating random sentences, paragraphs and articles in English",

"devDependencies": {
"bellajs": "^8.0.0",
"coveralls": "^3.0.7",
"eslint-config-goes": "^1.1.6",
"gcc-min": "^7.1.5",
"tap": "^14.8.0"
"bellajs": "^8.0.2",
"eslint-config-goes": "^1.1.8",
"gcc-min": "^7.2.0",
"tap": "^14.10.7"
},

@@ -33,0 +32,0 @@ "keywords": [

@@ -14,3 +14,5 @@ /**

import {
random,
setRandom,
randfloat,
randint,
rand,

@@ -81,3 +83,3 @@ pickLastPunc,

const randomStartingPhrase = () => {
if (Math.random() < 0.33) {
if (randfloat() < 0.33) {
return rand(phrases);

@@ -92,2 +94,6 @@ }

export {
setRandom,
};
export const sentence = () => {

@@ -103,3 +109,3 @@ const phrase = randomStartingPhrase();

if (!len) {
len = random(3, 10);
len = randint(3, 10);
}

@@ -117,3 +123,3 @@ const t = Math.min(len, 15);

if (!len) {
len = random(3, 10);
len = randint(3, 10);
}

@@ -120,0 +126,0 @@ const t = Math.min(len, 15);

@@ -7,6 +7,16 @@ // utils

export const random = (min, max) => {
let random;
export const setRandom = (newRandom) => {
random = newRandom;
};
setRandom(Math.random);
export const randfloat = () => random();
export const randint = (min, max) => {
const offset = min;
const range = max - min + 1;
const rd = Math.floor(Math.random() * range) + offset;
const rd = Math.floor(randfloat() * range) + offset;
return rd;

@@ -18,3 +28,3 @@ };

while (!w) {
w = a[random(0, a.length - 1)];
w = a[randint(0, a.length - 1)];
}

@@ -21,0 +31,0 @@ return w;

@@ -55,4 +55,3 @@ /*

ResultsStateBuilder.prototype.specStarted = function(result) {
};
ResultsStateBuilder.prototype.specStarted = function(result) {};

@@ -75,6 +74,6 @@ ResultsStateBuilder.prototype.specDone = function(result) {

function HtmlReporter(options) {
var config = function() { return (options.env && options.env.configuration()) || {}; },
var config = function() {
return (options.env && options.env.configuration()) || {};
},
getContainer = options.getContainer,

@@ -84,5 +83,5 @@ createElement = options.createElement,

navigateWithNewParam = options.navigateWithNewParam || function() {},
addToExistingQueryString = options.addToExistingQueryString || defaultQueryString,
addToExistingQueryString =
options.addToExistingQueryString || defaultQueryString,
filterSpecs = options.filterSpecs,
timer = options.timer || j$.noopTimer,
htmlReporterMain,

@@ -94,11 +93,21 @@ symbols,

clearPrior();
htmlReporterMain = createDom('div', {className: 'jasmine_html-reporter'},
createDom('div', {className: 'jasmine-banner'},
createDom('a', {className: 'jasmine-title', href: 'http://jasmine.github.io/', target: '_blank'}),
createDom('span', {className: 'jasmine-version'}, j$.version)
htmlReporterMain = createDom(
'div',
{ className: 'jasmine_html-reporter' },
createDom(
'div',
{ className: 'jasmine-banner' },
createDom('a', {
className: 'jasmine-title',
href: 'http://jasmine.github.io/',
target: '_blank'
}),
createDom('span', { className: 'jasmine-version' }, j$.version)
),
createDom('ul', {className: 'jasmine-symbol-summary'}),
createDom('div', {className: 'jasmine-alert'}),
createDom('div', {className: 'jasmine-results'},
createDom('div', {className: 'jasmine-failures'})
createDom('ul', { className: 'jasmine-symbol-summary' }),
createDom('div', { className: 'jasmine-alert' }),
createDom(
'div',
{ className: 'jasmine-results' },
createDom('div', { className: 'jasmine-failures' })
)

@@ -112,6 +121,5 @@ );

totalSpecsDefined = options.totalSpecsDefined || 0;
timer.start();
};
var summary = createDom('div', {className: 'jasmine-summary'});
var summary = createDom('div', { className: 'jasmine-summary' });

@@ -141,16 +149,22 @@ var stateBuilder = new ResultsStateBuilder();

if(noExpectations(result) && typeof console !== 'undefined' && typeof console.error !== 'undefined') {
console.error('Spec \'' + result.fullName + '\' has no expectations.');
if (noExpectations(result)) {
var noSpecMsg = "Spec '" + result.fullName + "' has no expectations.";
if (result.status === 'failed') {
console.error(noSpecMsg);
} else {
console.warn(noSpecMsg);
}
}
if (!symbols){
if (!symbols) {
symbols = find('.jasmine-symbol-summary');
}
symbols.appendChild(createDom('li', {
symbols.appendChild(
createDom('li', {
className: this.displaySpecInCorrectFormat(result),
id: 'spec_' + result.id,
title: result.fullName
}
));
})
);

@@ -165,8 +179,12 @@ if (result.status === 'failed') {

this.displaySpecInCorrectFormat = function(result) {
return noExpectations(result) ? 'jasmine-empty' : this.resultStatus(result.status);
return noExpectations(result) && result.status === 'passed'
? 'jasmine-empty'
: this.resultStatus(result.status);
};
this.resultStatus = function(status) {
if(status === 'excluded') {
return config().hideDisabled ? 'jasmine-excluded-no-display' : 'jasmine-excluded';
if (status === 'excluded') {
return config().hideDisabled
? 'jasmine-excluded-no-display'
: 'jasmine-excluded';
}

@@ -181,3 +199,9 @@ return 'jasmine-' + status;

var i;
alert.appendChild(createDom('span', {className: 'jasmine-duration'}, 'finished in ' + timer.elapsed() / 1000 + 's'));
alert.appendChild(
createDom(
'span',
{ className: 'jasmine-duration' },
'finished in ' + doneResult.totalTime / 1000 + 's'
)
);

@@ -187,7 +211,18 @@ banner.appendChild(optionsMenu(config()));

if (stateBuilder.specsExecuted < totalSpecsDefined) {
var skippedMessage = 'Ran ' + stateBuilder.specsExecuted + ' of ' + totalSpecsDefined + ' specs - run all';
var skippedMessage =
'Ran ' +
stateBuilder.specsExecuted +
' of ' +
totalSpecsDefined +
' specs - run all';
var skippedLink = addToExistingQueryString('spec', '');
alert.appendChild(
createDom('span', {className: 'jasmine-bar jasmine-skipped'},
createDom('a', {href: skippedLink, title: 'Run all specs'}, skippedMessage)
createDom(
'span',
{ className: 'jasmine-bar jasmine-skipped' },
createDom(
'a',
{ href: skippedLink, title: 'Run all specs' },
skippedMessage
)
)

@@ -202,4 +237,10 @@ );

if (totalSpecsDefined > 0 || failed) {
statusBarMessage += pluralize('spec', stateBuilder.specsExecuted) + ', ' + pluralize('failure', stateBuilder.failureCount);
if (stateBuilder.pendingSpecCount) { statusBarMessage += ', ' + pluralize('pending spec', stateBuilder.pendingSpecCount); }
statusBarMessage +=
pluralize('spec', stateBuilder.specsExecuted) +
', ' +
pluralize('failure', stateBuilder.failureCount);
if (stateBuilder.pendingSpecCount) {
statusBarMessage +=
', ' + pluralize('pending spec', stateBuilder.pendingSpecCount);
}
}

@@ -211,3 +252,7 @@

statusBarClassName += ' jasmine-incomplete ';
statusBarMessage = 'Incomplete: ' + doneResult.incompleteReason + ', ' + statusBarMessage;
statusBarMessage =
'Incomplete: ' +
doneResult.incompleteReason +
', ' +
statusBarMessage;
} else {

@@ -219,9 +264,25 @@ statusBarClassName += ' jasmine-failed ';

if (order && order.random) {
seedBar = createDom('span', {className: 'jasmine-seed-bar'},
seedBar = createDom(
'span',
{ className: 'jasmine-seed-bar' },
', randomized with seed ',
createDom('a', {title: 'randomized with seed ' + order.seed, href: seedHref(order.seed)}, order.seed)
createDom(
'a',
{
title: 'randomized with seed ' + order.seed,
href: seedHref(order.seed)
},
order.seed
)
);
}
alert.appendChild(createDom('span', {className: statusBarClassName}, statusBarMessage, seedBar));
alert.appendChild(
createDom(
'span',
{ className: statusBarClassName },
statusBarMessage,
seedBar
)
);

@@ -231,4 +292,10 @@ var errorBarClassName = 'jasmine-bar jasmine-errored';

for(i = 0; i < globalFailures.length; i++) {
alert.appendChild(createDom('span', {className: errorBarClassName}, globalFailureMessage(globalFailures[i])));
for (i = 0; i < globalFailures.length; i++) {
alert.appendChild(
createDom(
'span',
{ className: errorBarClassName },
globalFailureMessage(globalFailures[i])
)
);
}

@@ -241,3 +308,5 @@

if (failure.filename) {
return prefix + ' in ' + failure.filename + ' line ' + failure.lineno;
return (
prefix + ' in ' + failure.filename + ' line ' + failure.lineno
);
} else {

@@ -254,5 +323,11 @@ return prefix;

var warningBarClassName = 'jasmine-bar jasmine-warning';
for(i = 0; i < deprecationWarnings.length; i++) {
for (i = 0; i < deprecationWarnings.length; i++) {
var warning = deprecationWarnings[i];
alert.appendChild(createDom('span', {className: warningBarClassName}, 'DEPRECATION: ' + warning));
alert.appendChild(
createDom(
'span',
{ className: warningBarClassName },
'DEPRECATION: ' + warning
)
);
}

@@ -267,9 +342,25 @@

alert.appendChild(
createDom('span', {className: 'jasmine-menu jasmine-bar jasmine-spec-list'},
createDom(
'span',
{ className: 'jasmine-menu jasmine-bar jasmine-spec-list' },
createDom('span', {}, 'Spec List | '),
createDom('a', {className: 'jasmine-failures-menu', href: '#'}, 'Failures')));
createDom(
'a',
{ className: 'jasmine-failures-menu', href: '#' },
'Failures'
)
)
);
alert.appendChild(
createDom('span', {className: 'jasmine-menu jasmine-bar jasmine-failure-list'},
createDom('a', {className: 'jasmine-spec-list-menu', href: '#'}, 'Spec List'),
createDom('span', {}, ' | Failures ')));
createDom(
'span',
{ className: 'jasmine-menu jasmine-bar jasmine-failure-list' },
createDom(
'a',
{ className: 'jasmine-spec-list-menu', href: '#' },
'Spec List'
),
createDom('span', {}, ' | Failures ')
)
);

@@ -295,7 +386,8 @@ find('.jasmine-failures-menu').onclick = function() {

function failureDom(result) {
var failure =
createDom('div', {className: 'jasmine-spec-detail jasmine-failed'},
failureDescription(result, stateBuilder.currentParent),
createDom('div', {className: 'jasmine-messages'})
);
var failure = createDom(
'div',
{ className: 'jasmine-spec-detail jasmine-failed' },
failureDescription(result, stateBuilder.currentParent),
createDom('div', { className: 'jasmine-messages' })
);
var messages = failure.childNodes[1];

@@ -305,6 +397,28 @@

var expectation = result.failedExpectations[i];
messages.appendChild(createDom('div', {className: 'jasmine-result-message'}, expectation.message));
messages.appendChild(createDom('div', {className: 'jasmine-stack-trace'}, expectation.stack));
messages.appendChild(
createDom(
'div',
{ className: 'jasmine-result-message' },
expectation.message
)
);
messages.appendChild(
createDom(
'div',
{ className: 'jasmine-stack-trace' },
expectation.stack
)
);
}
if (result.failedExpectations.length === 0) {
messages.appendChild(
createDom(
'div',
{ className: 'jasmine-result-message' },
'Spec has no expectations'
)
);
}
return failure;

@@ -321,5 +435,16 @@ }

if (resultNode.type === 'suite') {
var suiteListNode = createDom('ul', {className: 'jasmine-suite', id: 'suite-' + resultNode.result.id},
createDom('li', {className: 'jasmine-suite-detail jasmine-' + resultNode.result.status},
createDom('a', {href: specHref(resultNode.result)}, resultNode.result.description)
var suiteListNode = createDom(
'ul',
{ className: 'jasmine-suite', id: 'suite-' + resultNode.result.id },
createDom(
'li',
{
className:
'jasmine-suite-detail jasmine-' + resultNode.result.status
},
createDom(
'a',
{ href: specHref(resultNode.result) },
resultNode.result.description
)
)

@@ -333,18 +458,30 @@ );

if (domParent.getAttribute('class') !== 'jasmine-specs') {
specListNode = createDom('ul', {className: 'jasmine-specs'});
specListNode = createDom('ul', { className: 'jasmine-specs' });
domParent.appendChild(specListNode);
}
var specDescription = resultNode.result.description;
if(noExpectations(resultNode.result)) {
if (noExpectations(resultNode.result)) {
specDescription = 'SPEC HAS NO EXPECTATIONS ' + specDescription;
}
if(resultNode.result.status === 'pending' && resultNode.result.pendingReason !== '') {
specDescription = specDescription + ' PENDING WITH MESSAGE: ' + resultNode.result.pendingReason;
if (
resultNode.result.status === 'pending' &&
resultNode.result.pendingReason !== ''
) {
specDescription =
specDescription +
' PENDING WITH MESSAGE: ' +
resultNode.result.pendingReason;
}
specListNode.appendChild(
createDom('li', {
createDom(
'li',
{
className: 'jasmine-' + resultNode.result.status,
id: 'spec-' + resultNode.result.id
},
createDom('a', {href: specHref(resultNode.result)}, specDescription)
createDom(
'a',
{ href: specHref(resultNode.result) },
specDescription
)
)

@@ -357,6 +494,12 @@ );

function optionsMenu(config) {
var optionsMenuDom = createDom('div', { className: 'jasmine-run-options' },
var optionsMenuDom = createDom(
'div',
{ className: 'jasmine-run-options' },
createDom('span', { className: 'jasmine-trigger' }, 'Options'),
createDom('div', { className: 'jasmine-payload' },
createDom('div', { className: 'jasmine-stop-on-failure' },
createDom(
'div',
{ className: 'jasmine-payload' },
createDom(
'div',
{ className: 'jasmine-stop-on-failure' },
createDom('input', {

@@ -367,4 +510,11 @@ className: 'jasmine-fail-fast',

}),
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-fail-fast' }, 'stop execution on spec failure')),
createDom('div', { className: 'jasmine-throw-failures' },
createDom(
'label',
{ className: 'jasmine-label', for: 'jasmine-fail-fast' },
'stop execution on spec failure'
)
),
createDom(
'div',
{ className: 'jasmine-throw-failures' },
createDom('input', {

@@ -375,4 +525,11 @@ className: 'jasmine-throw',

}),
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-throw-failures' }, 'stop spec on expectation failure')),
createDom('div', { className: 'jasmine-random-order' },
createDom(
'label',
{ className: 'jasmine-label', for: 'jasmine-throw-failures' },
'stop spec on expectation failure'
)
),
createDom(
'div',
{ className: 'jasmine-random-order' },
createDom('input', {

@@ -383,4 +540,11 @@ className: 'jasmine-random',

}),
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-random-order' }, 'run tests in random order')),
createDom('div', { className: 'jasmine-hide-disabled' },
createDom(
'label',
{ className: 'jasmine-label', for: 'jasmine-random-order' },
'run tests in random order'
)
),
createDom(
'div',
{ className: 'jasmine-hide-disabled' },
createDom('input', {

@@ -391,3 +555,8 @@ className: 'jasmine-disabled',

}),
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-hide-disabled' }, 'hide disabled tests'))
createDom(
'label',
{ className: 'jasmine-label', for: 'jasmine-hide-disabled' },
'hide disabled tests'
)
)
)

@@ -402,3 +571,5 @@ );

var throwCheckbox = optionsMenuDom.querySelector('#jasmine-throw-failures');
var throwCheckbox = optionsMenuDom.querySelector(
'#jasmine-throw-failures'
);
throwCheckbox.checked = config.oneFailurePerSpec;

@@ -409,3 +580,5 @@ throwCheckbox.onclick = function() {

var randomCheckbox = optionsMenuDom.querySelector('#jasmine-random-order');
var randomCheckbox = optionsMenuDom.querySelector(
'#jasmine-random-order'
);
randomCheckbox.checked = config.random;

@@ -428,3 +601,6 @@ randomCheckbox.onclick = function() {

if (isOpen.test(optionsPayload.className)) {
optionsPayload.className = optionsPayload.className.replace(isOpen, '');
optionsPayload.className = optionsPayload.className.replace(
isOpen,
''
);
} else {

@@ -439,4 +615,10 @@ optionsPayload.className += ' jasmine-open';

function failureDescription(result, suite) {
var wrapper = createDom('div', {className: 'jasmine-description'},
createDom('a', {title: result.description, href: specHref(result)}, result.description)
var wrapper = createDom(
'div',
{ className: 'jasmine-description' },
createDom(
'a',
{ title: result.description, href: specHref(result) },
result.description
)
);

@@ -447,3 +629,7 @@ var suiteLink;

wrapper.insertBefore(createTextNode(' > '), wrapper.firstChild);
suiteLink = createDom('a', {href: suiteHref(suite)}, suite.result.description);
suiteLink = createDom(
'a',
{ href: suiteHref(suite) },
suite.result.description
);
wrapper.insertBefore(suiteLink, wrapper.firstChild);

@@ -470,3 +656,3 @@

if (result && result.deprecationWarnings) {
for(var i = 0; i < result.deprecationWarnings.length; i++) {
for (var i = 0; i < result.deprecationWarnings.length; i++) {
var warning = result.deprecationWarnings[i].message;

@@ -488,3 +674,3 @@ if (!j$.util.arrayContains(warning)) {

if(oldReporter) {
if (oldReporter) {
getContainer().removeChild(oldReporter);

@@ -521,3 +707,3 @@ }

function pluralize(singular, count) {
var word = (count == 1 ? singular : singular + 's');
var word = count == 1 ? singular : singular + 's';

@@ -544,4 +730,9 @@ return '' + count + ' ' + word;

function noExpectations(result) {
return (result.failedExpectations.length + result.passedExpectations.length) === 0 &&
result.status === 'passed';
var allExpectations =
result.failedExpectations.length + result.passedExpectations.length;
return (
allExpectations === 0 &&
(result.status === 'passed' || result.status === 'failed')
);
}

@@ -569,3 +760,6 @@

function HtmlSpecFilter(options) {
var filterString = options && options.filterString() && options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
var filterString =
options &&
options.filterString() &&
options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
var filterPattern = new RegExp(filterString);

@@ -607,5 +801,7 @@

function QueryString(options) {
this.navigateWithNewParam = function(key, value) {
options.getWindowLocation().search = this.fullStringWithNewParam(key, value);
options.getWindowLocation().search = this.fullStringWithNewParam(
key,
value
);
};

@@ -628,3 +824,5 @@

for (var prop in paramMap) {
qStrPairs.push(encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop]));
qStrPairs.push(
encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop])
);
}

@@ -653,3 +851,2 @@ return '?' + qStrPairs.join('&');

}
}

@@ -656,0 +853,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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