async testQueries(queries, fixture) { if (!this.container && !process.env.TEST_LOCAL) { console.log('Starting container'); this.container = await this.containerLazyInit(); } if (!this.connection) { console.log('Initializing connection'); const port = this.container ? this.container.getMappedPort(this.port()) : this.port(); this.connection = await this.connectionLazyInit(port); } return this.connection.testQueries(queries, fixture); }
const log = data => { if (process.env.DEBUG) { console.log(data); } }
runner(process.argv.slice(2), { templates: defaultTemplates, cwd: process.cwd(), logger: new Logger(console.log.bind(console)), debug: !!process.env.DEBUG, exec: (action, body) => { const opts = body && body.length > 0 ? { input: body } : {} return require('execa').command(action, { ...opts, shell: true }) }, createPrompter: () => require('enquirer'), }).then(({ success }) => process.exit(success ? 0 : 1))
const describeIfEnv = (key, value) => (description, callback, describeFn = describe) => { return value === process.env[key] ? describeFn(description, callback) : describe.skip(description, callback) }
(process.env.NODE_PATH || '') .split(path.delimiter) .filter(folder => folder && !path.isAbsolute(folder)) .map(folder => path.resolve(appDirectory, folder)) .join(path.delimiter)
_(process.env) // Only muck with prefix_ variables .pickBy((value, key) => _.includes(key, prefix)) // Prep the keys for consumption .mapKeys((value, key) => _.camelCase(_.trimStart(key, prefix))) // If we have a JSON string as a value, parse that and assign its sub-keys .mapValues(exports.tryConvertJson) // Resolve the lodash wrapper .value()
async function main() { const app = await NestFactory.create(AppModule, { logger: process.env.NODE_ENV === 'development' ? new Logger() : false, }); await bootstrap(app); }
const testIfKafkaVersion = (version, versionComparator) => { const scopedTest = (description, callback, testFn = test) => { return versionComparator(semver.coerce(process.env.KAFKA_VERSION), semver.coerce(version)) ? testFn(description, callback) : test.skip(description, callback) } scopedTest.only = (description, callback) => scopedTest(description, callback, test.only) return scopedTest }
test('use extend environment with `extendEnv: true` and `shell: true`', async t => { process.env.TEST = 'test'; const command = process.platform === 'win32' ? 'echo %TEST%' : 'echo $TEST'; const {stdout} = await execa(command, {shell: true, env: {}, extendEnv: true}); t.is(stdout, 'test'); delete process.env.TEST; });
(process.env.NODE_PATH || '') .split(path.delimiter) .filter(folder => folder && !path.isAbsolute(folder)) .map(folder => path.resolve(appDirectory, folder)) .join(path.delimiter)