testeranto 0.9.21 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/bin/build.sh +2 -3
- package/bin/report.sh +0 -1
- package/bin/watch.sh +1 -3
- package/package.json +12 -11
- package/src/Report.tsx +1 -1
- package/src/build.ts +79 -0
- package/src/lib/Scheduler.ts +21 -14
- package/src/watch.ts +38 -28
- package/testerantoDemo.gif +0 -0
- package/testerantoDemo.mov +0 -0
- package/src/build.js +0 -88
- package/yarn-error.log +0 -3144
package/README.md
CHANGED
package/bin/build.sh
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env sh
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
yarn nodemon --config nodemon.json ./node_modules/testeranto/src/build.js ../../../testeranto.config.json
|
|
3
|
+
# yarn nodemon --config nodemon.json ./node_modules/testeranto/src/build.js ../../../testeranto.config.js
|
|
4
|
+
ts-node --swc ./node_modules/testeranto/src/build.ts ../../../testeranto.config.ts
|
package/bin/report.sh
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env sh
|
|
2
2
|
|
|
3
|
-
# yarn nodemon --config nodemon.json ./node_modules/testeranto/src/build.ts testeranto.config.json
|
|
4
3
|
cp ./node_modules/testeranto/dist/reporter.css ./dist/reporter.css
|
|
5
4
|
cp ./node_modules/testeranto/dist/reporter.js ./dist/reporter.js
|
|
6
5
|
cp ./node_modules/testeranto/dist/reporter.html ./dist/reporter.html
|
package/bin/watch.sh
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "testeranto",
|
|
3
3
|
"description": "teeny tiny tightly-typed typescript tests",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.10.1",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
7
7
|
"repository": "git@github.com:adamwong246/testeranto.git",
|
|
@@ -28,26 +28,27 @@
|
|
|
28
28
|
"tableflip": "yarn clean && yarn bundle:reporter"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@
|
|
31
|
+
"@swc/core": "^1.3.26",
|
|
32
32
|
"@types/react": "^18.0.21",
|
|
33
|
-
"
|
|
34
|
-
"eslint-plugin-react": "^7.31.11",
|
|
35
|
-
"nodemon": "^2.0.20",
|
|
36
|
-
"react-dom": "^18.2.0",
|
|
37
|
-
"react-redux": "^8.0.4",
|
|
38
|
-
"react-test-renderer": "^18.2.0",
|
|
39
|
-
"react": "18.2.0",
|
|
33
|
+
"@types/react-dom": "^18.0.6",
|
|
40
34
|
"@typescript-eslint/eslint-plugin": "^5.46.0",
|
|
41
35
|
"@typescript-eslint/parser": "^5.46.0",
|
|
36
|
+
"babel-loader": "^8.2.5",
|
|
42
37
|
"bootstrap": "^5.2.3",
|
|
43
38
|
"cancelable-promise": "^4.3.1",
|
|
44
|
-
"esbuild": "
|
|
39
|
+
"esbuild": "0.17.5",
|
|
45
40
|
"eslint": "^8.29.0",
|
|
41
|
+
"eslint-plugin-react": "^7.31.11",
|
|
46
42
|
"fresh-require": "^1.0.3",
|
|
43
|
+
"graphology": "^0.25.1",
|
|
47
44
|
"graphology-dag": "^0.2.0",
|
|
48
45
|
"graphology-types": "^0.24.5",
|
|
49
|
-
"
|
|
46
|
+
"nodemon": "^2.0.20",
|
|
47
|
+
"react": "18.2.0",
|
|
50
48
|
"react-bootstrap": "^2.7.0",
|
|
49
|
+
"react-dom": "^18.2.0",
|
|
50
|
+
"react-redux": "^8.0.4",
|
|
51
|
+
"react-test-renderer": "^18.2.0",
|
|
51
52
|
"ts-node": "^10.9.1",
|
|
52
53
|
"typescript": "4.8.2"
|
|
53
54
|
}
|
package/src/Report.tsx
CHANGED
|
@@ -31,7 +31,7 @@ export function Report() {
|
|
|
31
31
|
|
|
32
32
|
const getData = async () => {
|
|
33
33
|
|
|
34
|
-
const configs = await (await fetch('testeranto.config.
|
|
34
|
+
const configs = await (await fetch('testeranto.config.js')).json();
|
|
35
35
|
const features = await (await fetch('TesterantoFeatures.json')).json();
|
|
36
36
|
const featureTests = await (await fetch('results/featureTestJoin.json')).json();
|
|
37
37
|
const summaries = await (await fetch('report.json')).json();
|
package/src/build.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as esbuild from 'esbuild';
|
|
2
|
+
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import path from "path";
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
6
|
+
const createHash = require("node:crypto").createHash;
|
|
7
|
+
|
|
8
|
+
console.log("build.sh", process.cwd(), process.argv);
|
|
9
|
+
|
|
10
|
+
import(process.argv[2]).then(async (testerantoConfigImport) => {
|
|
11
|
+
|
|
12
|
+
const testerantoConfig = testerantoConfigImport.default;
|
|
13
|
+
|
|
14
|
+
console.log("testerantoConfig", testerantoConfig)
|
|
15
|
+
|
|
16
|
+
const entryPoints = [
|
|
17
|
+
testerantoConfig.features,
|
|
18
|
+
...testerantoConfig.tests.map(([key, sourcefile, className]) => {
|
|
19
|
+
return sourcefile
|
|
20
|
+
})
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
console.log("entryPoints", entryPoints)
|
|
24
|
+
|
|
25
|
+
let ctx = await esbuild.context({
|
|
26
|
+
entryPoints,
|
|
27
|
+
bundle: true,
|
|
28
|
+
minify: false,
|
|
29
|
+
format: "esm",
|
|
30
|
+
target: ["esnext"],
|
|
31
|
+
write: true,
|
|
32
|
+
outdir: 'dist/tests',
|
|
33
|
+
packages: 'external',
|
|
34
|
+
plugins: [
|
|
35
|
+
|
|
36
|
+
{
|
|
37
|
+
name: 'import-path',
|
|
38
|
+
setup(build) {
|
|
39
|
+
build.onResolve({ filter: /^\.{1,2}\// }, args => {
|
|
40
|
+
|
|
41
|
+
const importedPath = args.resolveDir + "/" + args.path;
|
|
42
|
+
const absolutePath = path.resolve(importedPath);
|
|
43
|
+
|
|
44
|
+
const absolutePath2 = path.resolve(testerantoConfig.features).split(".ts").slice(0, -1).join('.ts');
|
|
45
|
+
|
|
46
|
+
if (absolutePath === absolutePath2) {
|
|
47
|
+
return {
|
|
48
|
+
path: process.cwd() + "/dist/tests/testerantoFeatures.test.js",
|
|
49
|
+
external: true
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
// return {
|
|
53
|
+
// path: path.resolve(importedPath), external: false
|
|
54
|
+
// }
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
...testerantoConfig.loaders || [],
|
|
61
|
+
|
|
62
|
+
],
|
|
63
|
+
external: [
|
|
64
|
+
testerantoConfig.features
|
|
65
|
+
]
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
await ctx.watch()
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
let { host, port } = await ctx.serve({
|
|
72
|
+
servedir: 'dist',
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
76
|
+
|
|
77
|
+
fs.promises.writeFile("./dist/testeranto.config.js", JSON.stringify(testerantoConfig));
|
|
78
|
+
|
|
79
|
+
})
|
package/src/lib/Scheduler.ts
CHANGED
|
@@ -59,22 +59,29 @@ export class Scheduler {
|
|
|
59
59
|
}, TIMEOUT);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
public testFileTouched(key, distFile, className
|
|
63
|
-
if (hash !== this.testSrcMd5s[key]) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
62
|
+
public async testFileTouched(key, distFile, className) {
|
|
63
|
+
// if (hash !== this.testSrcMd5s[key]) {
|
|
64
|
+
// console.log("running", key);
|
|
65
|
+
// this.testSrcMd5s[key] = hash;
|
|
66
|
+
// this.push(new (fresh(distFile, require)[className])()[0], key);
|
|
67
|
+
// }
|
|
68
|
+
console.log(key, distFile, className)
|
|
69
|
+
|
|
70
|
+
const x = await fresh(distFile, require)[className]
|
|
71
|
+
console.log()
|
|
72
|
+
|
|
73
|
+
this.push(new (x)()[0], key);
|
|
68
74
|
}
|
|
69
75
|
|
|
70
|
-
public featureFileTouched(distFile
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
public featureFileTouched(distFile) {
|
|
77
|
+
this.setFeatures((fresh(distFile, require)['default']));
|
|
78
|
+
// if (hash !== this.featureSrcMd5) {
|
|
79
|
+
// console.log("running featureSrcMd5");
|
|
80
|
+
// this.featureSrcMd5 = hash;
|
|
81
|
+
// this.setFeatures((fresh(distFile, require)['default']));
|
|
82
|
+
// } else {
|
|
83
|
+
// console.log("feature file changed but md5 hash did not")
|
|
84
|
+
// }
|
|
78
85
|
}
|
|
79
86
|
|
|
80
87
|
private async setFeatures(testerantoFeatures: TesterantoFeatures) {
|
package/src/watch.ts
CHANGED
|
@@ -10,7 +10,8 @@ const configFile = `${process.cwd()}/${process.argv[2]}`;
|
|
|
10
10
|
|
|
11
11
|
console.log("watch.ts configFile", configFile);
|
|
12
12
|
|
|
13
|
-
import(configFile).then((
|
|
13
|
+
import(configFile).then((testerantoConfigImport) => {
|
|
14
|
+
const configModule = testerantoConfigImport.default;
|
|
14
15
|
|
|
15
16
|
console.log("build.ts tProject", configModule);
|
|
16
17
|
const tProject = new TesterantoProject(configModule.tests, configModule.features, configModule.ports)
|
|
@@ -21,45 +22,54 @@ import(configFile).then((configModule) => {
|
|
|
21
22
|
(async function () {
|
|
22
23
|
for await (const [ndx, [key, sourcefile, className]] of tProject.tests.entries()) {
|
|
23
24
|
const distFile = process.cwd() + "/dist/" + sourcefile.split(".ts")[0] + ".js";
|
|
24
|
-
const md5File = process.cwd() + "/dist/" + sourcefile.split(".ts")[0] + ".md5";
|
|
25
|
+
// const md5File = process.cwd() + "/dist/" + sourcefile.split(".ts")[0] + ".md5";
|
|
25
26
|
|
|
26
|
-
fs.readFile(md5File, 'utf-8', (err, firstmd5hash) => {
|
|
27
|
-
|
|
27
|
+
// fs.readFile(md5File, 'utf-8', (err, firstmd5hash) => {
|
|
28
|
+
// TRM.testFileTouched(key, distFile, className, firstmd5hash);
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (err) {
|
|
32
|
-
console.error(err)
|
|
33
|
-
process.exit(-1)
|
|
34
|
-
}
|
|
30
|
+
watchFile(distFile, () => {
|
|
31
|
+
TRM.testFileTouched(key, distFile, className);
|
|
35
32
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
// fs.readFile(distFile, 'utf-8', (err, newmd5Hash) => {
|
|
34
|
+
// if (err) {
|
|
35
|
+
// console.error(err)
|
|
36
|
+
// process.exit(-1)
|
|
37
|
+
// }
|
|
38
|
+
|
|
39
|
+
// TRM.testFileTouched(key, distFile, className);
|
|
40
|
+
// })
|
|
39
41
|
});
|
|
42
|
+
// });
|
|
43
|
+
|
|
44
|
+
TRM.testFileTouched(key, distFile, className);
|
|
45
|
+
|
|
40
46
|
}
|
|
41
47
|
|
|
42
48
|
///////////////////////////////////////////////////////////////////////////////////////
|
|
43
49
|
|
|
44
50
|
const featureFile = tProject.features;
|
|
45
51
|
const distFile = process.cwd() + "/dist/" + featureFile.split(".ts")[0] + ".js";
|
|
46
|
-
const md5File = process.cwd() + "/dist/" + featureFile.split(".ts")[0] + ".md5";
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
// const md5File = process.cwd() + "/dist/" + featureFile.split(".ts")[0] + ".md5";
|
|
53
|
+
|
|
54
|
+
TRM.featureFileTouched(distFile);
|
|
55
|
+
// fs.readFile(featureFile, 'utf-8', (err, featuresFileContents) => {
|
|
56
|
+
// TRM.featureFileTouched(distFile);
|
|
57
|
+
|
|
58
|
+
watchFile(distFile, () => {
|
|
59
|
+
TRM.featureFileTouched(distFile);
|
|
60
|
+
// fs.readFile(distFile, 'utf-8', (err, newContents) => {
|
|
61
|
+
// if (err) {
|
|
62
|
+
// console.error(err)
|
|
63
|
+
// process.exit(-1)
|
|
64
|
+
// }
|
|
65
|
+
|
|
66
|
+
// TRM.featureFileTouched(distFile);
|
|
67
|
+
// })
|
|
61
68
|
});
|
|
62
69
|
|
|
70
|
+
// // TRM.featureFileTouched(distFile);
|
|
71
|
+
// });
|
|
72
|
+
|
|
63
73
|
|
|
64
74
|
|
|
65
75
|
TRM.launch();
|
|
Binary file
|
|
Binary file
|
package/src/build.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
// /* eslint-disable no-undef */
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
3
|
-
|
|
4
|
-
const esbuild = require("esbuild");
|
|
5
|
-
const fs = require("fs");
|
|
6
|
-
const path = require("path");
|
|
7
|
-
const createHash = require("node:crypto").createHash;
|
|
8
|
-
|
|
9
|
-
console.log("hello build.sh", process.cwd(), process.argv);
|
|
10
|
-
|
|
11
|
-
const testerantoConfig = require(process.argv[2]);
|
|
12
|
-
|
|
13
|
-
fs.promises.writeFile("./dist/testeranto.config.json", JSON.stringify(testerantoConfig));
|
|
14
|
-
|
|
15
|
-
esbuild.build({
|
|
16
|
-
entryPoints: [testerantoConfig.features],
|
|
17
|
-
bundle: true,
|
|
18
|
-
minify: false,
|
|
19
|
-
format: "esm",
|
|
20
|
-
target: ["esnext"],
|
|
21
|
-
write: false,
|
|
22
|
-
packages: 'external',
|
|
23
|
-
}).then((res) => {
|
|
24
|
-
const text = res.outputFiles[0].text;
|
|
25
|
-
const hash = createHash('md5').update(text).digest('hex');
|
|
26
|
-
const jsFile = process.cwd() + "/dist/tests/testerantoFeatures.test.js";
|
|
27
|
-
const md5File = process.cwd() + "/dist/tests/testerantoFeatures.test.md5";
|
|
28
|
-
|
|
29
|
-
fs.promises.mkdir(path.dirname(process.cwd() + "./dist/tests/"), { recursive: true }).then(x => {
|
|
30
|
-
console.log("build.js feature", hash, jsFile);
|
|
31
|
-
|
|
32
|
-
fs.promises.writeFile(jsFile, text);
|
|
33
|
-
fs.promises.writeFile(md5File, hash)
|
|
34
|
-
})
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
/////////////////////////////////////////////////////////////////////////////////
|
|
38
|
-
|
|
39
|
-
testerantoConfig.tests.forEach(([key, sourcefile, className]) => {
|
|
40
|
-
esbuild.build({
|
|
41
|
-
entryPoints: [sourcefile],
|
|
42
|
-
bundle: true,
|
|
43
|
-
minify: false,
|
|
44
|
-
format: "esm",
|
|
45
|
-
target: ["esnext"],
|
|
46
|
-
write: false,
|
|
47
|
-
packages: 'external',
|
|
48
|
-
plugins: [{
|
|
49
|
-
name: 'import-path',
|
|
50
|
-
setup(build) {
|
|
51
|
-
build.onResolve({ filter: /^\.{1,2}\// }, args => {
|
|
52
|
-
|
|
53
|
-
const importedPath = args.resolveDir + "/" + args.path;
|
|
54
|
-
const absolutePath = path.resolve(importedPath);
|
|
55
|
-
|
|
56
|
-
const absolutePath2 = path.resolve(testerantoConfig.features).split(".ts").slice(0, -1).join('.ts');
|
|
57
|
-
|
|
58
|
-
if (absolutePath === absolutePath2) {
|
|
59
|
-
return {
|
|
60
|
-
path: process.cwd() + "/dist/tests/testerantoFeatures.test.js",
|
|
61
|
-
external: true
|
|
62
|
-
}
|
|
63
|
-
} else {
|
|
64
|
-
// return {
|
|
65
|
-
// path: path.resolve(importedPath), external: false
|
|
66
|
-
// }
|
|
67
|
-
}
|
|
68
|
-
})
|
|
69
|
-
},
|
|
70
|
-
}],
|
|
71
|
-
external: [
|
|
72
|
-
testerantoConfig.features
|
|
73
|
-
],
|
|
74
|
-
}).then((res) => {
|
|
75
|
-
|
|
76
|
-
const text = res.outputFiles[0].text;
|
|
77
|
-
|
|
78
|
-
const pp = "./dist/" + (sourcefile.split(process.cwd()).pop()).split(".ts")[0] + '.js';
|
|
79
|
-
const xx = "./dist/" + (sourcefile.split(process.cwd()).pop()).split(".ts")[0] + `.md5`;
|
|
80
|
-
|
|
81
|
-
fs.promises.mkdir(path.dirname(pp), { recursive: true }).then(x => {
|
|
82
|
-
const hash = createHash('md5').update(text).digest('hex');
|
|
83
|
-
console.log("build.js test", key, hash);
|
|
84
|
-
fs.promises.writeFile(pp, text);
|
|
85
|
-
fs.promises.writeFile(xx, hash);
|
|
86
|
-
})
|
|
87
|
-
})
|
|
88
|
-
});
|