-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
416 additions
and
974 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"extends": "../../../.nvm/versions/node/v12.2.0/lib/node_modules/assemblyscript/std/assembly.json", | ||
"extends": "../../node_modules/assemblyscript/std/assembly.json", | ||
"include": ["./**/*.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
const asc = require("assemblyscript/cli/asc"); | ||
const { promisify } = require("util"); | ||
const glob = promisify(require("glob")); | ||
const Mocha = require("mocha"); | ||
|
||
async function main() { | ||
await asc.ready; | ||
|
||
await compileAllAsc(); | ||
|
||
await runTestsInNode(); | ||
} | ||
main(); | ||
|
||
async function compileAllAsc() { | ||
const ascFiles = await glob("./tests/**/*.ts"); | ||
const transformFile = require.resolve("../transform.js"); | ||
for (const ascFile of ascFiles) { | ||
console.log(`Compiling ${ascFile}...`); | ||
await asc.main([ | ||
"--exportRuntime", | ||
"--transform", | ||
transformFile, | ||
"--binaryFile", | ||
ascFile.replace(/\.ts$/, ".wasm"), | ||
ascFile | ||
]); | ||
} | ||
} | ||
|
||
async function runTestsInNode() { | ||
const mocha = new Mocha(); | ||
|
||
mocha.globalSetup(() => { | ||
console.log("GLOBAL SETUP"); | ||
}); | ||
|
||
const testFiles = await glob("./tests/**/test.js"); | ||
for (const testFile of testFiles) { | ||
mocha.addFile(testFile); | ||
} | ||
|
||
const failures = await runMochaAsync(mocha); | ||
console.log({ failures }); | ||
} | ||
|
||
function runMochaAsync(mocha) { | ||
return new Promise(resolve => { | ||
const runner = mocha.run(resolve); | ||
}); | ||
} |
Oops, something went wrong.