forked from wangziqi/ruoyi-vue-pro
16 lines
683 B
JavaScript
16 lines
683 B
JavaScript
#!/usr/bin/env node
|
|
'use strict';
|
|
|
|
const { spawnSync } = require('child_process');
|
|
const path = require('path');
|
|
|
|
const cwd = __dirname;
|
|
const result = spawnSync(process.execPath, ['-e', "try { require.resolve('@playwright/test'); require.resolve('playwright'); } catch (_) { process.exit(2); }"], { cwd, stdio: 'inherit' });
|
|
if (result.status === 2) {
|
|
process.stdout.write('Playwright unavailable; dependency-free smoke/contract checks remain available.\n');
|
|
process.exit(0);
|
|
}
|
|
const command = process.platform === 'win32' ? 'npx.cmd' : 'npx';
|
|
const run = spawnSync(command, ['playwright', 'test'], { cwd, stdio: 'inherit' });
|
|
process.exit(run.status == null ? 1 : run.status);
|