afterAll(async function(state) { return util.promisify(removeFolder)(state.frontendFolder); });
xit('repl and uncaught error', async function() { const configDir = await fsMkdtemp(path.join(os.tmpdir(), 'ndb-test-')); const frontend = await launch({ configDir: configDir, argv: ['.'], cwd: path.join(__dirname, 'assets', 'test-project'), debugFrontend: false, doNotCopyPreferences: true }); const consolePrompt = await frontend.waitForSelector('body /deep/ #console-prompt'); await frontend.type('body /deep/ #console-prompt', 'require("child_process").spawn("!@#$%")'); await consolePrompt.press('Enter'); await frontend.type('body /deep/ #console-prompt', 'console.log(42)'); consolePrompt.press('Enter'); const consoleMessage = await frontend.waitForSelector('body /deep/ .console-message-wrapper:nth-child(6) .console-message-text'); assert.equal('42', await frontend.evaluate(x => x.innerText, consoleMessage)); await frontend.close(); await util.promisify(removeFolder)(configDir); });
const getAppleKeyByKeyId = async (keyId, cacheMaxEntries, cacheMaxAge) => { const client = jwksClient({ jwksUri: `${TOKEN_ISSUER}/auth/keys`, cache: true, cacheMaxEntries, cacheMaxAge }); const asyncGetSigningKeyFunction = util.promisify(client.getSigningKey); let key; try { key = await asyncGetSigningKeyFunction(keyId); } catch (error) { throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, `Unable to find matching key for Key ID: ${keyId}`); } return key; }
async connectionLazyInit(port) { return { testQueries: async (queries, fixture) => { const conn = mysql.createConnection({ host: 'localhost', port, user: 'root', database: 'mysql', password: this.password() }); const connect = promisify(conn.connect.bind(conn)); conn.execute = promisify(conn.query.bind(conn)); await connect(); try { await this.prepareFixture(conn, fixture); return await queries .map(query => async () => JSON.parse(JSON.stringify(await conn.execute(query[0], query[1])))) .reduce((a, b) => a.then(b), Promise.resolve()); } finally { await promisify(conn.end.bind(conn))(); } } }; }
}); const readFileAsync = util.promisify(fs.readFile); const rootPath = process.cwd(); let count = 0;
it('Stay attached', async function(state) { const configDir = await fsMkdtemp(path.join(os.tmpdir(), 'ndb-test-')); const frontend = await launch({ configDir: configDir, argv: ['.'], cwd: path.join(__dirname, 'assets', 'test-project'), debugFrontend: false, doNotCopyPreferences: true, appName: 'integration_test_runner', releaseFrontendFolder: state.frontendFolder, doNotProcessExit: true }); await setupHelpers(frontend); await frontend.setSetting('waitAtEnd', true); frontend.runConfiguration('atexit'); await frontend.waitForConsoleMessage('42'); const processes = await frontend.nodeProcess(); processes.sort(); assert.equal(`node -e process.once('exit', _ => console.log(42))`, processes[0]); assert.equal(`node npm run atexit`, processes[1]); const targetDestroyed = frontend.waitTargetDestroyed(2); await frontend.killProcess(`node -e process.once('exit', _ => console.log(42))`); await targetDestroyed; assert.deepStrictEqual([], await frontend.nodeProcess()); await frontend.close(); await util.promisify(removeFolder)(configDir); });
await util.promisify(removeFolder)(configDir); });
const markdownlintPromise = promisify(markdownlint); return function testForFile(test) { const detailedResults = /[/\\]detailed-results-/.test(file);
await util.promisify(removeFolder)(configDir); });
await util.promisify(removeFolder)(configDir); });
xit('run configuration', async function() { const configDir = await fsMkdtemp(path.join(os.tmpdir(), 'ndb-test-')); const frontend = await launch({ configDir: configDir, argv: ['.'], cwd: path.join(__dirname, 'assets', 'test-project'), debugFrontend: false, doNotCopyPreferences: true }); const configItem = await frontend.waitForSelector('body /deep/ .list-item'); configItem.hover(); const runButton = await frontend.waitForSelector('body /deep/ .list-item /deep/ [aria-label=Run]', { visible: true }); runButton.click(); const consoleMessage = await frontend.waitForSelector('body /deep/ .console-message-wrapper:nth-child(3) .console-message-text'); assert.equal('42', await frontend.evaluate(x => x.innerText, consoleMessage)); await frontend.close(); await util.promisify(removeFolder)(configDir); });
await util.promisify(removeFolder)(configDir); });
const invokeEmptyContextHandler = async () => { const handler = util.promisify( middy(async () => {}).use(logTimeoutMiddleware()) ) await handler({}, {}) }
const getAppleKeyByKeyId = async (keyId, cacheMaxEntries, cacheMaxAge) => { const client = jwksClient({ jwksUri: `${TOKEN_ISSUER}/auth/keys`, cache: true, cacheMaxEntries, cacheMaxAge, }); const asyncGetSigningKeyFunction = util.promisify(client.getSigningKey); let key; try { key = await asyncGetSigningKeyFunction(keyId); } catch (error) { throw new Parse.Error( Parse.Error.OBJECT_NOT_FOUND, `Unable to find matching key for Key ID: ${keyId}` ); } return key; }