1
0
Fork 0

Fix lint errors

pull/1/head
Ambrose Chua 2021-09-30 11:56:57 +08:00
parent 4b14fe7d8a
commit a808724383
8 changed files with 14 additions and 31 deletions

View File

@ -9,7 +9,7 @@ const tests = {
signal: ctrl.signal,
});
const o = await response.json();
return `Cookie: ${o.headers['Cookie']}`;
return `Cookie: ${o.headers.Cookie}`;
} catch (error) {
return error.toString();
}
@ -23,7 +23,7 @@ const tests = {
signal: ctrl.signal,
});
const o = await response.json();
return `Referer: ${o.headers['Referer']}`;
return `Referer: ${o.headers.Referer}`;
} catch (error) {
return error.toString();
}
@ -51,7 +51,7 @@ const tests = {
signal: ctrl.signal,
});
const o = await response.json();
return `Date: ${o.headers['Date']}`;
return `Date: ${o.headers.Date}`;
} catch (error) {
return error.toString();
}
@ -65,7 +65,7 @@ const tests = {
signal: ctrl.signal,
});
const o = await response.json();
return `Host: ${o.headers['Host']}`;
return `Host: ${o.headers.Host}`;
} catch (error) {
return error.toString();
}

View File

@ -46,6 +46,7 @@
"unicorn/prefer-node-protocol": "off"
},
"globals": [
"Deno",
"Request",
"Response",
"Headers",

View File

@ -42,19 +42,5 @@ export const firefox: BrowserDriver = {
};
export const safari: BrowserDriver = {
path: '/usr/bin/safaridriver',
args: (port: number, logLevel = 'warn') => {
const logLevelArg = {
trace: 'trace',
debug: 'debug',
info: 'info',
warn: 'warn',
error: 'error',
silent: 'fatal',
}[logLevel];
if (!logLevelArg) {
throw new Error('invalid log level');
}
return ['-p', `${port}`, '-l', `${logLevelArg}`];
},
args: (port: number, _logLevel = 'none') => ['-p', `${port}`],
};

View File

@ -1,3 +1,4 @@
import process from 'process';
import path from 'path';
import logger from '@wdio/logger';
import Table from 'cli-table3';

View File

@ -6,7 +6,7 @@ import getPort from 'get-port';
import tcpPortUsed from 'tcp-port-used';
import WebDriver from 'webdriver';
import {Platform, Result, BrowserDriver, Context} from './types.js';
import {Platform, Context, Result, BrowserDriver} from './types.js';
async function start(
driver: BrowserDriver,

View File

@ -1,13 +1,10 @@
import {platform} from 'os';
import {spawn} from 'child_process';
import logger from '@wdio/logger';
import {Platform, Result} from './types.js';
const log = logger('fetch-compare');
import {Platform, Context, Result} from './types.js';
export default class PlatformDeno implements Platform {
async run(ctx: Record<string, any>, file: string): Promise<Result> {
async run(ctx: Context, file: string): Promise<Result> {
const child = spawn(
platform() === 'win32' ? 'deno.exe' : 'deno',
['run', '--allow-read', '--allow-net=httpbin.org', 'index-deno.js', file],
@ -23,11 +20,12 @@ export default class PlatformDeno implements Platform {
if (code !== 0) {
reject(code);
}
resolve(stdout);
});
});
child.kill();
return JSON.parse(stdout);
return JSON.parse(stdout) as Result;
}
}

View File

@ -1,11 +1,10 @@
import process from 'process';
import {fork} from 'child_process';
import path from 'path';
import {Platform, Result} from './types.js';
import {Platform, Context, Result} from './types.js';
export default class PlatformNode implements Platform {
async run(ctx: Record<string, any>, file: string): Promise<Result> {
async run(ctx: Context, file: string): Promise<Result> {
const child = fork(path.join(ctx.fixturesPath, 'index-node.js'), [file], {
cwd: ctx.fixturesPath,
});

View File

@ -1,6 +1,4 @@
import process from 'process';
import net from 'net';
import path from 'path';
import Koa from 'koa';
import files from 'koa-files';