@haibun/core
Advanced tools
Comparing version 1.0.7 to 1.0.8
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getNamedToVars = exports.getMatch = exports.getNamedMatches = exports.namedInterpolation = exports.matchGroups = void 0; | ||
const credentials_1 = require("../steps/credentials"); | ||
const defs_1 = require("./defs"); | ||
@@ -90,3 +91,3 @@ const domain_1 = require("./domain"); | ||
} | ||
else if (namedKey.startsWith(TYPE_VAR) || namedKey.startsWith(TYPE_CREDENTIAL)) { | ||
else if (namedKey.startsWith(TYPE_VAR)) { | ||
// must be from source | ||
@@ -98,2 +99,9 @@ if (!shared.get(namedValue)) { | ||
} | ||
else if (namedKey.startsWith(TYPE_CREDENTIAL)) { | ||
// must be from source | ||
if (!shared.get(credentials_1.cred(namedValue))) { | ||
throw Error(`no value for credential "${namedValue}" from ${JSON.stringify({ shared, type })}`); | ||
} | ||
namedFromVars[name] = shared.get(credentials_1.cred(namedValue)); | ||
} | ||
else if (namedKey.startsWith(TYPE_ENV)) { | ||
@@ -100,0 +108,0 @@ // FIXME add test |
@@ -93,22 +93,2 @@ "use strict"; | ||
}); | ||
describe('options', () => { | ||
it('stepper options', async () => { | ||
const base = process.cwd() + '/test/projects/haibun/stepper-options'; | ||
const { world } = TestSteps_2.getDefaultWorld(0); | ||
const specl = util_1.getOptionsOrDefault(base); | ||
const { protoOptions: protoConfig } = util_1.processEnv({ [TestSteps_1.HAIBUN_O_TESTSTEPSWITHOPTIONS_EXISTS]: 'true' }, {}); | ||
const { result } = await run_1.run({ specl, base, addSteppers: [TestSteps_1.TestStepsWithOptions], world, protoOptions: protoConfig }); | ||
expect(result.ok).toBe(true); | ||
expect(result.results?.length).toBe(1); | ||
expect(result.results[0].stepResults[0].actionResults[0].topics?.options.summary).toEqual('options'); | ||
}); | ||
}); | ||
describe('builds', () => { | ||
it('builds with finalizer', async () => { | ||
const feature = { path: '/features/test.feature', content: `builds with finalizer` }; | ||
const { result, world } = await TestSteps_1.testWithDefaults([feature], [TestSteps_1.TestSteps]); | ||
expect(result.ok).toBe(true); | ||
expect(world.shared.get('done')).toEqual('ok'); | ||
}); | ||
}); | ||
//# sourceMappingURL=run.test.js.map |
import { IExtensionConstructor } from '../lib/defs'; | ||
export declare const cred: (key: string) => string; | ||
declare const Credentials: IExtensionConstructor; | ||
export default Credentials; | ||
//# sourceMappingURL=credentials.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.cred = void 0; | ||
const defs_1 = require("../lib/defs"); | ||
const cred = (key) => `__cred_${key}`; | ||
exports.cred = cred; | ||
const Credentials = class Credentials { | ||
@@ -25,7 +28,7 @@ constructor(world) { | ||
generateRandomUsername(ref) { | ||
this.world.shared.set(ref, ['rnd', Math.floor(Date.now() / 1000).toString(36), Math.floor(Math.random() * 1e8).toString(36)].join('_')); | ||
return this.world.shared.get(ref); | ||
this.world.shared.set(exports.cred(ref), ['rnd', Math.floor(Date.now() / 1000).toString(36), Math.floor(Math.random() * 1e8).toString(36)].join('_')); | ||
return this.world.shared.get(exports.cred(ref)); | ||
} | ||
generateRandomPassword(ref) { | ||
this.world.shared.set(ref, [ | ||
this.world.shared.set(exports.cred(ref), [ | ||
'testpass', | ||
@@ -36,6 +39,6 @@ Math.floor(Math.random() * 1e8) | ||
].join('_')); | ||
return this.world.shared.get(ref); | ||
return this.world.shared.get(exports.cred(ref)); | ||
} | ||
getRandom(name) { | ||
return this.world.shared.get(name); | ||
return this.world.shared.get(exports.cred(name)); | ||
} | ||
@@ -42,0 +45,0 @@ }; |
{ | ||
"name": "@haibun/core", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"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
229663
2981