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
1 change: 1 addition & 0 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ under the licensing terms detailed in LICENSE:
* Fabián Heredia Montiel <fabianhjr@users.noreply.github.com>
* Jonas Minnberg <sasq64@gmail.com>
* Kam Chehresa <kaz.che@gmail.com>
* Mopsgamer <79159094+Mopsgamer@users.noreply.github.com>

Portions of this software are derived from third-party works licensed under
the following terms:
Expand Down
19 changes: 11 additions & 8 deletions bin/asinit.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ if (/^(\.\.[/\\])*node_modules[/\\]assemblyscript[/\\]/.test(tsconfigBase)) {
}
const entryFile = path.join(assemblyDir, "index.ts");
const buildDir = path.join(projectDir, "build");
const testsDir = path.join(projectDir, "tests");
const testsDir = path.join(projectDir, "test");
const gitignoreFile = path.join(buildDir, ".gitignore");
const packageFile = path.join(projectDir, "package.json");

Expand Down Expand Up @@ -358,7 +358,7 @@ function ensurePackageJson() {
"asbuild:debug": buildDebug,
"asbuild:release": buildRelease,
"asbuild": buildAll,
"test": "node tests",
"test": "node --test",
"start": "npx serve ."
},
"devDependencies": {
Expand Down Expand Up @@ -390,7 +390,7 @@ function ensurePackageJson() {
updated = true;
}
if (!scripts["test"] || scripts["test"] == npmDefaultTest) {
scripts["test"] = "node tests";
scripts["test"] = "node --test";
pkg["scripts"] = scripts;
updated = true;
}
Expand All @@ -416,7 +416,7 @@ function ensurePackageJson() {
}

function ensureTestsDirectory() {
console.log("- Making sure that the 'tests' directory exists...");
console.log("- Making sure that the 'test' directory exists...");
if (!fs.existsSync(testsDir)) {
fs.mkdirSync(testsDir);
console.log(stdoutColors.green(" Created: ") + testsDir);
Expand All @@ -427,13 +427,16 @@ function ensureTestsDirectory() {
}

function ensureTestsIndexJs() {
console.log("- Making sure that 'tests/index.js' exists...");
console.log("- Making sure that 'test/index.js' exists...");
if (!fs.existsSync(testsIndexFile)) {
fs.writeFileSync(testsIndexFile, [
"import assert from \"assert\";",
"import assert from \"node:assert/strict\";",
"import { it } from \"node:test\";",
"import { add } from \"../build/debug.js\";",
"assert.strictEqual(add(1, 2), 3);",
"console.log(\"ok\");"
"",
"it(\"add\", () => {",
" assert.equal(add(1, 2), 3);",
"});"
].join("\n") + "\n");
console.log(stdoutColors.green(" Created: ") + testsIndexFile);
} else {
Expand Down