mirror of
https://github.com/withastro/astro.git
synced 2024-12-30 22:03:56 -05:00
[ci] format
This commit is contained in:
parent
48ca399788
commit
86abfa5c81
2 changed files with 26 additions and 24 deletions
|
@ -119,36 +119,36 @@ export function readFromClipboard() {
|
|||
let args: Array<string> = [];
|
||||
|
||||
if (system === 'darwin') {
|
||||
command = 'pbpaste';
|
||||
command = 'pbpaste';
|
||||
} else if (system === 'win32') {
|
||||
command = 'powershell';
|
||||
args = ['-command', 'Get-Clipboard'];
|
||||
command = 'powershell';
|
||||
args = ['-command', 'Get-Clipboard'];
|
||||
} else {
|
||||
const unixCommands: Array<[string, Array<string>]> = [
|
||||
['xclip', ['-sel', 'clipboard', '-o']],
|
||||
['wl-paste', []],
|
||||
];
|
||||
for (const [unixCommand, unixArgs] of unixCommands) {
|
||||
try {
|
||||
const output = spawnSync('which', [unixCommand], { encoding: 'utf8' });
|
||||
if (output.stdout.trim()) {
|
||||
command = unixCommand;
|
||||
args = unixArgs;
|
||||
break;
|
||||
}
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
const unixCommands: Array<[string, Array<string>]> = [
|
||||
['xclip', ['-sel', 'clipboard', '-o']],
|
||||
['wl-paste', []],
|
||||
];
|
||||
for (const [unixCommand, unixArgs] of unixCommands) {
|
||||
try {
|
||||
const output = spawnSync('which', [unixCommand], { encoding: 'utf8' });
|
||||
if (output.stdout.trim()) {
|
||||
command = unixCommand;
|
||||
args = unixArgs;
|
||||
break;
|
||||
}
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!command) {
|
||||
throw new Error('Clipboard read command not found!');
|
||||
throw new Error('Clipboard read command not found!');
|
||||
}
|
||||
|
||||
const result = spawnSync(command, args, { encoding: 'utf8' });
|
||||
if (result.error) {
|
||||
throw result.error;
|
||||
throw result.error;
|
||||
}
|
||||
return result.stdout.trim();
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@ import assert from 'node:assert/strict';
|
|||
import { promises as fs, readFileSync } from 'node:fs';
|
||||
import { isIPv4 } from 'node:net';
|
||||
import { join } from 'node:path';
|
||||
import { platform } from 'node:process';
|
||||
import { Writable } from 'node:stream';
|
||||
import { describe, it } from 'node:test';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { stripVTControlCharacters } from 'node:util';
|
||||
import { cli, cliServerLogSetup, loadFixture, parseCliDevStart } from './test-utils.js';
|
||||
import { readFromClipboard } from '../dist/cli/info/index.js';
|
||||
import { platform } from 'node:process';
|
||||
import { cli, cliServerLogSetup, loadFixture, parseCliDevStart } from './test-utils.js';
|
||||
|
||||
describe('astro cli', () => {
|
||||
const cliServerLogSetupWithFixture = (flags, cmd) => {
|
||||
|
@ -88,14 +88,16 @@ describe('astro cli', () => {
|
|||
assert.equal(proc.exitCode, 0);
|
||||
|
||||
// On Linux we only check if we have Wayland or x11. In Codespaces it falsely reports that it does have x11
|
||||
if(platform === 'linux' && ((!process.env.WAYLAND_DISPLAY && !process.env.DISPLAY) || process.env.CODESPACES)) {
|
||||
if (
|
||||
platform === 'linux' &&
|
||||
((!process.env.WAYLAND_DISPLAY && !process.env.DISPLAY) || process.env.CODESPACES)
|
||||
) {
|
||||
assert.ok(proc.stdout.includes('Please manually copy the text above'));
|
||||
} else {
|
||||
assert.ok(proc.stdout.includes('Copied to clipboard!'));
|
||||
const clipboardContent = await readFromClipboard();
|
||||
assert.ok(clipboardContent.includes(`v${pkgVersion}`));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
it(
|
||||
|
|
Loading…
Reference in a new issue