testeranto 0.79.36 → 0.79.38

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/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.79.36",
4
+ "version": "0.79.38",
5
5
  "engines": {
6
6
  "node": "18.18.0"
7
7
  },
package/src/Project.ts CHANGED
@@ -6,11 +6,7 @@ import { glob } from "glob";
6
6
 
7
7
  import esbuildNodeConfiger from "./esbuildConfigs/node.js";
8
8
  import esbuildWebConfiger from "./esbuildConfigs/web.js";
9
- // import esbuildFeaturesConfiger from "./esbuildConfigs/features.js";
10
-
11
9
  import webHtmlFrame from "./web.html.js";
12
- // import reportHtmlFrame from "./report.html.js";
13
-
14
10
  import { ITestTypes, IBaseConfig, IRunTime } from "./lib/types.js";
15
11
 
16
12
  var mode: "DEV" | "PROD" = process.argv[2] === "-dev" ? "DEV" : "PROD";
@@ -26,17 +22,9 @@ process.stdin.on("keypress", (str, key) => {
26
22
  }
27
23
  });
28
24
 
29
- // setInterval(() => {
30
- // const memoryUsage = process.memoryUsage();
31
- // console.log("Memory usage:", memoryUsage);
32
- // }, 10000); // Check every 10 seconds
33
-
34
25
  let nodeDone,
35
26
  webDone = false;
36
- const onFeaturesDone = () => {
37
- // featuresDone = true;
38
- onDone();
39
- };
27
+
40
28
  const onNodeDone = () => {
41
29
  nodeDone = true;
42
30
  onDone();
@@ -50,7 +38,6 @@ const onDone = () => {
50
38
  console.log(
51
39
  JSON.stringify(
52
40
  {
53
- // featuresDone,
54
41
  nodeDone,
55
42
  webDone,
56
43
  mode,
@@ -71,15 +58,15 @@ export class ITProject {
71
58
  config: IBaseConfig;
72
59
  mode: `up` | `down` = `up`;
73
60
 
74
- constructor(config: IBaseConfig) {
75
- this.config = config;
61
+ constructor(configs: IBaseConfig) {
62
+ this.config = configs;
76
63
 
77
64
  fs.writeFileSync(
78
- `${config.outdir}/testeranto.json`,
65
+ `${this.config.outdir}/testeranto.json`,
79
66
  JSON.stringify(
80
67
  {
81
- ...config,
82
- buildDir: process.cwd() + "/" + config.outdir,
68
+ ...this.config,
69
+ buildDir: process.cwd() + "/" + this.config.outdir,
83
70
  },
84
71
  null,
85
72
  2
@@ -99,7 +86,7 @@ export class ITProject {
99
86
  .join(".");
100
87
 
101
88
  const htmlFilePath = path.normalize(
102
- `${process.cwd()}/${config.outdir}/web/${sourceDir.join(
89
+ `${process.cwd()}/${this.config.outdir}/web/${sourceDir.join(
103
90
  "/"
104
91
  )}/${sourceFileNameMinusJs}.html`
105
92
  );
@@ -146,17 +133,17 @@ export class ITProject {
146
133
  // });
147
134
  // });
148
135
 
149
- glob(`./${config.outdir}/chunk-*.mjs`, { ignore: "node_modules/**" }).then(
150
- (chunks) => {
151
- chunks.forEach((chunk) => {
152
- fs.unlinkSync(chunk);
153
- });
154
- }
155
- );
136
+ glob(`./${this.config.outdir}/chunk-*.mjs`, {
137
+ ignore: "node_modules/**",
138
+ }).then((chunks) => {
139
+ chunks.forEach((chunk) => {
140
+ fs.unlinkSync(chunk);
141
+ });
142
+ });
156
143
 
157
144
  Promise.all([
158
145
  esbuild
159
- .context(esbuildNodeConfiger(config, nodeEntryPoints))
146
+ .context(esbuildNodeConfiger(this.config, nodeEntryPoints))
160
147
  .then(async (nodeContext) => {
161
148
  if (mode == "DEV") {
162
149
  await nodeContext.watch().then((v) => {
@@ -171,7 +158,7 @@ export class ITProject {
171
158
  return nodeContext;
172
159
  }),
173
160
  esbuild
174
- .context(esbuildWebConfiger(config, webEntryPoints))
161
+ .context(esbuildWebConfiger(this.config, webEntryPoints))
175
162
  .then(async (webContext) => {
176
163
  if (mode == "DEV") {
177
164
  await webContext.watch().then((v) => {
package/src/Puppeteer.ts CHANGED
@@ -25,23 +25,25 @@ process.stdin.on("keypress", (str, key) => {
25
25
  }
26
26
  });
27
27
 
28
- export default async (configs) => {
28
+ export default async (partialConfig) => {
29
+ const config = {
30
+ ...partialConfig,
31
+ buildDir: process.cwd() + "/" + partialConfig.outdir,
32
+ };
33
+
29
34
  fs.writeFileSync(
30
- `${configs.outdir}/testeranto.json`,
35
+ `${config.outdir}/testeranto.json`,
31
36
  JSON.stringify(
32
37
  {
33
- ...configs,
34
- buildDir: process.cwd() + "/" + configs.outdir,
38
+ ...config,
39
+ buildDir: process.cwd() + "/" + config.outdir,
35
40
  },
36
41
  null,
37
42
  2
38
43
  )
39
44
  );
40
- // const configs = jsonc.parse(
41
- // (await fs.readFileSync("./docs/testeranto.json")).toString()
42
- // ) as IBuiltConfig;
43
45
 
44
- const pm = new PM_Main(configs);
46
+ const pm = new PM_Main(config);
45
47
 
46
48
  await pm.startPuppeteer(
47
49
  {
@@ -84,25 +86,25 @@ export default async (configs) => {
84
86
  "."
85
87
  );
86
88
 
87
- configs.tests.forEach(([test, runtime, tr, sidecars]) => {
89
+ config.tests.forEach(([test, runtime, tr, sidecars]) => {
88
90
  if (runtime === "node") {
89
- pm.launchNode(test, destinationOfRuntime(test, "node", configs));
91
+ pm.launchNode(test, destinationOfRuntime(test, "node", config));
90
92
  } else if (runtime === "web") {
91
- pm.launchWeb(test, destinationOfRuntime(test, "web", configs), sidecars);
93
+ pm.launchWeb(test, destinationOfRuntime(test, "web", config), sidecars);
92
94
  } else {
93
95
  console.error("runtime makes no sense", runtime);
94
96
  }
95
97
  });
96
98
 
97
- console.log("ready and watching for changes...", configs.buildDir);
99
+ console.log("ready and watching for changes...", config.buildDir);
98
100
  fs.watch(
99
- configs.buildDir,
101
+ config.buildDir,
100
102
  {
101
103
  recursive: true,
102
104
  },
103
105
  (eventType, changedFile) => {
104
106
  if (changedFile) {
105
- configs.tests.forEach(([test, runtime, tr, sidecars]) => {
107
+ config.tests.forEach(([test, runtime, tr, sidecars]) => {
106
108
  if (eventType === "change" || eventType === "rename") {
107
109
  if (
108
110
  changedFile ===
@@ -113,7 +115,7 @@ export default async (configs) => {
113
115
  .concat("mjs")
114
116
  .join(".")
115
117
  ) {
116
- pm.launchNode(test, destinationOfRuntime(test, "node", configs));
118
+ pm.launchNode(test, destinationOfRuntime(test, "node", config));
117
119
  }
118
120
 
119
121
  if (
@@ -127,7 +129,7 @@ export default async (configs) => {
127
129
  ) {
128
130
  pm.launchWeb(
129
131
  test,
130
- destinationOfRuntime(test, "web", configs),
132
+ destinationOfRuntime(test, "web", config),
131
133
  sidecars
132
134
  );
133
135
  }
@@ -73,17 +73,15 @@ function listToTree(fileList) {
73
73
  return root.children;
74
74
  }
75
75
 
76
- export default (config: IBaseConfig) => {
76
+ export default (partialConfig: IBaseConfig) => {
77
+ const config = {
78
+ ...partialConfig,
79
+ buildDir: process.cwd() + "/" + partialConfig.outdir,
80
+ };
81
+
77
82
  fs.writeFileSync(
78
83
  `${config.outdir}/testeranto.json`,
79
- JSON.stringify(
80
- {
81
- ...config,
82
- buildDir: process.cwd() + "/" + config.outdir,
83
- },
84
- null,
85
- 2
86
- )
84
+ JSON.stringify(config, null, 2)
87
85
  );
88
86
 
89
87
  const app = express();
@@ -137,10 +135,10 @@ export default (config: IBaseConfig) => {
137
135
  // );
138
136
  // });
139
137
 
140
- app.get("/testeranto.json", (req, res) => {
141
- res.sendFile(`${process.cwd()}/docs/testeranto.json`);
142
- // res.json(config);
143
- });
138
+ // app.get("/testeranto.json", (req, res) => {
139
+ // // res.sendFile(`${process.cwd()}/docs/testeranto.json`);
140
+ // res.json(config);
141
+ // });
144
142
 
145
143
  app.get("/", (req, res) => {
146
144
  res.send(`<!DOCTYPE html>
@@ -210,7 +208,7 @@ export default (config: IBaseConfig) => {
210
208
  });
211
209
  });
212
210
 
213
- app.use("/docs", express.static(path.join(process.cwd(), "docs")));
211
+ app.use("/", express.static(path.join(process.cwd())));
214
212
 
215
213
  app.get("/docGal/fs.json", (req, res) => {
216
214
  const directoryPath = "./"; // Replace with the desired directory path