From 4c38de2c8bd4ce38c91270048f05d510cec890b0 Mon Sep 17 00:00:00 2001 From: Shazron Abdullah <36107+shazron@users.noreply.github.com> Date: Thu, 8 Feb 2024 22:05:00 +0800 Subject: [PATCH] fix: add/run tests for the latest version of the aio-cli --- test/cli-next.test.js | 2 +- test/index.test.js | 28 ++++++++++++++++++++++++++++ test/install.test.js | 4 ++-- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/test/cli-next.test.js b/test/cli-next.test.js index ba2183a..eda6408 100644 --- a/test/cli-next.test.js +++ b/test/cli-next.test.js @@ -29,7 +29,7 @@ function shell(cmd, dir) { } // skip for now until the new way of testing the next aio-cli version is ready -it.skip("should install (next) version of aio-cli and run developer experience", async function() { +it("should install (next) version of aio-cli and run developer experience", async function() { shell(` npm install --no-save @adobe/aio-cli-next diff --git a/test/index.test.js b/test/index.test.js index 817f9b9..4691612 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -88,4 +88,32 @@ describe("integration tests", function() { aio asset-compute test-worker `); }).timeout(600000); + + it("should install latest version of tools and run developer experience", async function() { + shell(` + npm install -g @adobe/aio-cli@latest + aio info + `); + + cd("project"); + + shell(`aio app:init --no-login -i ../../test/console.json -t @adobe/generator-app-asset-compute@1.0.2`); + shell('ls'); + assert(fs.existsSync(path.join("src", "dx-asset-compute-worker-1", "actions", "worker", "index.js"))); + + const testLogsFile = path.join("build", "test-results", "test-worker", "test.log"); + assert.ok(!fs.existsSync(testLogsFile)); + shell(` + aio app test + `); + assert.ok(fs.existsSync(testLogsFile)); + const testLogs = fs.readFileSync(testLogsFile); + assert.ok(testLogs.includes('Validation successful')); + + // test as aio plugin + shell(` + aio plugins:install @adobe/aio-cli-plugin-asset-compute + aio asset-compute test-worker + `); + }).timeout(600000); }); diff --git a/test/install.test.js b/test/install.test.js index 521c273..e19179c 100644 --- a/test/install.test.js +++ b/test/install.test.js @@ -28,9 +28,9 @@ function shell(cmd, dir) { execSync(cmd, {cwd: dir, stdio: 'inherit'}); } -it.skip("should install (local) version of aio-cli and run developer experience", async function() { +it("should install (local) version of aio-cli and run developer experience", async function() { shell(` - npm install --no-save @adobe/aio-cli + npm install --no-save @adobe/aio-cli@latest npx aio info mkdir project cd project