diff --git a/NOTICE b/NOTICE index e7a2601827..6dc4400b82 100644 --- a/NOTICE +++ b/NOTICE @@ -60,6 +60,7 @@ under the licensing terms detailed in LICENSE: * Fabián Heredia Montiel * Jonas Minnberg * Kam Chehresa +* Mopsgamer <79159094+Mopsgamer@users.noreply.github.com> Portions of this software are derived from third-party works licensed under the following terms: diff --git a/bin/asinit.js b/bin/asinit.js index 6950a2341a..cb52aad48c 100755 --- a/bin/asinit.js +++ b/bin/asinit.js @@ -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"); @@ -358,7 +358,7 @@ function ensurePackageJson() { "asbuild:debug": buildDebug, "asbuild:release": buildRelease, "asbuild": buildAll, - "test": "node tests", + "test": "node --test", "start": "npx serve ." }, "devDependencies": { @@ -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; } @@ -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); @@ -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 {