fix: e2e with build
This commit is contained in:
parent
3c87755e6c
commit
fd4809d8ad
@ -13,7 +13,7 @@ VERDACCIO_PORT=10104
|
||||
APP_ENV=development
|
||||
APP_PORT=20000
|
||||
APP_KEY=test-key-e2e
|
||||
SOCKET_PATH=storage/gateway-e2e.sock
|
||||
SOCKET_PATH=storage/e2e/gateway.sock
|
||||
__E2E__=true
|
||||
|
||||
# 启用 mock-collections 插件
|
||||
@ -26,18 +26,18 @@ PROXY_TARGET_URL=
|
||||
|
||||
LOGGER_TRANSPORT=
|
||||
LOGGER_LEVEL=
|
||||
LOGGER_BASE_PATH=storage/logs-e2e
|
||||
LOGGER_BASE_PATH=storage/e2e/logs
|
||||
|
||||
################# DATABASE #################
|
||||
|
||||
DB_DIALECT=sqlite
|
||||
DB_STORAGE=storage/db/nocobase-e2e.sqlite
|
||||
DB_DIALECT=postgres
|
||||
DB_STORAGE=storage/e2e/db/nocobase.sqlite
|
||||
DB_TABLE_PREFIX=
|
||||
# DB_HOST=localhost
|
||||
# DB_PORT=5432
|
||||
# DB_DATABASE=nocobase-e2e
|
||||
# DB_USER=nocobase
|
||||
# DB_PASSWORD=nocobase
|
||||
DB_HOST=localhost
|
||||
DB_PORT=5432
|
||||
DB_DATABASE=nocobase-e2e
|
||||
DB_USER=nocobase
|
||||
DB_PASSWORD=nocobase
|
||||
# DB_LOGGING=on
|
||||
# DB_UNDERSCORED=false
|
||||
|
||||
|
@ -149,7 +149,13 @@ module.exports = (cli) => {
|
||||
.allowUnknownOption()
|
||||
.option('--url [url]')
|
||||
.option('--skip-reporter')
|
||||
.option('--build')
|
||||
.action(async (options) => {
|
||||
process.env.__E2E__ = true;
|
||||
if (options.build) {
|
||||
process.env.APP_ENV = 'production';
|
||||
await run('yarn', ['build']);
|
||||
}
|
||||
if (options.skipReporter) {
|
||||
process.env.PLAYWRIGHT_SKIP_REPORTER = true;
|
||||
}
|
||||
@ -184,8 +190,13 @@ module.exports = (cli) => {
|
||||
e2e
|
||||
.command('start-app')
|
||||
.option('--production')
|
||||
.option('--build')
|
||||
.option('--port [port]')
|
||||
.action(async (options) => {
|
||||
process.env.__E2E__ = true;
|
||||
if (options.build) {
|
||||
await run('yarn', ['build']);
|
||||
}
|
||||
if (options.production) {
|
||||
process.env.APP_ENV = 'production';
|
||||
}
|
||||
@ -206,8 +217,14 @@ module.exports = (cli) => {
|
||||
e2e
|
||||
.command('p-test')
|
||||
.option('--stop-on-error')
|
||||
.option('--build')
|
||||
.option('--concurrency [concurrency]', '', os.cpus().length)
|
||||
.action(async (opts) => {
|
||||
await pTest(opts);
|
||||
.action(async (options) => {
|
||||
process.env.__E2E__ = true;
|
||||
if (options.build) {
|
||||
process.env.APP_ENV = 'production';
|
||||
await run('yarn', ['build']);
|
||||
}
|
||||
await pTest(options);
|
||||
});
|
||||
};
|
||||
|
@ -47,14 +47,20 @@ async function runApp(dir, index = 0) {
|
||||
APP_ENV: 'production',
|
||||
APP_PORT: 20000 + index,
|
||||
DB_DATABASE: `nocobase${index}`,
|
||||
SOCKET_PATH: `storage/gateway-e2e-${index}.sock`,
|
||||
PM2_HOME: resolve(process.cwd(), `storage/.pm2-${index}`),
|
||||
SOCKET_PATH: `storage/e2e/gateway-e2e-${index}.sock`,
|
||||
PM2_HOME: resolve(process.cwd(), `storage/e2e/.pm2-${index}`),
|
||||
PLAYWRIGHT_AUTH_FILE: resolve(process.cwd(), `storage/playwright/.auth/admin-${index}.json`),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
exports.pTest = async (options) => {
|
||||
const dir = resolve(process.cwd(), 'storage/e2e');
|
||||
|
||||
if (!fs.existsSync(dir)) {
|
||||
fs.mkdirSync(dir, { recursive: true });
|
||||
}
|
||||
|
||||
const files = glob.sync('packages/**/__e2e__/**/*.test.ts', {
|
||||
root: process.cwd(),
|
||||
});
|
||||
|
@ -1,5 +1,6 @@
|
||||
import net from 'net';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { AppSupervisor } from '../app-supervisor';
|
||||
import { writeJSON } from './ipc-socket-client';
|
||||
import { randomUUID } from 'crypto';
|
||||
@ -17,6 +18,12 @@ export class IPCSocketServer {
|
||||
fs.unlinkSync(socketPath);
|
||||
}
|
||||
|
||||
const dir = path.dirname(socketPath);
|
||||
|
||||
if (!fs.existsSync(dir)) {
|
||||
fs.mkdirSync(dir, { recursive: true });
|
||||
}
|
||||
|
||||
const socketServer = net.createServer((c) => {
|
||||
console.log('client connected');
|
||||
|
||||
|
1
storage/.gitignore
vendored
1
storage/.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
.pm2
|
||||
tmp
|
||||
app.watch.ts
|
||||
/e2e
|
Loading…
Reference in New Issue
Block a user