as-test 0.4.0 → 0.4.2

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/README.md +12 -12
  3. package/as-test.config.json +1 -1
  4. package/assembly/__tests__/array.spec.ts +3 -3
  5. package/assembly/src/expectation.ts +29 -16
  6. package/assembly/src/suite.ts +2 -0
  7. package/assembly/src/tests.ts +1 -0
  8. package/bin/build.js +65 -77
  9. package/bin/index.js +130 -160
  10. package/bin/init.js +96 -109
  11. package/bin/reporter.js +1 -1
  12. package/bin/run.js +210 -236
  13. package/bin/types.js +25 -25
  14. package/bin/util.js +35 -42
  15. package/cli/run.ts +13 -15
  16. package/cli/tsconfig.json +2 -1
  17. package/package.json +12 -9
  18. package/transform/lib/builder.js +1361 -0
  19. package/transform/lib/builder.js.map +1 -0
  20. package/transform/lib/coverage.js +6 -6
  21. package/transform/lib/coverage.js.map +1 -1
  22. package/transform/lib/index.js +1 -1
  23. package/transform/lib/index.js.map +1 -1
  24. package/transform/lib/linker.js +19 -0
  25. package/transform/lib/linker.js.map +1 -0
  26. package/transform/lib/mock.js +9 -9
  27. package/transform/lib/mock.js.map +1 -1
  28. package/transform/lib/range.js +13 -0
  29. package/transform/lib/range.js.map +1 -0
  30. package/transform/lib/types.js +26 -0
  31. package/transform/lib/types.js.map +1 -0
  32. package/transform/lib/util.js +47 -0
  33. package/transform/lib/util.js.map +1 -0
  34. package/transform/lib/visitor.js +532 -0
  35. package/transform/lib/visitor.js.map +1 -0
  36. package/transform/src/builder.ts +1474 -0
  37. package/transform/src/coverage.ts +6 -7
  38. package/transform/src/index.ts +1 -2
  39. package/transform/src/linker.ts +41 -0
  40. package/transform/src/mock.ts +9 -10
  41. package/transform/src/range.ts +12 -0
  42. package/transform/src/types.ts +35 -0
  43. package/transform/src/util.ts +81 -0
  44. package/transform/src/visitor.ts +744 -0
  45. package/.trunk/configs/.markdownlint.yaml +0 -2
  46. package/.trunk/configs/.yamllint.yaml +0 -7
  47. package/.trunk/trunk.yaml +0 -34
  48. package/bin/about.js +0 -135
  49. package/bin/package.json +0 -3
package/cli/run.ts CHANGED
@@ -1,19 +1,18 @@
1
1
  import chalk from "chalk";
2
2
  import { exec } from "child_process";
3
3
  import { glob } from "glob";
4
-
5
4
  import { formatTime, getExec, loadConfig } from "./util.js";
6
5
  import * as path from "path";
7
6
  import { existsSync, mkdirSync, writeFileSync } from "fs";
8
7
  import { diff } from "typer-diff";
8
+ import gradient from "gradient-string";
9
9
 
10
10
  const CONFIG_PATH = path.join(process.cwd(), "./as-test.config.json");
11
-
11
+ const version = "0.4.0";
12
12
  export async function run() {
13
13
  const reports: any[] = [];
14
14
  const config = loadConfig(CONFIG_PATH);
15
15
  const inputFiles = await glob(config.input);
16
-
17
16
  console.log(
18
17
  chalk.dim("Running tests using " + config.runOptions.runtime.name + ""),
19
18
  );
@@ -30,19 +29,18 @@ export async function run() {
30
29
 
31
30
  if (inputFiles.length) {
32
31
  console.log(
33
- chalk.bold.blueBright(` _____ _____ _____ _____ _____ _____ `),
34
- );
35
- console.log(
36
- chalk.bold.blueBright(`| _ || __| ___|_ _|| __|| __||_ _|`),
37
- );
38
- console.log(
39
- chalk.bold.blueBright(`| ||__ ||___| | | | __||__ | | | `),
40
- );
41
- console.log(
42
- chalk.bold.blueBright(`|__|__||_____| |_| |_____||_____| |_| `),
32
+ "\n" +
33
+ gradient(["#87afff", "#3a5fcd"])
34
+ .multiline(` █████ ███████ ████████ ███████ ███████ ████████
35
+ ██ ██ ██ ██ ██ ██ ██
36
+ ███████ ███████ █████ ██ █████ ███████ ██
37
+ ██ ██ ██ ██ ██ ██ ██
38
+ ██ ██ ███████ ██ ███████ ███████ ██ `),
43
39
  );
44
40
  console.log(
45
- chalk.dim("\n------------------- v0.3.5 -------------------\n"),
41
+ chalk.dim(
42
+ `\n----------------------- v${version} -----------------------\n`,
43
+ ),
46
44
  );
47
45
  }
48
46
 
@@ -132,7 +130,7 @@ export async function run() {
132
130
  JSON.stringify(test.right),
133
131
  );
134
132
  let expected = "";
135
- let received = chalk.dim(JSON.stringify(test._left));
133
+ let received = chalk.dim(JSON.stringify(test.left));
136
134
  for (const res of diffResult.diff) {
137
135
  switch (res.type) {
138
136
  case "correct": {
package/cli/tsconfig.json CHANGED
@@ -3,6 +3,7 @@
3
3
  "target": "ES2020",
4
4
  "outDir": "../bin",
5
5
  "importHelpers": false,
6
- "moduleResolution": "Node10"
6
+ "moduleResolution": "Node10",
7
+ "resolveJsonModule": true
7
8
  }
8
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "as-test",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Testing framework for AssemblyScript. Compatible with WASI or Bindings ",
5
5
  "types": "assembly/index.ts",
6
6
  "author": "Jairus Tanaka",
@@ -17,13 +17,12 @@
17
17
  },
18
18
  "devDependencies": {
19
19
  "@assemblyscript/wasi-shim": "^0.1.0",
20
- "@types/node": "^22.13.9",
20
+ "@types/node": "^22.13.10",
21
21
  "as-sleep": "^0.0.2",
22
22
  "as-test": "./",
23
- "assemblyscript": "^0.27.34",
23
+ "assemblyscript": "^0.27.35",
24
24
  "assemblyscript-prettier": "^3.0.1",
25
- "typescript": "^5.8.2",
26
- "visitor-as": "^0.11.4"
25
+ "typescript": "^5.8.2"
27
26
  },
28
27
  "dependencies": {
29
28
  "as-console": "^7.0.0",
@@ -31,12 +30,16 @@
31
30
  "as-variant": "^0.4.1",
32
31
  "chalk": "^5.4.1",
33
32
  "glob": "^11.0.1",
34
- "json-as": "^1.0.0",
33
+ "gradient-string": "^3.0.0",
35
34
  "typer-diff": "^1.1.1"
36
35
  },
37
- "overrides": {
38
- "assemblyscript": "$assemblyscript",
39
- "visitor-as": "$visitor-as"
36
+ "peerDependencies": {
37
+ "json-as": "1.1.11"
38
+ },
39
+ "peerDependenciesMeta": {
40
+ "json-as": {
41
+ "optional": true
42
+ }
40
43
  },
41
44
  "repository": {
42
45
  "type": "git",