Compare commits

...

34 Commits

Author SHA1 Message Date
69ec5a98ab 1.0.58 2021-10-06 13:25:59 +02:00
3b93886147 fix(core): update 2021-10-06 13:25:59 +02:00
5949988293 1.0.57 2021-08-20 18:43:11 +02:00
04f7be07a3 fix(core): update 2021-08-20 18:43:11 +02:00
d331f90d24 1.0.56 2021-08-20 18:25:47 +02:00
224400dcb5 fix(core): update 2021-08-20 18:25:47 +02:00
7601ca599a 1.0.55 2021-08-20 18:23:39 +02:00
994a1bc98d fix(core): update 2021-08-20 18:23:39 +02:00
ca51c9e15b 1.0.54 2021-04-29 15:48:45 +00:00
4c4f08152b fix(core): update 2021-04-29 15:48:45 +00:00
39bd80106a 1.0.53 2021-04-29 15:33:54 +00:00
d6b94b534b fix(core): update 2021-04-29 15:33:53 +00:00
d19d3fc51e 1.0.52 2020-10-01 14:29:01 +00:00
f7f1bf25f6 fix(core): update 2020-10-01 14:29:01 +00:00
42fd414609 1.0.51 2020-10-01 14:22:07 +00:00
8f16f46c37 fix(core): update 2020-10-01 14:22:06 +00:00
f8afb2c7f6 1.0.50 2020-10-01 14:12:14 +00:00
a3d1fbb2da fix(core): update 2020-10-01 14:12:13 +00:00
0da1a1bc5b 1.0.49 2020-10-01 13:30:30 +00:00
1ede0b476a fix(core): update 2020-10-01 13:30:29 +00:00
1d251689bb 1.0.48 2020-09-29 16:15:52 +00:00
8f1492dfbd fix(core): update 2020-09-29 16:15:51 +00:00
003dc473ea 1.0.47 2020-09-29 15:58:28 +00:00
e6baed5470 fix(core): update 2020-09-29 15:58:26 +00:00
d9a27adb4a 1.0.46 2020-09-29 15:29:46 +00:00
eabb75a9a8 fix(core): update 2020-09-29 15:29:45 +00:00
deb63c1af5 1.0.45 2020-09-29 15:14:33 +00:00
7ee3969798 fix(core): update 2020-09-29 15:14:32 +00:00
61eea77805 1.0.44 2020-08-13 01:29:19 +00:00
3d9685ac6f fix(core): update 2020-08-13 01:29:19 +00:00
4ec56c3f0b 1.0.43 2020-07-12 00:47:42 +00:00
ab33720aba fix(core): update 2020-07-12 00:47:41 +00:00
5e42565567 1.0.42 2020-07-11 16:14:08 +00:00
88b7581eeb fix(core): update 2020-07-11 16:14:07 +00:00
10 changed files with 17291 additions and 3423 deletions

View File

@ -19,23 +19,36 @@ mirror:
stage: security
script:
- npmci git mirror
only:
- tags
tags:
- lossless
- docker
- notpriv
audit:
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --production --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=prod --production
tags:
- docker
allow_failure: true
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high
- npmci command npm audit --audit-level=high --only=dev
tags:
- lossless
- docker
- notpriv
allow_failure: true
# ====================
# test stage
@ -50,9 +63,7 @@ testStable:
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- priv
testBuild:
stage: test
@ -63,9 +74,7 @@ testBuild:
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- notpriv
release:
stage: release
@ -85,6 +94,8 @@ release:
codequality:
stage: metadata
allow_failure: true
only:
- tags
script:
- npmci command npm install -g tslint typescript
- npmci npm prepare

View File

@ -15,7 +15,7 @@
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm"]
"enum": ["website", "element", "service", "npm", "wcc"]
}
}
}

20563
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "@gitzone/tstest",
"version": "1.0.41",
"version": "1.0.58",
"private": false,
"description": "a test utility to run tests that match test/**/*.ts",
"main": "dist_ts/index.js",
@ -18,22 +18,22 @@
"build": "(tsbuild --web)"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.17",
"@pushrocks/tapbundle": "^3.2.7",
"tslint": "^6.1.2",
"@gitzone/tsbuild": "^2.1.27",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0"
},
"dependencies": {
"@gitzone/tsbundle": "^1.0.72",
"@gitzone/tsrun": "^1.2.12",
"@gitzone/tsbundle": "^1.0.87",
"@gitzone/tsrun": "^1.2.18",
"@pushrocks/consolecolor": "^2.0.1",
"@pushrocks/smartbrowser": "^1.0.17",
"@pushrocks/smartdelay": "^2.0.9",
"@pushrocks/smartexpress": "^3.0.73",
"@pushrocks/smartfile": "^7.0.6",
"@pushrocks/smartlog": "^2.0.19",
"@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartshell": "^2.0.25",
"@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartexpress": "^3.0.107",
"@pushrocks/smartfile": "^8.0.10",
"@pushrocks/smartlog": "^2.0.44",
"@pushrocks/smartpromise": "^3.1.6",
"@pushrocks/smartshell": "^2.0.28",
"@pushrocks/tapbundle": "^3.2.14",
"@types/figures": "^3.0.1",
"figures": "^3.0.0"
},
@ -48,5 +48,8 @@
"cli.js",
"npmextra.json",
"readme.md"
],
"browserslist": [
"last 1 chrome versions"
]
}

View File

@ -19,12 +19,15 @@ TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@gitzone/tstest)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@gitzone/tstest)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@gitzone/tstest)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@gitzone/tstest)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
## Usage
## Contribution
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
## Contribution

View File

@ -1,6 +1,10 @@
import { TsTest } from './tstest.classes.tstest';
export const runCli = async () => {
if (!process.argv[2]) {
console.error('You must specify a test directory as argument. Please try again.');
process.exit(1);
}
const tsTestInstance = new TsTest(process.cwd(), process.argv[2]);
await tsTestInstance.run();
};

View File

@ -28,6 +28,15 @@ export class TapCombinator {
` ${plugins.figures.pointer} ` +
`does not specify tests!`;
console.log(overviewString);
} else if (tapParser.expectedTests !== tapParser.receivedTests) {
failGlobal = true;
let overviewString =
logPrefixes.TsTestPrefix +
cs(` ${tapParser.fileName} ${plugins.figures.cross}`, 'red') +
` ${plugins.figures.pointer} ` +
tapParser.getTestOverviewAsString() +
`did not execute all specified tests!`;
console.log(overviewString);
} else if (tapParser.getErrorTests().length === 0) {
let overviewString =
logPrefixes.TsTestPrefix +

View File

@ -182,7 +182,12 @@ export class TapParser {
if (!this.expectedTests) {
console.log(cs('Error: No tests were defined. Therefore the testfile failed!', 'red'));
} else if (this.expectedTests !== this.receivedTests) {
console.log(cs('Error: The amount of received tests and expectedTests is unequal! Therefore the testfile failed', 'red'));
console.log(
cs(
'Error: The amount of received tests and expectedTests is unequal! Therefore the testfile failed',
'red'
)
);
} else if (this.getErrorTests().length === 0) {
console.log(`${logPrefixes.TapPrefix} ${cs(`All tests are successfull!!!`, 'green')}`);
} else {

View File

@ -37,16 +37,34 @@ export class TsTest {
const tapCombinator = new TapCombinator(); // lets create the TapCombinator
for (const fileNameArg of fileNamesToRun) {
let tapParser: TapParser;
switch (true) {
case process.env.CI && fileNameArg.includes('.nonci.'):
console.log('!!!!!!!!!!!');
console.log(
`not running testfile ${fileNameArg}, sinc we are CI and file name includes '.nonci.' tag`
);
console.log('!!!!!!!!!!!');
break;
case fileNameArg.endsWith('.browser.ts'):
tapParser = await this.runInChrome(fileNameArg);
const tapParserBrowser = await this.runInChrome(fileNameArg);
tapCombinator.addTapParser(tapParserBrowser);
break;
case fileNameArg.endsWith('.both.ts'):
console.log('>>>>>>> TEST PART 1: chrome');
const tapParserBothBrowser = await this.runInChrome(fileNameArg);
tapCombinator.addTapParser(tapParserBothBrowser);
console.log(cs(`|`.repeat(16), 'cyan'));
console.log(''); // force new line
console.log('>>>>>>> TEST PART 2: node');
const tapParserBothNode = await this.runInNode(fileNameArg);
tapCombinator.addTapParser(tapParserBothNode);
break;
default:
tapParser = await this.runInNode(fileNameArg);
const tapParserNode = await this.runInNode(fileNameArg);
tapCombinator.addTapParser(tapParserNode);
break;
}
tapCombinator.addTapParser(tapParser);
console.log(cs(`^`.repeat(16), 'cyan'));
console.log(''); // force new line
}
@ -56,7 +74,7 @@ export class TsTest {
public async runInNode(fileNameArg: string): Promise<TapParser> {
console.log(`${cs('=> ', 'blue')} Running ${cs(fileNameArg, 'orange')} in node.js runtime.`);
console.log(`${cs(`= `.repeat(32), 'cyan')}`);
const tapParser = new TapParser(fileNameArg);
const tapParser = new TapParser(fileNameArg + ':node');
// tsrun options
let tsrunOptions = '';
@ -82,7 +100,7 @@ export class TsTest {
// lets bundle the test
await plugins.smartfile.fs.ensureDir(tsbundleCacheDirPath);
await this.tsbundleInstance.buildTest(fileNameArg, bundleFilePath, 'parcel');
await this.tsbundleInstance.buildTest(process.cwd(), fileNameArg, bundleFilePath, 'parcel');
// lets create a server
const server = new plugins.smartexpress.Server({
@ -114,7 +132,7 @@ export class TsTest {
const evaluation = await this.smartbrowserInstance.evaluateOnPage(
`http://localhost:3007/test?bundleName=${bundleFileName}`,
async () => {
const convertToText = (obj) => {
const convertToText = (obj: any): string => {
// create an array that will later be joined into a string.
const stringArray = [];
@ -168,18 +186,23 @@ export class TsTest {
const bundleName = new URLSearchParams(window.location.search).get('bundleName');
console.log(`::TSTEST IN CHROMIUM:: Relevant Script name is: ${bundleName}`);
const bundleResponse = await fetch(`/${bundleName}`);
console.log(`::TSTEST IN CHROMIUM:: Got ${bundleName} with STATUS ${bundleResponse.status}`);
console.log(
`::TSTEST IN CHROMIUM:: Got ${bundleName} with STATUS ${bundleResponse.status}`
);
const bundle = await bundleResponse.text();
console.log(`::TSTEST IN CHROMIUM:: Executing ${bundleName}`);
try {
try {
// tslint:disable-next-line: no-eval
eval(bundle);
} catch (err) {
console.error(err);
}
if (globalThis.tapbundleDeferred && globalThis.tapbundleDeferred.promise) {
await globalThis.tapbundleDeferred.promise;
if (
(globalThis as any).tapbundleDeferred &&
(globalThis as any).tapbundleDeferred.promise
) {
await (globalThis as any).tapbundleDeferred.promise;
} else {
console.log('Error: Could not find tapbundle Deferred');
}
@ -188,10 +211,12 @@ export class TsTest {
);
await this.smartbrowserInstance.stop();
await server.stop();
console.log(`${cs('=> ', 'blue')} Stopped ${cs(fileNameArg, 'orange')} chromium instance and server.`);
console.log(
`${cs('=> ', 'blue')} Stopped ${cs(fileNameArg, 'orange')} chromium instance and server.`
);
console.log(`${cs('=> ', 'blue')} See the result captured from the chromium execution:`);
// lets create the tap parser
const tapParser = new TapParser(fileNameArg);
const tapParser = new TapParser(fileNameArg + ':chrome');
tapParser.handleTapLog(evaluation);
return tapParser;
}

View File

@ -12,15 +12,24 @@ import * as smartfile from '@pushrocks/smartfile';
import * as smartlog from '@pushrocks/smartlog';
import * as smartpromise from '@pushrocks/smartpromise';
import * as smartshell from '@pushrocks/smartshell';
import * as tapbundle from '@pushrocks/tapbundle';
export { consolecolor, smartbrowser, smartexpress, smartdelay, smartfile, smartlog, smartpromise, smartshell };
export {
consolecolor,
smartbrowser,
smartexpress,
smartdelay,
smartfile,
smartlog,
smartpromise,
smartshell,
tapbundle,
};
// @gitzone scope
import * as tsbundle from '@gitzone/tsbundle';
export {
tsbundle
};
export { tsbundle };
// sindresorhus
import * as figures from 'figures';