From 121fdbdff9f5c46a88b5e51b4557fbf5e98a4cd2 Mon Sep 17 00:00:00 2001 From: Bret Comnes Date: Wed, 21 Jun 2023 15:36:05 -0700 Subject: [PATCH 1/4] Fix failing tests with cross-env --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index ee956fb3..80eb1eac 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "scripts": { "lint": "standard", "lint:fix": "standard --fix", - "unit:template-ts-esm": "TS_NODE_PROJECT=./templates/app-ts-esm/tsconfig.json tap templates/app-ts-esm/test/**/*.test.ts --no-coverage --node-arg=--loader=ts-node/esm --timeout 100", + "unit:template-ts-esm": " cross-env TS_NODE_PROJECT=./templates/app-ts-esm/tsconfig.json tap templates/app-ts-esm/test/**/*.test.ts --no-coverage --node-arg=--loader=ts-node/esm --timeout 100", "unit:cli": "tap \"test/**/*.test.{js,ts}\" --no-coverage --timeout 200", "unit:templates-without-ts-esm": "tap \"templates/app/**/*.test.js\" \"templates/app-esm/**/*.test.js\" \"templates/app-ts/**/*.test.ts\" --no-coverage --timeout 200", "pretest": "xcopy /e /k /i . \"..\\node_modules\\fastify-cli\" || rsync -r --exclude=node_modules ./ node_modules/fastify-cli || echo 'this is fine'", @@ -71,6 +71,7 @@ "@types/tap": "^15.0.5", "c8": "^7.13.0", "concurrently": "^7.0.0", + "cross-env": "^7.0.3", "del-cli": "^3.0.1", "fastify-tsconfig": "^1.0.1", "minimatch": "^5.1.0", From 5e34a4afef2daba400efa5bc9f062b27653ec257 Mon Sep 17 00:00:00 2001 From: Bret Comnes Date: Thu, 6 Jul 2023 09:40:32 -0700 Subject: [PATCH 2/4] Fix expected output --- package.json | 6 +++--- test/print-routes.test.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 80eb1eac..57f7fe81 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,9 @@ "scripts": { "lint": "standard", "lint:fix": "standard --fix", - "unit:template-ts-esm": " cross-env TS_NODE_PROJECT=./templates/app-ts-esm/tsconfig.json tap templates/app-ts-esm/test/**/*.test.ts --no-coverage --node-arg=--loader=ts-node/esm --timeout 100", - "unit:cli": "tap \"test/**/*.test.{js,ts}\" --no-coverage --timeout 200", - "unit:templates-without-ts-esm": "tap \"templates/app/**/*.test.js\" \"templates/app-esm/**/*.test.js\" \"templates/app-ts/**/*.test.ts\" --no-coverage --timeout 200", + "unit:template-ts-esm": " cross-env TS_NODE_PROJECT=./templates/app-ts-esm/tsconfig.json tap templates/app-ts-esm/test/**/*.test.ts --no-coverage --node-arg=--loader=ts-node/esm --timeout 100 --color -R specy", + "unit:cli": "tap \"test/**/*.test.{js,ts}\" --no-coverage --jobs=1 --timeout 400 --color -R specy", + "unit:templates-without-ts-esm": "tap \"templates/app/**/*.test.js\" \"templates/app-esm/**/*.test.js\" \"templates/app-ts/**/*.test.ts\" --no-coverage --timeout 200 --color -R specy", "pretest": "xcopy /e /k /i . \"..\\node_modules\\fastify-cli\" || rsync -r --exclude=node_modules ./ node_modules/fastify-cli || echo 'this is fine'", "test-no-coverage": "npm run unit:cli && npm run unit:templates-without-ts-esm && npm run unit:template-ts-esm && npm run test:typescript", "test": "c8 --clean npm run test-no-coverage", diff --git a/test/print-routes.test.js b/test/print-routes.test.js index 42ccd851..02789257 100644 --- a/test/print-routes.test.js +++ b/test/print-routes.test.js @@ -19,7 +19,7 @@ test('should print routes', async t => { await fastify.close() t.ok(spy.called) - t.same(spy.args, [['debug', '└── / (GET)\n / (HEAD)\n / (POST)\n']]) + t.same(spy.args, [['debug', '└── / (GET, HEAD, POST)\n']]) }) test('should print routes via cli', async t => { @@ -32,7 +32,7 @@ test('should print routes via cli', async t => { await command.cli(['./examples/plugin.js']) t.ok(spy.called) - t.same(spy.args, [['debug', '└── / (GET)\n / (HEAD)\n / (POST)\n']]) + t.same(spy.args, [['debug', '└── / (GET, HEAD, POST)\n']]) }) test('should warn on file not found', t => { @@ -109,5 +109,5 @@ test('should print routes of server with an async/await plugin', async t => { await fastify.close() t.ok(spy.called) - t.same(spy.args, [['debug', '└── / (GET)\n / (HEAD)\n']]) + t.same(spy.args, [['debug', '└── / (GET, HEAD)\n']]) }) From 26581539cc01fc60115750975039de7ecb43c0b8 Mon Sep 17 00:00:00 2001 From: Bret Comnes Date: Fri, 14 Jul 2023 15:02:46 -0700 Subject: [PATCH 3/4] Isolate failing test skips --- package.json | 4 ++-- test/start.test.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 57f7fe81..b951c097 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,9 @@ "scripts": { "lint": "standard", "lint:fix": "standard --fix", - "unit:template-ts-esm": " cross-env TS_NODE_PROJECT=./templates/app-ts-esm/tsconfig.json tap templates/app-ts-esm/test/**/*.test.ts --no-coverage --node-arg=--loader=ts-node/esm --timeout 100 --color -R specy", + "unit:template-ts-esm": " cross-env TS_NODE_PROJECT=./templates/app-ts-esm/tsconfig.json tap templates/app-ts-esm/test/**/*.test.ts --no-coverage --node-arg=--loader=ts-node/esm --timeout 400 --color -R specy", "unit:cli": "tap \"test/**/*.test.{js,ts}\" --no-coverage --jobs=1 --timeout 400 --color -R specy", - "unit:templates-without-ts-esm": "tap \"templates/app/**/*.test.js\" \"templates/app-esm/**/*.test.js\" \"templates/app-ts/**/*.test.ts\" --no-coverage --timeout 200 --color -R specy", + "unit:templates-without-ts-esm": "tap \"templates/app/**/*.test.js\" \"templates/app-esm/**/*.test.js\" \"templates/app-ts/**/*.test.ts\" --no-coverage --timeout 400 --color -R specy", "pretest": "xcopy /e /k /i . \"..\\node_modules\\fastify-cli\" || rsync -r --exclude=node_modules ./ node_modules/fastify-cli || echo 'this is fine'", "test-no-coverage": "npm run unit:cli && npm run unit:templates-without-ts-esm && npm run unit:template-ts-esm && npm run test:typescript", "test": "c8 --clean npm run test-no-coverage", diff --git a/test/start.test.js b/test/start.test.js index 4cabb039..ed29fbc1 100644 --- a/test/start.test.js +++ b/test/start.test.js @@ -556,7 +556,7 @@ test('should start the server listening on 0.0.0.0 when running in kubernetes', t.pass('server closed') }) -test('should start the server with watch options that the child process restart when directory changed', { skip: process.platform === 'win32' }, async (t) => { +test('should start the server with watch options that the child process restart when directory changed', { skip: process.platform === 'win32' || (process.platform === 'darwin' && ['v20', 'v19', 'v18'].some(v => process.version.startsWith(v))) }, async (t) => { t.plan(3) const tmpjs = path.resolve(baseFilename + '.js') @@ -584,7 +584,7 @@ test('should start the server with watch options that the child process restart t.pass('should receive restart event') }) -test('should start the server with watch and verbose-watch options that the child process restart when directory changed with console message about changes ', { skip: process.platform === 'win32' }, async (t) => { +test('should start the server with watch and verbose-watch options that the child process restart when directory changed with console message about changes ', { skip: process.platform === 'win32' || (process.platform === 'darwin' && ['v20', 'v19', 'v18'].some(v => process.version.startsWith(v))) }, async (t) => { t.plan(4) const spy = sinon.spy() From 7640523c1b82b2480fd07bbfba46b62d65939621 Mon Sep 17 00:00:00 2001 From: Bret Comnes Date: Fri, 14 Jul 2023 15:43:32 -0700 Subject: [PATCH 4/4] No test concurrency --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index b951c097..c38966e1 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,9 @@ "scripts": { "lint": "standard", "lint:fix": "standard --fix", - "unit:template-ts-esm": " cross-env TS_NODE_PROJECT=./templates/app-ts-esm/tsconfig.json tap templates/app-ts-esm/test/**/*.test.ts --no-coverage --node-arg=--loader=ts-node/esm --timeout 400 --color -R specy", - "unit:cli": "tap \"test/**/*.test.{js,ts}\" --no-coverage --jobs=1 --timeout 400 --color -R specy", - "unit:templates-without-ts-esm": "tap \"templates/app/**/*.test.js\" \"templates/app-esm/**/*.test.js\" \"templates/app-ts/**/*.test.ts\" --no-coverage --timeout 400 --color -R specy", + "unit:template-ts-esm": " cross-env TS_NODE_PROJECT=./templates/app-ts-esm/tsconfig.json tap templates/app-ts-esm/test/**/*.test.ts --no-coverage --node-arg=--loader=ts-node/esm --timeout 400 --jobs 1 --color -R specy", + "unit:cli": "tap \"test/**/*.test.{js,ts}\" --no-coverage --jobs=1 --timeout 400 --jobs 1 --color -R specy", + "unit:templates-without-ts-esm": "tap \"templates/app/**/*.test.js\" \"templates/app-esm/**/*.test.js\" \"templates/app-ts/**/*.test.ts\" --no-coverage --timeout 400 --jobs 1 --color -R specy", "pretest": "xcopy /e /k /i . \"..\\node_modules\\fastify-cli\" || rsync -r --exclude=node_modules ./ node_modules/fastify-cli || echo 'this is fine'", "test-no-coverage": "npm run unit:cli && npm run unit:templates-without-ts-esm && npm run unit:template-ts-esm && npm run test:typescript", "test": "c8 --clean npm run test-no-coverage",