Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@haibun/core

Package Overview
Dependencies
Maintainers
1
Versions
154
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@haibun/core - npm Package Compare versions

Comparing version 1.0.8 to 1.1.0

build/lib/test/lib.d.ts

40

build/lib/features.test.js

@@ -23,7 +23,7 @@ "use strict";

const steps = __importStar(require("./features"));
const TestSteps_1 = require("./TestSteps");
const lib_1 = require("./test/lib");
const util_1 = require("./util");
describe('expandBackgrounds', () => {
test('simple', async () => {
const features = TestSteps_1.asFeatures([{ path: '/f1', content: 'f1_step' }]);
const features = lib_1.asFeatures([{ path: '/f1', content: 'f1_step' }]);
const res = await steps.expandBackgrounds(features);

@@ -33,7 +33,7 @@ expect(res).toEqual(features);

test('hierarchical', async () => {
const features = TestSteps_1.asFeatures([
const features = lib_1.asFeatures([
{ path: '/f1', content: 'f1_step' },
{ path: '/f1/l1f1', content: 'l1f1_step' },
]);
const expected = TestSteps_1.asFeatures([
const expected = lib_1.asFeatures([
{ path: '/f1', content: 'f1_step' },

@@ -46,3 +46,3 @@ { path: '/f1/l1f1', content: 'f1_step\nl1f1_step' },

test('multiple hierarchical', async () => {
const features = TestSteps_1.asFeatures([
const features = lib_1.asFeatures([
{ path: '/f1', content: 'f1_step' },

@@ -52,3 +52,3 @@ { path: '/l1/l1f1', content: 'l1_step' },

]);
const expected = TestSteps_1.asFeatures([
const expected = lib_1.asFeatures([
{ path: '/f1', content: 'f1_step' },

@@ -63,3 +63,3 @@ { path: '/l1/l1f1', content: 'f1_step\nl1_step' },

describe('feature finding', () => {
const features = TestSteps_1.asFeatures([
const features = lib_1.asFeatures([
{ path: '/l0.feature', content: 'l0_feature' },

@@ -74,11 +74,11 @@ { path: '/l0/l1.feature', content: 'l1_feature' },

const res = steps.findFeatures('l0', features);
expect(res).toEqual(TestSteps_1.asFeatures([{ path: '/l0.feature', content: 'l0_feature' }]));
expect(res).toEqual(lib_1.asFeatures([{ path: '/l0.feature', content: 'l0_feature' }]));
});
test('finds l1 feature', () => {
const res = steps.findFeatures('l1', features);
expect(res).toEqual(TestSteps_1.asFeatures([{ path: '/l0/l1.feature', content: 'l1_feature' }]));
expect(res).toEqual(lib_1.asFeatures([{ path: '/l0/l1.feature', content: 'l1_feature' }]));
});
test('finds multiple', () => {
const res = steps.findFeatures('l1', TestSteps_1.asFeatures([...features, { path: '/l1/l1.feature', content: 'l1_l1_feature' }]));
expect(res).toEqual(TestSteps_1.asFeatures([
const res = steps.findFeatures('l1', lib_1.asFeatures([...features, { path: '/l1/l1.feature', content: 'l1_l1_feature' }]));
expect(res).toEqual(lib_1.asFeatures([
{ path: '/l0/l1.feature', content: 'l1_feature' },

@@ -89,4 +89,4 @@ { path: '/l1/l1.feature', content: 'l1_l1_feature' },

test('finds fileType', () => {
const res = steps.findFeatures('l1', TestSteps_1.asFeatures([...features, { path: '/l1/l1.mytype.feature', content: 'l1_l1_mytype.feature' }]), 'mytype');
expect(res).toEqual(TestSteps_1.asFeatures([{ path: '/l1/l1.mytype.feature', content: 'l1_l1_mytype.feature' }]));
const res = steps.findFeatures('l1', lib_1.asFeatures([...features, { path: '/l1/l1.mytype.feature', content: 'l1_l1_mytype.feature' }]), 'mytype');
expect(res).toEqual(lib_1.asFeatures([{ path: '/l1/l1.mytype.feature', content: 'l1_l1_mytype.feature' }]));
});

@@ -96,11 +96,11 @@ });

test('applies backgrounds', async () => {
const features = TestSteps_1.asFeatures([{ path: '/f1', content: 'Backgrounds: b1\nextant' }]);
const backgrounds = TestSteps_1.asFeatures([{ path: '/b1.feature', content: 'result' }]);
const features = lib_1.asFeatures([{ path: '/f1', content: 'Backgrounds: b1\nextant' }]);
const backgrounds = lib_1.asFeatures([{ path: '/b1.feature', content: 'result' }]);
const res = await steps.expandFeatures(features, backgrounds);
const expected = TestSteps_1.asExpandedFeatures([{ path: '/f1', content: '\nresult\nextant' }]);
const expected = lib_1.asExpandedFeatures([{ path: '/f1', content: '\nresult\nextant' }]);
expect(res[0].expanded).toEqual(expected[0].expanded);
});
test('applies backgrounds hierarchical', async () => {
const features = TestSteps_1.asFeatures([{ path: '/l1/f1', content: 'Backgrounds: b2' }]);
const backgrounds = TestSteps_1.asFeatures([
const features = lib_1.asFeatures([{ path: '/l1/f1', content: 'Backgrounds: b2' }]);
const backgrounds = lib_1.asFeatures([
{ path: '/l1/b1.feature', content: 'non-result' },

@@ -110,3 +110,3 @@ { path: '/l2/b2.feature', content: 'result' },

const res = await steps.expandFeatures(features, backgrounds);
expect(res).toEqual(TestSteps_1.asExpandedFeatures([{ path: '/l1/f1', content: '\nresult\n' }]));
expect(res).toEqual(lib_1.asExpandedFeatures([{ path: '/l1/f1', content: '\nresult\n' }]));
});

@@ -134,3 +134,3 @@ });

const env = { what: [0, 1] };
const { world } = await TestSteps_1.testWithDefaults([feature], [TestEnvcStepper], { env });
const { world } = await lib_1.testWithDefaults([feature], [TestEnvcStepper], { env });
expect(world.options._index_what).toBe(1);

@@ -137,0 +137,0 @@ });

@@ -15,3 +15,7 @@ import { TStepResult, TTag } from '../defs';

};
export declare type TMessageTopic = TExecutorTopic;
export declare type TTraceTopic = {
type?: string;
trace?: any;
};
export declare type TMessageTopic = TExecutorTopic | TTraceTopic;
export interface ILogger {

@@ -18,0 +22,0 @@ debug: (what: any, ctx?: TMessageContext) => void;

@@ -60,3 +60,3 @@ "use strict";

const tag = messageContext?.tag ? util_1.descTag(messageContext.tag) : '';
console[level].call(console, `${ln}${tag}: `.padStart(WIDTH), args, level.padStart(6));
console[level](`${ln}${Object.keys(tag)}: `.padStart(WIDTH), args, level.padStart(6));
}

@@ -63,0 +63,0 @@ }

@@ -24,3 +24,3 @@ "use strict";

const Logger_1 = __importStar(require("./Logger"));
const TestSteps_1 = require("./TestSteps");
const lib_1 = require("./test/lib");
describe('log levels', () => {

@@ -56,7 +56,7 @@ test('logs none with none', () => {

out(level, args, ctx) {
expect(ctx.tag).toBe('current');
expect(ctx?.tag?.loop).toBe(0);
done();
},
};
const dlogger = new Logger_1.default({ output, tag: TestSteps_1.getDefaultTag(0) });
const dlogger = new Logger_1.default({ output, tag: lib_1.getDefaultTag(0) });
dlogger.log('test');

@@ -63,0 +63,0 @@ });

@@ -94,3 +94,3 @@ "use strict";

if (!shared.get(namedValue)) {
throw Error(`no value for "${namedValue}" from ${JSON.stringify({ shared, type })}`);
throw Error(`no value for "${namedValue}" from ${JSON.stringify({ keys: Object.keys(shared), type })}`);
}

@@ -102,3 +102,3 @@ namedFromVars[name] = shared.get(namedValue);

if (!shared.get(credentials_1.cred(namedValue))) {
throw Error(`no value for credential "${namedValue}" from ${JSON.stringify({ shared, type })}`);
throw Error(`no value for credential "${namedValue}" from ${JSON.stringify({ keys: Object.keys(shared), type })}`);
}

@@ -111,3 +111,3 @@ namedFromVars[name] = shared.get(credentials_1.cred(namedValue));

if (val === undefined) {
throw Error(`no env value for "${namedValue}" from ${JSON.stringify({ shared, type })}`);
throw Error(`no env value for "${namedValue}" from ${JSON.stringify({ env: Object.keys(process.env), type })}`);
}

@@ -114,0 +114,0 @@ if (Array.isArray(val)) {

@@ -7,4 +7,3 @@ "use strict";

const util_1 = require("./util");
const TestSteps_1 = require("./TestSteps");
const TestSteps_2 = require("./TestSteps");
const lib_1 = require("./test/lib");
const features_1 = require("./features");

@@ -82,7 +81,7 @@ describe('namedMatches', () => {

const steppers = [new TestStepper()];
const { world } = TestSteps_1.getDefaultWorld(0);
const { world } = lib_1.getDefaultWorld(0);
const resolver = new Resolver_1.Resolver(steppers, '', world);
world.shared.set('exact', 'res');
test('gets var', async () => {
const features = TestSteps_2.asExpandedFeatures([features_1.withNameType('l1', 'is `exact`')]);
const features = lib_1.asExpandedFeatures([features_1.withNameType('l1', 'is `exact`')]);
const res = await resolver.resolveSteps(features);

@@ -89,0 +88,0 @@ const { vsteps } = res[0];

@@ -13,3 +13,3 @@ import { TSpecl, IStepper, IExtensionConstructor, TResult, TWorld, TProtoOptions, TFeature } from './defs';

}>;
export declare function runWith({ specl, world, features, backgrounds, addSteppers, protoOptions: protoOptions, }: {
declare type TRunWithOptions = {
specl: TSpecl;

@@ -21,6 +21,8 @@ world: TWorld;

protoOptions?: TProtoOptions;
}): Promise<{
};
export declare function runWith({ specl, world, features, backgrounds, addSteppers, protoOptions: protoOptions, }: TRunWithOptions): Promise<{
result: TResult;
steppers?: IStepper[];
}>;
export {};
//# sourceMappingURL=run.d.ts.map

@@ -6,5 +6,4 @@ "use strict";

const run_1 = require("./run");
const TestSteps_1 = require("./TestSteps");
const lib_1 = require("./test/lib");
const util_1 = require("./util");
const TestSteps_2 = require("./TestSteps");
const TTYPE = 'page';

@@ -56,3 +55,3 @@ const CCONTROL = 'control';

it('missing domain object', async () => {
const { result } = await TestSteps_1.testWithDefaults([{ path: '/features/test.feature', content: `\nHas a foobar control\n` }], [TestStepsRequiresDomain]);
const { result } = await lib_1.testWithDefaults([{ path: '/features/test.feature', content: `\nHas a foobar control\n` }], [TestStepsRequiresDomain]);
expect(result.ok).toBe(false);

@@ -65,5 +64,5 @@ expect(result.failure.error.message.startsWith(`missing required domain "${TTYPE}"`)).toBe(true);

const key = '/backgrounds/p1';
const { world } = TestSteps_2.getDefaultWorld(0);
const features = TestSteps_1.asFeatures([{ path: '/features/test.feature', content: `Backgrounds: p1.${TTYPE}\n\nOn the /backgrounds/p1 ${TTYPE}\nSee the page control\n` }]);
const backgrounds = TestSteps_1.asFeatures([{ path: `/backgrounds/p1.${TTYPE}.feature`, content: 'Has a lever control' }]);
const { world } = lib_1.getDefaultWorld(0);
const features = lib_1.asFeatures([{ path: '/features/test.feature', content: `Backgrounds: p1.${TTYPE}\n\nOn the /backgrounds/p1 ${TTYPE}\nSee the page control\n` }]);
const backgrounds = lib_1.asFeatures([{ path: `/backgrounds/p1.${TTYPE}.feature`, content: 'Has a lever control' }]);
const { result } = await run_1.runWith({ specl, features, backgrounds, addSteppers: [TestStepsRequiresDomain, TestStepsWithDomain], world });

@@ -70,0 +69,0 @@ expect(result.ok).toBe(true);

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const run_1 = require("./run");
const TestSteps_1 = require("./TestSteps");
const lib_1 = require("./test/lib");
const TestSteps_1 = __importDefault(require("./test/TestSteps"));
const util_1 = require("./util");
const TestSteps_2 = require("./TestSteps");
describe('run self-contained', () => {

@@ -11,3 +14,3 @@ it('Backgrounds', async () => {

const specl = util_1.getOptionsOrDefault(base);
const { result } = await run_1.run({ specl, base, addSteppers: [TestSteps_1.TestSteps], ...TestSteps_2.getDefaultWorld(0) });
const { result } = await run_1.run({ specl, base, addSteppers: [TestSteps_1.default], ...lib_1.getDefaultWorld(0) });
expect(result.ok).toBe(true);

@@ -26,3 +29,3 @@ expect(result.results.length).toBe(1);

const specl = util_1.getOptionsOrDefault(base);
const { result } = await run_1.run({ specl, base, addSteppers: [TestSteps_1.TestSteps], ...TestSteps_2.getDefaultWorld(0) });
const { result } = await run_1.run({ specl, base, addSteppers: [TestSteps_1.default], ...lib_1.getDefaultWorld(0) });
expect(result.ok).toBe(true);

@@ -41,3 +44,3 @@ expect(result.results.length).toBe(1);

const specl = util_1.getOptionsOrDefault(base);
const { result } = await run_1.run({ specl, base, addSteppers: [TestSteps_1.TestSteps], ...TestSteps_2.getDefaultWorld(0) });
const { result } = await run_1.run({ specl, base, addSteppers: [TestSteps_1.default], ...lib_1.getDefaultWorld(0) });
expect(result.ok).toBe(false);

@@ -52,3 +55,3 @@ expect(result.failure?.stage).toBe('Resolve');

const specl = util_1.getOptionsOrDefault(base);
const { result } = await run_1.run({ specl, base, addSteppers: [TestSteps_1.TestSteps], ...TestSteps_2.getDefaultWorld(0) });
const { result } = await run_1.run({ specl, base, addSteppers: [TestSteps_1.default], ...lib_1.getDefaultWorld(0) });
expect(result.ok).toBe(false);

@@ -62,3 +65,3 @@ expect(result.failure?.stage).toBe('Execute');

const specl = util_1.getOptionsOrDefault(base);
const { result } = await run_1.run({ specl, base, addSteppers: [TestSteps_1.TestSteps], ...TestSteps_2.getDefaultWorld(0) });
const { result } = await run_1.run({ specl, base, addSteppers: [TestSteps_1.default], ...lib_1.getDefaultWorld(0) });
expect(result.ok).toBe(false);

@@ -73,4 +76,4 @@ expect(result.results?.length).toBe(2);

const specl = util_1.getOptionsOrDefault(base);
const { world } = TestSteps_2.getDefaultWorld(0);
const { result } = await run_1.run({ specl, base, addSteppers: [TestSteps_1.TestSteps], world });
const { world } = lib_1.getDefaultWorld(0);
const { result } = await run_1.run({ specl, base, addSteppers: [TestSteps_1.default], world });
expect(result.ok).toBe(true);

@@ -85,3 +88,3 @@ expect(world.shared.get('var')).toBe('1');

const feature = { path: '/features/test.feature', content: `When I throw an exception\nThen the test should pass` };
const { result } = await TestSteps_1.testWithDefaults([feature], [TestSteps_1.TestSteps]);
const { result } = await lib_1.testWithDefaults([feature], [TestSteps_1.default]);
expect(result.ok).toBe(false);

@@ -95,3 +98,3 @@ expect(result.results?.length).toBe(1);

const specl = util_1.getOptionsOrDefault(base);
const { result } = await run_1.run({ specl, base, addSteppers: [TestSteps_1.TestSteps], ...TestSteps_2.getDefaultWorld(0) });
const { result } = await run_1.run({ specl, base, addSteppers: [TestSteps_1.default], ...lib_1.getDefaultWorld(0) });
expect(result.ok).toBe(true);

@@ -98,0 +101,0 @@ expect(result.results?.length).toBe(1);

@@ -10,2 +10,3 @@ import { WorldContext } from './contexts';

export declare function actionOK(topics?: TActionResultTopics): TOKActionResult;
export declare function getStepper(s: string): Promise<IExtensionConstructor>;
export declare function getSteppers({ steppers, world, addSteppers }: {

@@ -38,6 +39,7 @@ steppers: string[];

export declare function applyExtraOptions(protoOptions: TProtoOptions, steppers: IStepper[], world: TWorld): void;
export declare function getPre(stepper: IStepper): string;
export declare function getStepperOptions(key: string, value: string, steppers: (IStepper & IHasOptions)[]): TOptionValue | void;
export declare function getStepperOption(stepper: IStepper, name: string, options: TOptions): TOptionValue;
export declare function ensureDirectory(base: string, folder: string): void;
export declare function getStepper<Type>(steppers: IStepper[], name: string): Type;
export declare function findStepper<Type>(steppers: IStepper[], name: string): Type;
export declare function getFromRuntime<Type>(runtime: TRuntime, name: string): Type;

@@ -44,0 +46,0 @@ export declare function applyResShouldContinue(world: any, res: Partial<TActionResult>, vstep: TFound): boolean;

@@ -25,3 +25,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.descTag = exports.getIntOrError = exports.getRunTag = exports.getCaptureDir = exports.applyResShouldContinue = exports.getFromRuntime = exports.getStepper = exports.ensureDirectory = exports.getStepperOption = exports.getStepperOptions = exports.applyExtraOptions = exports.applyEnvCollections = exports.processEnv = exports.sleep = exports.isLowerCase = exports.describeSteppers = exports.getActionable = exports.getOptionsOrDefault = exports.getDefaultOptions = exports.recurse = exports.debase = exports.getSteppers = exports.actionOK = exports.actionNotOK = exports.resultOutput = exports.use = void 0;
exports.descTag = exports.getIntOrError = exports.getRunTag = exports.getCaptureDir = exports.applyResShouldContinue = exports.getFromRuntime = exports.findStepper = exports.ensureDirectory = exports.getStepperOption = exports.getStepperOptions = exports.getPre = exports.applyExtraOptions = exports.applyEnvCollections = exports.processEnv = exports.sleep = exports.isLowerCase = exports.describeSteppers = exports.getActionable = exports.getOptionsOrDefault = exports.getDefaultOptions = exports.recurse = exports.debase = exports.getSteppers = exports.getStepper = exports.actionOK = exports.actionNotOK = exports.resultOutput = exports.use = void 0;
const fs_1 = require("fs");

@@ -71,7 +71,18 @@ const path_1 = __importDefault(require("path"));

exports.actionOK = actionOK;
async function getStepper(s) {
try {
const loc = getModuleLocation(s);
const S = await use(loc);
return S;
}
catch (e) {
console.error(`could not use ${s}`);
throw (e);
}
}
exports.getStepper = getStepper;
async function getSteppers({ steppers = [], world, addSteppers = [] }) {
const allSteppers = [];
for (const s of steppers) {
const loc = getModuleLocation(s);
const S = await use(loc);
const S = await getStepper(s);
try {

@@ -82,3 +93,3 @@ const stepper = new S(world);

catch (e) {
console.error(`new ${S} from "${loc}" failed`, e, S);
console.error(`new ${S} from "${getModuleLocation(s)}" failed`, e, S);
throw e;

@@ -193,3 +204,3 @@ }

}
else if (['STEP_DELAY', 'LOOPS', 'MEMBERS'].includes(opt)) {
else if (['STEP_DELAY', 'LOOPS', 'LOOP_START', 'LOOP_INC', 'MEMBERS'].includes(opt)) {
setIntOrError(value, opt);

@@ -268,2 +279,3 @@ }

}
exports.getPre = getPre;
function getStepperOptions(key, value, steppers) {

@@ -302,6 +314,6 @@ for (const stepper of steppers) {

// FIXME
function getStepper(steppers, name) {
function findStepper(steppers, name) {
return steppers.find((s) => s.constructor.name === name);
}
exports.getStepper = getStepper;
exports.findStepper = findStepper;
function getFromRuntime(runtime, name) {

@@ -308,0 +320,0 @@ return runtime[name];

@@ -21,11 +21,15 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const util = __importStar(require("./util"));
const TestSteps_1 = require("./TestSteps");
const TestSteps_2 = require("./TestSteps");
const lib_1 = require("./test/lib");
const TestSteps_1 = __importDefault(require("./test/TestSteps"));
const TestStepsWithOptions_1 = __importDefault(require("./test/TestStepsWithOptions"));
const features_1 = require("./features");
describe('output', () => {
it('resultOutput default', async () => {
const { world } = TestSteps_2.getDefaultWorld(0);
const { result } = await TestSteps_1.testRun('/test/projects/specl/out-default', [TestSteps_1.TestSteps], world);
const { world } = lib_1.getDefaultWorld(0);
const { result } = await lib_1.testRun('/test/projects/specl/out-default', [TestSteps_1.default], world);
expect(result.ok).toBe(false);

@@ -71,15 +75,15 @@ const output = await util.resultOutput(undefined, result, world.shared);

it('finds stepper options', async () => {
const steppers = await util.getSteppers({ steppers: [], addSteppers: [TestSteps_1.TestStepsWithOptions], ...TestSteps_2.getDefaultWorld(0) });
const conc = util.getStepperOptions(TestSteps_1.HAIBUN_O_TESTSTEPSWITHOPTIONS_EXISTS, 'true', steppers);
const steppers = await util.getSteppers({ steppers: [], addSteppers: [TestStepsWithOptions_1.default], ...lib_1.getDefaultWorld(0) });
const conc = util.getStepperOptions(lib_1.HAIBUN_O_TESTSTEPSWITHOPTIONS_EXISTS, 'true', steppers);
expect(conc).toBeDefined();
});
it('fills extra', async () => {
const { world } = TestSteps_2.getDefaultWorld(0);
const specl = { ...util.getDefaultOptions(), extraOptions: { [TestSteps_1.HAIBUN_O_TESTSTEPSWITHOPTIONS_EXISTS]: 'true' } };
const steppers = await util.getSteppers({ steppers: [], addSteppers: [TestSteps_1.TestStepsWithOptions], ...TestSteps_2.getDefaultWorld(0) });
const { world } = lib_1.getDefaultWorld(0);
const specl = { ...util.getDefaultOptions(), extraOptions: { [lib_1.HAIBUN_O_TESTSTEPSWITHOPTIONS_EXISTS]: 'true' } };
const steppers = await util.getSteppers({ steppers: [], addSteppers: [TestStepsWithOptions_1.default], ...lib_1.getDefaultWorld(0) });
util.applyExtraOptions(specl, steppers, world);
expect(world.options[TestSteps_1.HAIBUN_O_TESTSTEPSWITHOPTIONS_EXISTS]).toBe(42);
expect(world.options[lib_1.HAIBUN_O_TESTSTEPSWITHOPTIONS_EXISTS]).toBe(42);
});
it('throws for unfilled extra', async () => {
const { world } = TestSteps_2.getDefaultWorld(0);
const { world } = lib_1.getDefaultWorld(0);
const specl = { ...util.getDefaultOptions(), extraOptions: { HAIBUN_NE: 'true' } };

@@ -86,0 +90,0 @@ expect(() => util.applyExtraOptions(specl, [], world)).toThrow();

@@ -8,3 +8,3 @@ "use strict";

const defs_1 = require("../lib/defs");
const TestSteps_1 = require("../lib/TestSteps");
const lib_1 = require("../lib/test/lib");
const Builder_1 = __importDefault(require("./Builder"));

@@ -36,3 +36,3 @@ const feature = (result) => ({

};
const builder = new Builder_1.default(TestSteps_1.getDefaultWorld(0).world);
const builder = new Builder_1.default(lib_1.getDefaultWorld(0).world);
// expect(async () => await builder.build([feature(throws)])).rejects.toThrow('fails');

@@ -42,3 +42,3 @@ });

const throws = async () => defs_1.OK;
const builder = new Builder_1.default(TestSteps_1.getDefaultWorld(0).world);
const builder = new Builder_1.default(lib_1.getDefaultWorld(0).world);
// const res = await builder.build([feature(throws)]);

@@ -51,3 +51,3 @@ // expect(res).toBe(OK);

const workspace = new contexts_1.WorkspaceContext(`test builder finalizes`);
const builder = new Builder_1.default(TestSteps_1.getDefaultWorld(0).world, workspace);
const builder = new Builder_1.default(lib_1.getDefaultWorld(0).world, workspace);
// await builder.build([feature(finalizes)]);

@@ -54,0 +54,0 @@ // expect(workspace['passes.feature'].done).toBe(true);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const defs_1 = require("../lib/defs");
const TestSteps_1 = require("../lib/TestSteps");
const TestSteps_2 = require("../lib/TestSteps");
const lib_1 = require("../lib/test/lib");
const Resolver_1 = require("./Resolver");

@@ -32,7 +31,7 @@ describe('validate map steps', () => {

const getResolver = () => new Resolver_1.Resolver(steppers, '', {
...TestSteps_2.getDefaultWorld(0).world,
...lib_1.getDefaultWorld(0).world,
});
describe('exact', () => {
test('exact', async () => {
const features = TestSteps_1.asExpandedFeatures([{ path: 'l1', content: `exact1` }]);
const features = lib_1.asExpandedFeatures([{ path: 'l1', content: `exact1` }]);
const res = await getResolver().resolveSteps(features);

@@ -45,3 +44,3 @@ const { vsteps } = res[0];

test('match', async () => {
const features = TestSteps_1.asExpandedFeatures([{ path: 'l1', content: `match1` }]);
const features = lib_1.asExpandedFeatures([{ path: 'l1', content: `match1` }]);
const res = await getResolver().resolveSteps(features);

@@ -54,3 +53,3 @@ const { vsteps } = res[0];

test('gwta', async () => {
const features = TestSteps_1.asExpandedFeatures([{ path: 'l1', content: `gwta2\nGiven I'm gwta3\nWhen I am gwta4\nGwta5\nThen the gwta6` }]);
const features = lib_1.asExpandedFeatures([{ path: 'l1', content: `gwta2\nGiven I'm gwta3\nWhen I am gwta4\nGwta5\nThen the gwta6` }]);
const res = await getResolver().resolveSteps(features);

@@ -67,3 +66,3 @@ const { vsteps } = res[0];

test('gets quoted', async () => {
const features = TestSteps_1.asExpandedFeatures([{ path: 'l1', content: 'is "string"' }]);
const features = lib_1.asExpandedFeatures([{ path: 'l1', content: 'is "string"' }]);
const res = await getResolver().resolveSteps(features);

@@ -74,3 +73,3 @@ const { vsteps } = res[0];

test('gets uri', async () => {
const features = TestSteps_1.asExpandedFeatures([{ path: 'l1', content: 'is http://url' }]);
const features = lib_1.asExpandedFeatures([{ path: 'l1', content: 'is http://url' }]);
const res = await getResolver().resolveSteps(features);

@@ -77,0 +76,0 @@ const { vsteps } = res[0];

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Executor_1 = require("../phases/Executor");
const TestSteps_1 = require("../lib/TestSteps");
const TestSteps_2 = require("../lib/TestSteps");
const lib_1 = require("../lib/test/lib");
describe('haibun', () => {
it('finds prose', async () => {
const { world, vstep } = await TestSteps_1.getTestEnv(['haibun'], 'A sentence.', TestSteps_2.getDefaultWorld(0).world);
const { world, vstep } = await lib_1.getTestEnv(['haibun'], 'A sentence.', lib_1.getDefaultWorld(0).world);
const res = await Executor_1.Executor.doFeatureStep(vstep, world);

@@ -10,0 +9,0 @@ expect(res.ok).toBe(true);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Executor_1 = require("../phases/Executor");
const TestSteps_1 = require("../lib/TestSteps");
const TestSteps_2 = require("../lib/TestSteps");
const lib_1 = require("../lib/test/lib");
const vars_1 = require("./vars");

@@ -10,3 +9,3 @@ const contexts_1 = require("../lib/contexts");

it('assigns', async () => {
const { world, vstep } = await TestSteps_1.getTestEnv(['vars'], 'set x to y', TestSteps_2.getDefaultWorld(0).world);
const { world, vstep } = await lib_1.getTestEnv(['vars'], 'set x to y', lib_1.getDefaultWorld(0).world);
await Executor_1.Executor.doFeatureStep(vstep, world);

@@ -16,3 +15,3 @@ expect(world.shared.get('x')).toBe('y');

it('assigns empty', async () => {
const { world, vstep } = await TestSteps_1.getTestEnv(['vars'], 'set empty "x" to y', TestSteps_2.getDefaultWorld(0).world);
const { world, vstep } = await lib_1.getTestEnv(['vars'], 'set empty "x" to y', lib_1.getDefaultWorld(0).world);
await Executor_1.Executor.doFeatureStep(vstep, world);

@@ -22,5 +21,5 @@ expect(world.shared.get('x')).toBe('y');

it('empty does not overwrite', async () => {
const { world, vstep } = await TestSteps_1.getTestEnv(['vars'], 'set empty "x" to newValue', {
...TestSteps_2.getDefaultWorld(0).world,
shared: new contexts_1.WorldContext(TestSteps_1.getDefaultTag(0, 'test vars empty does not overwrite'), { x: 'notY' }),
const { world, vstep } = await lib_1.getTestEnv(['vars'], 'set empty "x" to newValue', {
...lib_1.getDefaultWorld(0).world,
shared: new contexts_1.WorldContext(lib_1.getDefaultTag(0, 'test vars empty does not overwrite'), { x: 'notY' }),
});

@@ -32,3 +31,3 @@ const res = await Executor_1.Executor.doFeatureStep(vstep, world);

it('is not set', async () => {
const { world, vstep } = await TestSteps_1.getTestEnv(['vars'], '"x 1" is set', { ...TestSteps_2.getDefaultWorld(0).world });
const { world, vstep } = await lib_1.getTestEnv(['vars'], '"x 1" is set', { ...lib_1.getDefaultWorld(0).world });
const res = await Executor_1.Executor.doFeatureStep(vstep, world);

@@ -38,3 +37,3 @@ expect(res.ok).toBe(false);

it('is set', async () => {
const { world, vstep } = await TestSteps_1.getTestEnv(['vars'], '"x 1" is set', { ...TestSteps_2.getDefaultWorld(0).world, shared: new contexts_1.WorldContext(TestSteps_1.getDefaultTag(0, 'is set'), { 'x 1': '1' }) });
const { world, vstep } = await lib_1.getTestEnv(['vars'], '"x 1" is set', { ...lib_1.getDefaultWorld(0).world, shared: new contexts_1.WorldContext(lib_1.getDefaultTag(0, 'is set'), { 'x 1': '1' }) });
const res = await Executor_1.Executor.doFeatureStep(vstep, world);

@@ -44,3 +43,3 @@ expect(res.ok).toBe(true);

it('is set with or', async () => {
const { world, vstep } = await TestSteps_1.getTestEnv(['vars'], '"x 1" is set or do something', { ...TestSteps_2.getDefaultWorld(0).world });
const { world, vstep } = await lib_1.getTestEnv(['vars'], '"x 1" is set or do something', { ...lib_1.getDefaultWorld(0).world });
const res = await Executor_1.Executor.doFeatureStep(vstep, world);

@@ -47,0 +46,0 @@ expect(res.ok).toBe(false);

{
"name": "@haibun/core",
"version": "1.0.8",
"version": "1.1.0",
"description": "",

@@ -5,0 +5,0 @@ "author": "",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc