Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
dfac554303 | |||
1d751bdcdf | |||
bd6713eee8 | |||
440b41611b | |||
78a40de700 | |||
e0eb00d755 | |||
dbbcbf4ea2 | |||
8c13b9db89 | |||
f813a79124 | |||
766138aa25 | |||
72880b4a2d | |||
bd5731c439 | |||
0caebb7448 | |||
ed896b7f1c | |||
69ec5a98ab | |||
3b93886147 | |||
5949988293 | |||
04f7be07a3 | |||
d331f90d24 | |||
224400dcb5 |
@ -12,6 +12,9 @@ stages:
|
|||||||
- release
|
- release
|
||||||
- metadata
|
- metadata
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- npm install -g @shipzone/npmci
|
||||||
|
|
||||||
# ====================
|
# ====================
|
||||||
# security stage
|
# security stage
|
||||||
# ====================
|
# ====================
|
||||||
@ -33,9 +36,10 @@ auditProductionDependencies:
|
|||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
- npmci command npm install --production --ignore-scripts
|
- npmci command npm install --production --ignore-scripts
|
||||||
- npmci command npm config set registry https://registry.npmjs.org
|
- npmci command npm config set registry https://registry.npmjs.org
|
||||||
# - npmci command npm audit --audit-level=high --only=prod --production
|
- npmci command npm audit --audit-level=high --only=prod --production
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
auditDevDependencies:
|
auditDevDependencies:
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
24
.vscode/launch.json
vendored
24
.vscode/launch.json
vendored
@ -2,28 +2,10 @@
|
|||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "current file",
|
"command": "npm test",
|
||||||
"type": "node",
|
"name": "Run npm test",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"args": [
|
"type": "node-terminal"
|
||||||
"${relativeFile}"
|
|
||||||
],
|
|
||||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
|
||||||
"cwd": "${workspaceRoot}",
|
|
||||||
"protocol": "inspector",
|
|
||||||
"internalConsoleOptions": "openOnSessionStart"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "test.ts",
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"args": [
|
|
||||||
"test/test.ts"
|
|
||||||
],
|
|
||||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
|
||||||
"cwd": "${workspaceRoot}",
|
|
||||||
"protocol": "inspector",
|
|
||||||
"internalConsoleOptions": "openOnSessionStart"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
4
cli.child.ts
Normal file
4
cli.child.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
process.env.CLI_CALL = 'true';
|
||||||
|
import * as cliTool from './ts/index.js';
|
||||||
|
cliTool.runCli();
|
2
cli.js
2
cli.js
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
process.env.CLI_CALL = 'true';
|
process.env.CLI_CALL = 'true';
|
||||||
const cliTool = require('./dist_ts/index');
|
const cliTool = await import('./dist_ts/index.js');
|
||||||
cliTool.runCli();
|
cliTool.runCli();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
process.env.CLI_CALL = 'true';
|
process.env.CLI_CALL = 'true';
|
||||||
require('@gitzone/tsrun');
|
|
||||||
const cliTool = require('./ts/index');
|
import * as tsrun from '@gitzone/tsrun';
|
||||||
cliTool.runCli();
|
tsrun.runPath('./cli.child.js', import.meta.url);
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
"githost": "gitlab.com",
|
"githost": "gitlab.com",
|
||||||
"gitscope": "gitzone",
|
"gitscope": "gitzone",
|
||||||
"gitrepo": "tstest",
|
"gitrepo": "tstest",
|
||||||
"shortDescription": "a test utility to run tests that match test/**/*.ts",
|
"description": "a test utility to run tests that match test/**/*.ts",
|
||||||
"npmPackagename": "@gitzone/tstest",
|
"npmPackagename": "@gitzone/tstest",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
19661
package-lock.json
generated
19661
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
23
package.json
23
package.json
@ -1,10 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "@gitzone/tstest",
|
"name": "@gitzone/tstest",
|
||||||
"version": "1.0.55",
|
"version": "1.0.65",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "a test utility to run tests that match test/**/*.ts",
|
"description": "a test utility to run tests that match test/**/*.ts",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
|
"type": "module",
|
||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bin": {
|
"bin": {
|
||||||
@ -18,24 +19,24 @@
|
|||||||
"build": "(tsbuild --web)"
|
"build": "(tsbuild --web)"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.26",
|
"@gitzone/tsbuild": "^2.1.48",
|
||||||
"tslint": "^6.1.3",
|
"tslint": "^6.1.3",
|
||||||
"tslint-config-prettier": "^1.18.0"
|
"tslint-config-prettier": "^1.18.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@gitzone/tsbundle": "^1.0.84",
|
"@gitzone/tsbundle": "^1.0.91",
|
||||||
"@gitzone/tsrun": "^1.2.17",
|
"@gitzone/tsrun": "^1.2.31",
|
||||||
"@pushrocks/consolecolor": "^2.0.1",
|
"@pushrocks/consolecolor": "^2.0.1",
|
||||||
"@pushrocks/smartbrowser": "^1.0.17",
|
"@pushrocks/smartbrowser": "^1.0.22",
|
||||||
"@pushrocks/smartdelay": "^2.0.13",
|
"@pushrocks/smartdelay": "^2.0.13",
|
||||||
"@pushrocks/smartexpress": "^3.0.102",
|
"@pushrocks/smartexpress": "^3.0.108",
|
||||||
"@pushrocks/smartfile": "^8.0.10",
|
"@pushrocks/smartfile": "^9.0.6",
|
||||||
"@pushrocks/smartlog": "^2.0.44",
|
"@pushrocks/smartlog": "^2.0.44",
|
||||||
"@pushrocks/smartpromise": "^3.1.6",
|
"@pushrocks/smartpromise": "^3.1.7",
|
||||||
"@pushrocks/smartshell": "^2.0.28",
|
"@pushrocks/smartshell": "^2.0.30",
|
||||||
"@pushrocks/tapbundle": "^3.2.14",
|
"@pushrocks/tapbundle": "^4.0.8",
|
||||||
"@types/figures": "^3.0.1",
|
"@types/figures": "^3.0.1",
|
||||||
"figures": "^3.0.0"
|
"figures": "^4.0.0"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
|
24
readme.md
24
readme.md
@ -25,9 +25,29 @@ Platform support | [ or [contribute monthly](https://lossless.link/contribute). :)
|
lets assume we have a directory called test/ where all our tests arae defined. Simply type
|
||||||
|
|
||||||
|
```
|
||||||
|
tstest test/
|
||||||
|
```
|
||||||
|
|
||||||
|
to run all tests.
|
||||||
|
|
||||||
|
## Syntax
|
||||||
|
|
||||||
|
tstest supports tap syntax. In other words your testfiles are run in a subprocess, and the console output contains trigger messages for tstest to determine test status. Inside your testfile you should use `@pushrocks/tapbundle` for the best results.
|
||||||
|
|
||||||
|
## Environments
|
||||||
|
|
||||||
|
tstest supports different environments:
|
||||||
|
|
||||||
|
- a testfile called `test-something.node.ts` will be run in node
|
||||||
|
- a testfile called `test-something.chrome.ts` will be run in chrome environment (bundled through parcel and run through puppeteer)
|
||||||
|
- a testfile called `test-something.both.ts` will be run in node an chrome, which is good for isomorphic packages.
|
||||||
|
|
||||||
|
> note: there is alpha support for the deno environment by naming a file test-something.deno.ts
|
||||||
|
|
||||||
## Contribution
|
## Contribution
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@pushrocks/tapbundle';
|
||||||
import * as tstest from '../ts/index';
|
import * as tstest from '../ts/index.js';
|
||||||
|
|
||||||
tap.test('prepare test', async () => {});
|
tap.test('prepare test', async () => {});
|
||||||
|
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
import { TsTest } from './tstest.classes.tstest';
|
import { TsTest } from './tstest.classes.tstest.js';
|
||||||
|
|
||||||
export const runCli = async () => {
|
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]);
|
const tsTestInstance = new TsTest(process.cwd(), process.argv[2]);
|
||||||
await tsTestInstance.run();
|
await tsTestInstance.run();
|
||||||
};
|
};
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
// ============
|
// ============
|
||||||
// combines different tap test files to an overall result
|
// combines different tap test files to an overall result
|
||||||
// ============
|
// ============
|
||||||
import * as plugins from './tstest.plugins';
|
import * as plugins from './tstest.plugins.js';
|
||||||
import { coloredString as cs } from '@pushrocks/consolecolor';
|
import { coloredString as cs } from '@pushrocks/consolecolor';
|
||||||
|
|
||||||
import { TapParser } from './tstest.classes.tap.parser';
|
import { TapParser } from './tstest.classes.tap.parser.js';
|
||||||
import * as logPrefixes from './tstest.logprefixes';
|
import * as logPrefixes from './tstest.logprefixes.js';
|
||||||
|
|
||||||
export class TapCombinator {
|
export class TapCombinator {
|
||||||
tapParserStore: TapParser[] = [];
|
tapParserStore: TapParser[] = [];
|
||||||
|
@ -4,9 +4,9 @@ import { coloredString as cs } from '@pushrocks/consolecolor';
|
|||||||
// ============
|
// ============
|
||||||
// combines different tap test files to an overall result
|
// combines different tap test files to an overall result
|
||||||
// ============
|
// ============
|
||||||
import * as plugins from './tstest.plugins';
|
import * as plugins from './tstest.plugins.js';
|
||||||
import { TapTestResult } from './tstest.classes.tap.testresult';
|
import { TapTestResult } from './tstest.classes.tap.testresult.js';
|
||||||
import * as logPrefixes from './tstest.logprefixes';
|
import * as logPrefixes from './tstest.logprefixes.js';
|
||||||
|
|
||||||
export class TapParser {
|
export class TapParser {
|
||||||
testStore: TapTestResult[] = [];
|
testStore: TapTestResult[] = [];
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// ============
|
// ============
|
||||||
// combines different tap test files to an overall result
|
// combines different tap test files to an overall result
|
||||||
// ============
|
// ============
|
||||||
import * as plugins from './tstest.plugins';
|
import * as plugins from './tstest.plugins.js';
|
||||||
|
|
||||||
export class TapTestResult {
|
export class TapTestResult {
|
||||||
testLogBuffer = Buffer.from('');
|
testLogBuffer = Buffer.from('');
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import * as plugins from './tstest.plugins';
|
import * as plugins from './tstest.plugins.js';
|
||||||
import * as paths from './tstest.paths';
|
import * as paths from './tstest.paths.js';
|
||||||
import { Smartfile } from '@pushrocks/smartfile';
|
import { Smartfile } from '@pushrocks/smartfile';
|
||||||
|
|
||||||
// tap related stuff
|
// tap related stuff
|
||||||
import { TapCombinator } from './tstest.classes.tap.combinator';
|
import { TapCombinator } from './tstest.classes.tap.combinator.js';
|
||||||
import { TapParser } from './tstest.classes.tap.parser';
|
import { TapParser } from './tstest.classes.tap.parser.js';
|
||||||
import { TapTestResult } from './tstest.classes.tap.testresult';
|
import { TapTestResult } from './tstest.classes.tap.testresult.js';
|
||||||
|
|
||||||
export class TestDirectory {
|
export class TestDirectory {
|
||||||
/**
|
/**
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import * as plugins from './tstest.plugins';
|
import * as plugins from './tstest.plugins.js';
|
||||||
import * as paths from './tstest.paths';
|
import * as paths from './tstest.paths.js';
|
||||||
import * as logPrefixes from './tstest.logprefixes';
|
import * as logPrefixes from './tstest.logprefixes.js';
|
||||||
|
|
||||||
import { coloredString as cs } from '@pushrocks/consolecolor';
|
import { coloredString as cs } from '@pushrocks/consolecolor';
|
||||||
|
|
||||||
import { TestDirectory } from './tstest.classes.testdirectory';
|
import { TestDirectory } from './tstest.classes.testdirectory.js';
|
||||||
import { TapCombinator } from './tstest.classes.tap.combinator';
|
import { TapCombinator } from './tstest.classes.tap.combinator.js';
|
||||||
import { TapParser } from './tstest.classes.tap.parser';
|
import { TapParser } from './tstest.classes.tap.parser.js';
|
||||||
|
|
||||||
export class TsTest {
|
export class TsTest {
|
||||||
public testDir: TestDirectory;
|
public testDir: TestDirectory;
|
||||||
@ -100,7 +100,7 @@ export class TsTest {
|
|||||||
|
|
||||||
// lets bundle the test
|
// lets bundle the test
|
||||||
await plugins.smartfile.fs.ensureDir(tsbundleCacheDirPath);
|
await plugins.smartfile.fs.ensureDir(tsbundleCacheDirPath);
|
||||||
await this.tsbundleInstance.buildTest(process.cwd(), fileNameArg, bundleFilePath, 'parcel');
|
await this.tsbundleInstance.buildTest(process.cwd(), fileNameArg, bundleFilePath, 'rollup');
|
||||||
|
|
||||||
// lets create a server
|
// lets create a server
|
||||||
const server = new plugins.smartexpress.Server({
|
const server = new plugins.smartexpress.Server({
|
||||||
@ -198,7 +198,10 @@ export class TsTest {
|
|||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((globalThis as any).tapbundleDeferred && (globalThis as any).tapbundleDeferred.promise) {
|
if (
|
||||||
|
(globalThis as any).tapbundleDeferred &&
|
||||||
|
(globalThis as any).tapbundleDeferred.promise
|
||||||
|
) {
|
||||||
await (globalThis as any).tapbundleDeferred.promise;
|
await (globalThis as any).tapbundleDeferred.promise;
|
||||||
} else {
|
} else {
|
||||||
console.log('Error: Could not find tapbundle Deferred');
|
console.log('Error: Could not find tapbundle Deferred');
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import * as plugins from './tstest.plugins';
|
import * as plugins from './tstest.plugins.js';
|
||||||
import { coloredString as cs } from '@pushrocks/consolecolor';
|
import { coloredString as cs } from '@pushrocks/consolecolor';
|
||||||
|
|
||||||
export const TapPrefix = cs(`::TAP::`, 'pink', 'black');
|
export const TapPrefix = cs(`::TAP::`, 'pink', 'black');
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import * as plugins from './tstest.plugins';
|
import * as plugins from './tstest.plugins.js';
|
||||||
|
|
||||||
export const cwd = process.cwd();
|
export const cwd = process.cwd();
|
||||||
export const testDir = plugins.path.join(cwd, './test/');
|
export const testDir = plugins.path.join(cwd, './test/');
|
||||||
export const binDirectory = plugins.path.join(cwd, 'node_modules/.bin');
|
export const binDirectory = plugins.path.join(cwd, './node_modules/.bin');
|
||||||
|
@ -32,6 +32,6 @@ import * as tsbundle from '@gitzone/tsbundle';
|
|||||||
export { tsbundle };
|
export { tsbundle };
|
||||||
|
|
||||||
// sindresorhus
|
// sindresorhus
|
||||||
import * as figures from 'figures';
|
import figures from 'figures';
|
||||||
|
|
||||||
export { figures };
|
export { figures };
|
||||||
|
Reference in New Issue
Block a user