@@ -100,7 +100,7 @@ if (/^(\.\.[/\\])*node_modules[/\\]assemblyscript[/\\]/.test(tsconfigBase)) {
100100}
101101const entryFile = path . join ( assemblyDir , "index.ts" ) ;
102102const buildDir = path . join ( projectDir , "build" ) ;
103- const testsDir = path . join ( projectDir , "tests " ) ;
103+ const testsDir = path . join ( projectDir , "test " ) ;
104104const gitignoreFile = path . join ( buildDir , ".gitignore" ) ;
105105const packageFile = path . join ( projectDir , "package.json" ) ;
106106
@@ -358,7 +358,7 @@ function ensurePackageJson() {
358358 "asbuild:debug" : buildDebug ,
359359 "asbuild:release" : buildRelease ,
360360 "asbuild" : buildAll ,
361- "test" : "node tests " ,
361+ "test" : "node --test " ,
362362 "start" : "npx serve ."
363363 } ,
364364 "devDependencies" : {
@@ -390,7 +390,7 @@ function ensurePackageJson() {
390390 updated = true ;
391391 }
392392 if ( ! scripts [ "test" ] || scripts [ "test" ] == npmDefaultTest ) {
393- scripts [ "test" ] = "node tests " ;
393+ scripts [ "test" ] = "node --test " ;
394394 pkg [ "scripts" ] = scripts ;
395395 updated = true ;
396396 }
@@ -416,7 +416,7 @@ function ensurePackageJson() {
416416}
417417
418418function ensureTestsDirectory ( ) {
419- console . log ( "- Making sure that the 'tests ' directory exists..." ) ;
419+ console . log ( "- Making sure that the 'test ' directory exists..." ) ;
420420 if ( ! fs . existsSync ( testsDir ) ) {
421421 fs . mkdirSync ( testsDir ) ;
422422 console . log ( stdoutColors . green ( " Created: " ) + testsDir ) ;
@@ -427,13 +427,16 @@ function ensureTestsDirectory() {
427427}
428428
429429function ensureTestsIndexJs ( ) {
430- console . log ( "- Making sure that 'tests /index.js' exists..." ) ;
430+ console . log ( "- Making sure that 'test /index.js' exists..." ) ;
431431 if ( ! fs . existsSync ( testsIndexFile ) ) {
432432 fs . writeFileSync ( testsIndexFile , [
433- "import assert from \"assert\";" ,
433+ "import assert from \"node:assert/strict\";" ,
434+ "import { it } from \"node:test\";" ,
434435 "import { add } from \"../build/debug.js\";" ,
435- "assert.strictEqual(add(1, 2), 3);" ,
436- "console.log(\"ok\");"
436+ "" ,
437+ "it(\"add\", () => {" ,
438+ " assert.equal(add(1, 2), 3);" ,
439+ "});"
437440 ] . join ( "\n" ) + "\n" ) ;
438441 console . log ( stdoutColors . green ( " Created: " ) + testsIndexFile ) ;
439442 } else {
0 commit comments