diff --git a/packages/cli/src/bin/cli.test.ts b/packages/cli/src/bin/cli.test.ts index ec0d24c9..3c722ee3 100644 --- a/packages/cli/src/bin/cli.test.ts +++ b/packages/cli/src/bin/cli.test.ts @@ -5,6 +5,7 @@ import http from 'http'; import net from 'net'; import path from 'path'; import fs from 'fs'; +import execa from 'execa'; import { version } from '../../package.json'; import runCLI from '../testutils/'; @@ -146,9 +147,10 @@ describe('cli', () => { try { await runCLI(`file://${SIMPLE_HTML_FILE}`, '--exit'); } catch (error) { - assert.equal(error.exitCode, 1); + const err = error as execa.ExecaReturnBase; + assert.equal(err.exitCode, 1); assert.include( - error.stdout, + err.stdout, 'Violation of "marquee" with 1 occurrences!' ); } @@ -158,9 +160,10 @@ describe('cli', () => { try { await runCLI(`file://${SIMPLE_CLEAN_HTML_FILE}`, '--exit'); } catch (error) { - assert.equal(error.exitCode, 0); + const err = error as execa.ExecaReturnBase; + assert.equal(err.exitCode, 0); assert.include( - error.stdout, + err.stdout, 'Violation of "marquee" with 1 occurrences!' ); } @@ -382,9 +385,10 @@ describe('cli', () => { try { await runCLI(`file://${SIMPLE_HTML_FILE}`, '--timeout', '0'); } catch (error) { - assert.notEqual(error.exitCode, 0); + const err = error as execa.ExecaReturnBase; + assert.notEqual(err.exitCode, 0); assert.include( - error.stderr, + err.stderr, 'An error occurred while testing this page.' ); } diff --git a/packages/cli/src/lib/axe-test-urls.ts b/packages/cli/src/lib/axe-test-urls.ts index 94838187..ff423f30 100644 --- a/packages/cli/src/lib/axe-test-urls.ts +++ b/packages/cli/src/lib/axe-test-urls.ts @@ -67,7 +67,7 @@ const testPages = async ( events?.startTimer('axe-core execution time'); } - axe.analyze((err: Error | null, results: AxeResults) => { + axe.analyze((err, results) => { if (config.timer) { events?.endTimer('axe-core execution time'); } @@ -83,7 +83,7 @@ const testPages = async ( } // Move to the next item - testPages(urls.slice(1), config, events).then((out: AxeResults) => { + testPages(urls.slice(1), config, events).then(out => { resolve([results].concat(out)); }); }); diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json index 67909205..e7ced076 100644 --- a/packages/cli/tsconfig.json +++ b/packages/cli/tsconfig.json @@ -1,19 +1,11 @@ { + "extends": "../../tsconfig.json", "compilerOptions": { - "types": ["node"], - "outDir": "./dist/", - "sourceMap": true, - "noImplicitAny": true, - "strictNullChecks": true, - "moduleResolution": "node", - "resolveJsonModule": true, + "lib": ["dom", "ES2015", "esnext.asynciterable"], "module": "commonjs", + "outDir": "./dist/", "target": "ES2015", - "allowJs": true, - "lib": ["dom", "ES2015", "esnext.asynciterable"], - "esModuleInterop": true, - "skipLibCheck": true, - "declaration": true + "types": ["node"] }, "include": ["./src/lib", "./src/bin"] } diff --git a/packages/playwright/src/index.ts b/packages/playwright/src/index.ts index 3b653ed8..53cf8e01 100644 --- a/packages/playwright/src/index.ts +++ b/packages/playwright/src/index.ts @@ -310,6 +310,7 @@ export default class AxeBuilder { if (result.length > sizeLimit) { return await chunkResults(result.substr(sizeLimit)); } + return; } await chunkResults(partialString); diff --git a/packages/puppeteer/src/axePuppeteer.ts b/packages/puppeteer/src/axePuppeteer.ts index ff02e06c..4eb2a196 100644 --- a/packages/puppeteer/src/axePuppeteer.ts +++ b/packages/puppeteer/src/axePuppeteer.ts @@ -294,6 +294,7 @@ export class AxePuppeteer { if (result.length > sizeLimit) { return await chunkResults(result.substr(sizeLimit)); } + return; } await chunkResults(partialString); diff --git a/packages/puppeteer/tsconfig.json b/packages/puppeteer/tsconfig.json index 43fc2c19..971582be 100644 --- a/packages/puppeteer/tsconfig.json +++ b/packages/puppeteer/tsconfig.json @@ -1,24 +1,7 @@ { + "extends": "../../tsconfig.json", "compilerOptions": { - /* Basic Options */ - "target": "esnext", - "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, - "lib": [ - "dom", - "esnext" - ] /* Specify library files to be included in the compilation. */, - "declaration": true /* Generates corresponding '.d.ts' file. */, - "sourceMap": true /* Generates corresponding '.map' file. */, - "outDir": "dist" /* Redirect output structure to the directory. */, - "rootDir": "src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */, - "removeComments": true /* Do not emit comments to output. */, - "pretty": true, - "strict": true, - "noImplicitAny": true, - "noImplicitThis": true, - "noImplicitReturns": true, - "moduleResolution": "node", - "esModuleInterop": true + "module": "commonjs" }, "include": ["src"] } diff --git a/packages/webdriverio/src/utils.ts b/packages/webdriverio/src/utils.ts index a47f2bae..a9e37df7 100644 --- a/packages/webdriverio/src/utils.ts +++ b/packages/webdriverio/src/utils.ts @@ -217,6 +217,7 @@ export const axeFinishRun = ( if (result.length > sizeLimit) { return chunkResults(result.substr(sizeLimit)); } + return; }); } diff --git a/packages/webdriverjs/src/browser.ts b/packages/webdriverjs/src/browser.ts index 71f57590..8c9c50f0 100644 --- a/packages/webdriverjs/src/browser.ts +++ b/packages/webdriverjs/src/browser.ts @@ -79,6 +79,7 @@ export function axeFinishRun( if (result.length > sizeLimit) { return chunkResults(result.substr(sizeLimit)); } + return; }); } diff --git a/packages/webdriverjs/src/types.ts b/packages/webdriverjs/src/types.ts index 9abfc8e0..ba286c0e 100644 --- a/packages/webdriverjs/src/types.ts +++ b/packages/webdriverjs/src/types.ts @@ -18,8 +18,7 @@ export interface AxeInjectorParams extends Options { } export type CallbackFunction = ( - error: Error | null, - results: AxeResults | null + ...args: [Error, null] | [null, AxeResults] ) => void; export type InjectCallback = (err?: Error) => void; diff --git a/tsconfig.json b/tsconfig.json index a076ed9f..96cc6522 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,21 +1,30 @@ { "compilerOptions": { - "moduleResolution": "node", - "target": "esnext", - "module": "esnext", + "allowJs": true, + "declaration": true, + "esModuleInterop": true, "lib": ["dom", "esnext"], - "strict": true, + "module": "esnext", + "moduleResolution": "node", + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "outDir": "dist", "pretty": true, + "removeComments": true, + "resolveJsonModule": true, + "skipLibCheck": true, "sourceMap": true, - "declaration": true, - "outDir": "dist", - "esModuleInterop": true, - "resolveJsonModule": true + "strict": true, + "strictNullChecks": true, + "target": "esnext" }, + "exclude": ["**/*.test.ts", "**/test/**/*.ts"], "ts-node": { "compilerOptions": { "module": "commonjs", - "target": "es5" + "target": "es5", + "removeComments": false } } }