From 29f36ade209a38137c33e0c6be2e83b747853237 Mon Sep 17 00:00:00 2001 From: adamward459 Date: Fri, 23 Feb 2024 15:52:47 +0700 Subject: [PATCH 1/6] Fix glob pattern in test script --- generate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate.js b/generate.js index d05c5e39..7103f78c 100755 --- a/generate.js +++ b/generate.js @@ -47,7 +47,7 @@ const typescriptTemplate = { dir: 'app-ts', main: 'app.ts', scripts: { - test: 'npm run build:ts && tsc -p test/tsconfig.json && c8 node --test -r ts-node/register test/**/*.ts', + test: 'npm run build:ts && tsc -p test/tsconfig.json && c8 node --test -r ts-node/register \"test/**/*.ts\"', start: 'npm run build:ts && fastify start -l info dist/app.js', 'build:ts': 'tsc', 'watch:ts': 'tsc -w', From bf1859e48515d5ad03d5e1348dd01e13097493a6 Mon Sep 17 00:00:00 2001 From: adamward459 Date: Fri, 23 Feb 2024 16:29:36 +0700 Subject: [PATCH 2/6] Update generate.js Co-authored-by: Matteo Collina Signed-off-by: adamward459 --- generate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate.js b/generate.js index 7103f78c..23cf6642 100755 --- a/generate.js +++ b/generate.js @@ -47,7 +47,7 @@ const typescriptTemplate = { dir: 'app-ts', main: 'app.ts', scripts: { - test: 'npm run build:ts && tsc -p test/tsconfig.json && c8 node --test -r ts-node/register \"test/**/*.ts\"', + test: 'npm run build:ts && tsc -p test/tsconfig.json && c8 node --test -r ts-node/register \\"test/**/*.ts\\"', start: 'npm run build:ts && fastify start -l info dist/app.js', 'build:ts': 'tsc', 'watch:ts': 'tsc -w', From 24aeed12b2056d7dd8141c8df74bdaea921e7eef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=E1=BA=A1m=20Th=C3=A0nh=20Trung?= Date: Fri, 23 Feb 2024 16:34:42 +0700 Subject: [PATCH 3/6] Fix test script in generate-typescript.test.js --- test/generate-typescript.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/generate-typescript.test.js b/test/generate-typescript.test.js index 5535b1ac..20fad775 100644 --- a/test/generate-typescript.test.js +++ b/test/generate-typescript.test.js @@ -126,7 +126,7 @@ function define (t) { // by default this will be ISC but since we have a MIT licensed pkg file in upper dir, npm will set the license to MIT in this case // so for local tests we need to accept MIT as well t.ok(pkg.license === 'ISC' || pkg.license === 'MIT') - t.equal(pkg.scripts.test, 'npm run build:ts && tsc -p test/tsconfig.json && c8 node --test -r ts-node/register test/**/*.ts') + t.equal(pkg.scripts.test, 'npm run build:ts && tsc -p test/tsconfig.json && c8 node --test -r ts-node/register \\"test/**/*.ts\\"') t.equal(pkg.scripts.start, 'npm run build:ts && fastify start -l info dist/app.js') t.equal(pkg.scripts['build:ts'], 'tsc') t.equal(pkg.scripts['watch:ts'], 'tsc -w') From 1e9a4c8116afd60c1e2bbd338d70530c48cedbd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=E1=BA=A1m=20Th=C3=A0nh=20Trung?= Date: Fri, 23 Feb 2024 17:22:10 +0700 Subject: [PATCH 4/6] Fix test script in generate.js --- generate.js | 2 +- test/generate-typescript.test.js | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/generate.js b/generate.js index 23cf6642..05349ce7 100755 --- a/generate.js +++ b/generate.js @@ -47,7 +47,7 @@ const typescriptTemplate = { dir: 'app-ts', main: 'app.ts', scripts: { - test: 'npm run build:ts && tsc -p test/tsconfig.json && c8 node --test -r ts-node/register \\"test/**/*.ts\\"', + test: 'npm run build:ts && tsc -p test/tsconfig.json && c8 node --test -r ts-node/register "test/**/*.ts"', start: 'npm run build:ts && fastify start -l info dist/app.js', 'build:ts': 'tsc', 'watch:ts': 'tsc -w', diff --git a/test/generate-typescript.test.js b/test/generate-typescript.test.js index 20fad775..ed9ca9d8 100644 --- a/test/generate-typescript.test.js +++ b/test/generate-typescript.test.js @@ -115,7 +115,6 @@ function define (t) { function verifyPkg (t) { return new Promise((resolve, reject) => { const pkgFile = path.join(workdir, 'package.json') - readFile(pkgFile, function (err, data) { t.error(err) const pkg = JSON.parse(data) @@ -126,7 +125,7 @@ function define (t) { // by default this will be ISC but since we have a MIT licensed pkg file in upper dir, npm will set the license to MIT in this case // so for local tests we need to accept MIT as well t.ok(pkg.license === 'ISC' || pkg.license === 'MIT') - t.equal(pkg.scripts.test, 'npm run build:ts && tsc -p test/tsconfig.json && c8 node --test -r ts-node/register \\"test/**/*.ts\\"') + t.equal(pkg.scripts.test, 'npm run build:ts && tsc -p test/tsconfig.json && c8 node --test -r ts-node/register "test/**/*.ts"') t.equal(pkg.scripts.start, 'npm run build:ts && fastify start -l info dist/app.js') t.equal(pkg.scripts['build:ts'], 'tsc') t.equal(pkg.scripts['watch:ts'], 'tsc -w') @@ -143,7 +142,7 @@ function define (t) { t.equal(pkg.devDependencies.concurrently, cliPkg.devDependencies.concurrently) t.equal(pkg.devDependencies.typescript, cliPkg.devDependencies.typescript) - const testGlob = pkg.scripts.test.split(' ', 14)[13] + const testGlob = pkg.scripts.test.split(' ', 14)[13].replaceAll('"', '') t.equal(minimatch.match(['test/routes/plugins/more/test/here/ok.test.ts'], testGlob).length, 1, 'should match glob') resolve() From d59a17cff22617c02dbd109fb8a79122bad26854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=E1=BA=A1m=20Th=C3=A0nh=20Trung?= Date: Fri, 23 Feb 2024 17:23:58 +0700 Subject: [PATCH 5/6] Fix missing line break in generate-typescript.test.js --- test/generate-typescript.test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/generate-typescript.test.js b/test/generate-typescript.test.js index ed9ca9d8..f43d91f7 100644 --- a/test/generate-typescript.test.js +++ b/test/generate-typescript.test.js @@ -115,6 +115,7 @@ function define (t) { function verifyPkg (t) { return new Promise((resolve, reject) => { const pkgFile = path.join(workdir, 'package.json') + readFile(pkgFile, function (err, data) { t.error(err) const pkg = JSON.parse(data) From 4cc07134234234e3825a744fdf558d12129db999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=E1=BA=A1m=20Th=C3=A0nh=20Trung?= Date: Fri, 23 Feb 2024 17:24:40 +0700 Subject: [PATCH 6/6] Fix missing line break in generate-typescript.test.js --- test/generate-typescript.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/generate-typescript.test.js b/test/generate-typescript.test.js index f43d91f7..842bc4ab 100644 --- a/test/generate-typescript.test.js +++ b/test/generate-typescript.test.js @@ -115,7 +115,7 @@ function define (t) { function verifyPkg (t) { return new Promise((resolve, reject) => { const pkgFile = path.join(workdir, 'package.json') - + readFile(pkgFile, function (err, data) { t.error(err) const pkg = JSON.parse(data)