github/workflows,scripts/cli-e2e-test: use runner temp dir instead of generated dir
This commit is contained in:
+10
-5
@@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const os = require('os');
|
||||
const fs = require('fs-extra');
|
||||
const { resolve: resolvePath } = require('path');
|
||||
const Browser = require('zombie');
|
||||
|
||||
@@ -27,22 +29,25 @@ const {
|
||||
|
||||
const createTestApp = require('./createTestApp');
|
||||
const createTestPlugin = require('./createTestPlugin');
|
||||
const generateTempDir = require('./generateTempDir.js');
|
||||
|
||||
Browser.localhost('localhost', 3000);
|
||||
|
||||
async function createTempDir() {
|
||||
return fs.mkdtemp(resolvePath(os.tmpdir(), 'backstage-e2e-'));
|
||||
}
|
||||
|
||||
async function main() {
|
||||
process.env.BACKSTAGE_E2E_CLI_TEST = 'true';
|
||||
|
||||
const tempDir = process.env.CI ? process.cwd() : await generateTempDir();
|
||||
const workDir = process.env.CI ? process.cwd() : await createTempDir();
|
||||
|
||||
process.stdout.write(`Initial directory: ${process.cwd()}\n`);
|
||||
process.chdir(tempDir);
|
||||
process.stdout.write(`Temp directory: ${process.cwd()}\n`);
|
||||
process.chdir(workDir);
|
||||
process.stdout.write(`Working directory: ${process.cwd()}\n`);
|
||||
|
||||
await createTestApp();
|
||||
|
||||
const appDir = resolvePath(tempDir, 'test-app');
|
||||
const appDir = resolvePath(workDir, 'test-app');
|
||||
process.chdir(appDir);
|
||||
process.stdout.write(`App directory: ${appDir}\n`);
|
||||
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright 2020 Spotify AB
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const fs = require('fs-extra');
|
||||
const os = require('os');
|
||||
const { resolve: resolvePath } = require('path');
|
||||
const { handleError } = require('./helpers');
|
||||
|
||||
async function generateTempDir() {
|
||||
const tempDir = await fs.mkdtemp(resolvePath(os.tmpdir(), 'backstage-e2e-'));
|
||||
process.stdout.write(tempDir);
|
||||
return tempDir;
|
||||
}
|
||||
|
||||
module.exports = generateTempDir;
|
||||
|
||||
process.on('unhandledRejection', handleError);
|
||||
generateTempDir().catch(handleError);
|
||||
Reference in New Issue
Block a user