lastcall-nightcrawler
Advanced tools
Comparing version 2.0.0-beta1 to 2.0.0-beta2
@@ -48,5 +48,5 @@ "use strict"; | ||
concurrency: massageConcurrency(argv.concurrency, 5), | ||
context: (0, _util.loadContext)(argv.config, cwd) | ||
context: await (0, _util.loadContext)(argv.config, cwd) | ||
}, stdout); | ||
} | ||
} |
@@ -6,2 +6,2 @@ import TestContext, { TestResult, TestResultMap } from '../testing/TestContext'; | ||
export declare function hasFailure(result: TestResultMap): boolean; | ||
export declare function loadContext(configFile: string, cwd: string): TestContext; | ||
export declare function loadContext(configFile: string, cwd: string): Promise<TestContext>; |
@@ -22,16 +22,16 @@ "use strict"; | ||
function loadContext(configFile, cwd) { | ||
let context; | ||
async function loadContext(configFile, cwd) { | ||
let resolved; | ||
try { | ||
const resolved = require.resolve(configFile, { | ||
resolved = require.resolve(configFile, { | ||
paths: [cwd] | ||
}); // eslint-disable-next-line @typescript-eslint/no-var-requires | ||
context = require(resolved); | ||
}); | ||
} catch (e) { | ||
throw new Error(`Unable to find configuration file at ${configFile}.`); | ||
} | ||
} // eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const context = await require(resolved); | ||
if (context instanceof _TestContext.default) { | ||
@@ -38,0 +38,0 @@ return context; |
/// <reference types="jest" /> | ||
declare const _default: jest.Mock<any, any>; | ||
export default _default; | ||
declare const MockedContext: jest.Mock<any, any>; | ||
export default MockedContext; |
import TestContext from './TestContext'; | ||
import Crawler from '../Crawler'; | ||
declare const crawl: (description: string, cb: () => Iterable<import("../types").CrawlerRequest> | AsyncIterable<import("../types").CrawlerRequest> | Crawler) => TestContext; | ||
import { RequestIterable } from '../types'; | ||
declare type CrawlCB = () => RequestIterable | Crawler | Promise<RequestIterable> | Promise<Crawler>; | ||
declare const crawl: (description: string, cb: CrawlCB) => Promise<TestContext>; | ||
declare const test: (description: string, cb: (unit: import("../types").CrawlerUnit) => void) => TestContext; | ||
declare const after: (description: string, cb: () => void) => TestContext; | ||
export { crawl, test, after }; |
@@ -16,3 +16,3 @@ "use strict"; | ||
const crawl = function (description, cb) { | ||
const crawl = async function (description, cb) { | ||
const context = new _TestContext.default(description); | ||
@@ -23,3 +23,3 @@ activeContext = context; | ||
try { | ||
result = cb(); | ||
result = await cb(); | ||
@@ -42,3 +42,3 @@ if (!result) { | ||
if (activeContext === null) { | ||
throw new Error(`You may not call ${name} outside of a crawler function.`); | ||
throw new Error(`You may not call "${name}()" outside of a crawler function.`); | ||
} | ||
@@ -45,0 +45,0 @@ |
{ | ||
"name": "lastcall-nightcrawler", | ||
"version": "2.0.0-beta1", | ||
"version": "2.0.0-beta2", | ||
"main": "dist/index.js", | ||
@@ -49,3 +49,3 @@ "license": "MIT", | ||
"build": "babel src/ --out-dir=dist --extensions '.ts' --ignore 'src/**/__tests__/**' --ignore 'src/**/__mocks__/**' --ignore 'src/**/__stubs__/**' && tsc --emitDeclarationOnly", | ||
"lint": "eslint ./src/ --ext .js,.jsx,.ts,.tsx" | ||
"lint": "eslint ./src/ --ext .ts" | ||
}, | ||
@@ -52,0 +52,0 @@ "files": [ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
37420
43
857
2