From d20acec38a72360715bcd24c6cd10aea6983c3d9 Mon Sep 17 00:00:00 2001 From: Aman Kumar Date: Fri, 21 Feb 2025 16:09:24 +0530 Subject: [PATCH 1/2] fix: warning failed to create bin due to missing source file --- bin/dev | 17 ----------------- bin/dev.js | 6 ++++++ bin/run | 5 ----- bin/run.js | 7 +++++++ 4 files changed, 13 insertions(+), 22 deletions(-) delete mode 100755 bin/dev create mode 100755 bin/dev.js delete mode 100755 bin/run create mode 100755 bin/run.js diff --git a/bin/dev b/bin/dev deleted file mode 100755 index c29a7dc..00000000 --- a/bin/dev +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env node -require("dotenv").config(); -const oclif = require('@oclif/core') - -const path = require('path') -const project = path.join(__dirname, '..', 'tsconfig.json') - -// In dev mode -> use ts-node and dev plugins -process.env.NODE_ENV = 'development' - -require("ts-node").register({ project }); - -// In dev mode, always show stack traces -oclif.settings.debug = true; - -// Start the CLI -oclif.run().then(oclif.flush).catch(oclif.Errors.handle) diff --git a/bin/dev.js b/bin/dev.js new file mode 100755 index 00000000..5cd9701 --- /dev/null +++ b/bin/dev.js @@ -0,0 +1,6 @@ +#!/usr/bin/env node_modules/.bin/ts-node +// eslint-disable-next-line node/shebang, unicorn/prefer-top-level-await +(async () => { + const oclif = await import('@oclif/core'); + await oclif.execute({ development: true, dir: __dirname }); +})(); \ No newline at end of file diff --git a/bin/run b/bin/run deleted file mode 100755 index a7635de..00000000 --- a/bin/run +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env node - -const oclif = require('@oclif/core') - -oclif.run().then(require('@oclif/core/flush')).catch(require('@oclif/core/handle')) diff --git a/bin/run.js b/bin/run.js new file mode 100755 index 00000000..1024bac --- /dev/null +++ b/bin/run.js @@ -0,0 +1,7 @@ +#!/usr/bin/env node + +// eslint-disable-next-line unicorn/prefer-top-level-await +(async () => { + const oclif = await import('@oclif/core'); + await oclif.execute({ development: false, dir: __dirname }); +})(); \ No newline at end of file From 3f19802c7ab32a1509beff8450cff50be713cdfb Mon Sep 17 00:00:00 2001 From: Aman Kumar Date: Tue, 25 Feb 2025 12:22:06 +0530 Subject: [PATCH 2/2] fix: github & file-upload test cases --- test/unit/adapters/file-upload.test.ts | 3 ++- test/unit/adapters/github.test.ts | 2 ++ test/unit/util/log.test.ts | 10 ++++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/test/unit/adapters/file-upload.test.ts b/test/unit/adapters/file-upload.test.ts index 7eeb7f9..6b1aea8 100644 --- a/test/unit/adapters/file-upload.test.ts +++ b/test/unit/adapters/file-upload.test.ts @@ -152,7 +152,8 @@ describe('File Upload', () => { { name: 'NextJs', value: 'NEXTJS' }, { name: 'Other', value: 'OTHER' }, ], - outputDirectories:"" + outputDirectories:"", + supportedFrameworksForServerCommands: ['ANGULAR', 'OTHER', 'REMIX'] }, }; let archiveMockData = { zipName: 'abc.zip', zipPath: 'path/to/zip', projectName: 'test' }; diff --git a/test/unit/adapters/github.test.ts b/test/unit/adapters/github.test.ts index 2dd8296..b2fa6f0 100644 --- a/test/unit/adapters/github.test.ts +++ b/test/unit/adapters/github.test.ts @@ -163,6 +163,8 @@ describe('GitHub', () => { { name: 'Other', value: 'OTHER' }, ], repository: { fullName: 'Gatsby Starter' }, + outputDirectories:"", + supportedFrameworksForServerCommands: ['ANGULAR', 'OTHER', 'REMIX'] }, }; beforeEach(function () { diff --git a/test/unit/util/log.test.ts b/test/unit/util/log.test.ts index c9d0c17..015cdcc 100644 --- a/test/unit/util/log.test.ts +++ b/test/unit/util/log.test.ts @@ -12,12 +12,18 @@ describe('Log Util', () => { }; beforeEach(() => { createLoggerStub = stub(winston, 'createLogger'); - processExitStub = stub(process, 'exit'); + if (!process.exit.restore) { + processExitStub = stub(process, 'exit'); + } else { + processExitStub = process.exit; + } }); afterEach(() => { createLoggerStub.restore(); - processExitStub.restore(); + if (processExitStub.restore) { + processExitStub.restore(); + } }); it('should create a logger with file and console transports when project base path exists', () => {