Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions docs/api-documents/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ export abstract class UnitTestFramework {
There are 2 useful fields.

- `exports`: contains exported function from test cases and [AS help API](https://github.com/AssemblyScript/assemblyscript/blob/3defefd5b09248d697a2e6bd1e7201c0cf98def1/lib/loader/index.d.ts#L23).
- `framework`: contains runtime provided function.

- `framework`: contains runtime provided function.</br>
- `log`: redirect log message from test cases to unittest framework. It will be showed in failed info.
::: details

Expand Down
2,725 changes: 1,459 additions & 1,266 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"prettier": "@schleifner/prettier-config",
"scripts": {
"watch:ts": "tsc --build ./src/tsconfig.json --watch",
"watch:ts": "concurrently --kill-others \"tsc --build ./src/tsconfig.json --watch\" \"tsc --build ./transform/tsconfig.json --watch\"",
"build": "node scripts/build_instrumentation.js -j 2 && tsc --build ./transform/tsconfig.json && tsc --build ./src/tsconfig.json",
"test:as": "node bin/as-test.js",
"test:ts": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
Expand Down Expand Up @@ -49,6 +49,7 @@
"@types/jest": "^29.5.0",
"@types/node": "^22.0.0",
"assemblyscript-prettier": "^3.0.1",
"concurrently": "^9.2.1",
"cross-env": "^7.0.3",
"diff": "^8.0.2",
"jest": "^29.5.0",
Expand Down
2 changes: 0 additions & 2 deletions src/type/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import { SourceFunctionInfo } from "../interface.ts";
declare global {
// why use var: [Remove block-scoped bindings from globalThis](https://github.com/microsoft/TypeScript/issues/30547)
// store listFunctions transform results in global
// eslint-disable-next-line no-var
var __functionInfos: Map<string, SourceFunctionInfo[]> | undefined;
// store listTestNames transform results in global
// eslint-disable-next-line no-var
var testNames: string[];
}

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/assertFailed/stdout.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Error Message:
This test will fail due to an assertion error
Reason: unreachable
at start:tests/e2e/assertFailed/assertOnTest.test~anonymous|0 (tests/e2e/assertFailed/assertOnTest.test.ts:6:2)
at executeTestFunction (tests/e2e/assertFailed/tmp/assertOnTest.test.instrumented.wasm:1:696)
at executeTestFunction (tests/e2e/assertFailed/tmp/assertOnTest.test.instrumented.wasm:1:649)

tests/e2e/assertFailed/tmp/assertOnInit.test - init:
Test Crashed!
Expand Down
2 changes: 1 addition & 1 deletion tests/ts/test/core/__snapshots__/instrument.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Instrument 1`] = `"{"debugFiles":["~lib/rt/common.ts","~lib/rt/tlsf.ts","~lib/shared/typeinfo.ts","~lib/rt/itcms.ts","tests/ts/fixture/constructor.ts","~lib/shared/runtime.ts","~lib/util/number.ts","~lib/util/math.ts","~lib/util/string.ts","~lib/rt.ts","~lib/util/error.ts"],"debugInfos":{"tests/ts/fixture/constructor/Foo#constructor":{"branchInfo":[[0,1],[0,2]],"index":0,"lineInfo":[[],[],[[4,7,25],[4,8,24],[4,11,4],[4,11,16]]]}}}"`;
exports[`Instrument 1`] = `"{"debugFiles":["~lib/rt/common.ts","~lib/rt/tlsf.ts","~lib/shared/typeinfo.ts","~lib/rt/itcms.ts","tests/ts/fixture/constructor.ts","~lib/shared/runtime.ts","~lib/util/number.ts","~lib/util/math.ts","~lib/util/string.ts","~lib/rt.ts","~lib/util/error.ts"],"debugInfos":{"start:tests/ts/fixture/constructor":{"branchInfo":[],"index":0,"lineInfo":[[[4,15,17],[4,15,25]]]},"tests/ts/fixture/constructor/Foo#constructor":{"branchInfo":[[0,1],[0,2]],"index":1,"lineInfo":[[],[],[[4,7,25],[4,8,24],[4,11,4],[4,11,16]]]}}}"`;
3 changes: 2 additions & 1 deletion tests/ts/test/core/instrument.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ test("Instrument", async () => {
expect(fs.existsSync(instrumentedWasm)).toEqual(true);
expect(fs.existsSync(debugInfo)).toEqual(true);
expect(fs.existsSync(expectInfo)).toEqual(true);
expect(fs.readFileSync(debugInfo, { encoding: "utf8" })).toMatchSnapshot();
const debugInfoContent = fs.readFileSync(debugInfo, { encoding: "utf8" });
expect(debugInfoContent).toMatchSnapshot();
});
2 changes: 0 additions & 2 deletions tests/ts/test/utils/wasmparser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,5 @@ test("parseSourceMapURL", () => {
const fp = join(__dirname, "..", "..", "fixture", "withSourceMapURL.wasm");
const buf = readFileSync(fp);
const arrayBuffer = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); // Convert Buffer to ArrayBuffer
console.log(arrayBuffer);

expect(parseSourceMapPath(arrayBuffer)).toBe("./release.wasm.map");
});