This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// noinspection JSVoidFunctionReturnValueUsed | |
import * as http from 'http'; | |
import {IncomingMessage, ServerResponse} from 'http'; | |
import isEqual from 'lodash'; | |
import type {TestFixture} from 'playwright/test'; | |
import {test as base} from 'playwright/test'; | |
import type {Expectation, ExpectationMatch, MatchingExpectation, MockApiRequestFixturesOptions, MockApiRequestFn} from '../types'; | |
const {isEqual: isDeepEqual} = isEqual; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable no-console */ | |
// Note: a first version of if was using Typescript and was launched using ts-node, but it took 1-2 additional seconds | |
// to start, which is noticeable when we want tests to start as fast as possible. So it has been reverted to JS. | |
import {execSync} from 'child_process'; | |
import * as http from 'http'; | |
const COMMON_BACKEND_ROUTES = ['/api', /* ... */]; | |
function startProxy(proxyPort, appPortForTests, backendPortForTests, apiPrefixes) { | |
const requestPrefixes = apiPrefixes.split(','); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function buildLanguageBattleChart({battleData, containerEl, oldLanguage, newLanguage}) { | |
const dates = battleData.map(d => d.date); | |
const newLanguageFiles = battleData.map(d => d.newLanguageFiles); | |
const oldLanguageFiles = battleData.map(d => d.oldLanguageFiles); | |
const filesRatios = battleData.map(d => d.filesRatio * 100); | |
const canvas = document.createElement('canvas'); | |
canvas.style = 'width: 600px; height: 400px'; | |
containerEl.appendChild(canvas); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function buildSimpleLineChart({data, containerEl, title, xField, yField, xTitle, yTitle}) { | |
const xs = data.map(d => d[xField]); | |
const ys = data.map(d => d[yField]); | |
const canvas = document.createElement('canvas'); | |
canvas.style = 'width: 600px; height: 400px'; | |
containerEl.appendChild(canvas); | |
return new Chart(canvas, { | |
data: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## | |
# Outputs the top 10 committers on the provided area, for the period provided, | |
# based on the number of commits, in the form of 4 columns: | |
# Lines added, Lines deleted, Number of commits, Author | |
# (This allows for easily re-sorting the output by piping it into `sort -nr -k COLUMN_NUMBER`) | |
# | |
# Tip: replace tabs with commas everywhere below to output valid CSV content. | |
## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.malt.architecture.libfreelancer | |
import com.malt.architecture.shouldNotDependOnModulesOfOtherGroups | |
import org.junit.jupiter.api.Tag | |
import org.junit.jupiter.api.Test | |
@Tag("lib-freelancer") | |
internal class CheckFreelancerLibsDependenciesTest { | |
@Test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Specifies a command to be executed with some arguments. | |
* | |
* For a better development experience, this class must be extended to ensure each command has | |
* an specification type, and must define the queue name via: | |
* - either a static field (for Java classes) named "COMMAND_NAME", | |
* - or a companion object's property (for Kotlin classes) named "COMMAND_NAME". | |
*/ | |
abstract class CommandSpecification( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class ExecutionPolicy( | |
/** How many processes (coroutines, really) to run in parallel. */ | |
val concurrency: Int, | |
/** | |
* How much time to wait before processing a command specification/scheduled task. | |
* | |
* Consequently, that time is the window during which tasks are subject to deduplication. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commandScheduler.scheduleSequence( | |
CommandSpec1(argA, argB), | |
CommandSpec2(), | |
CommandSpec3(argC) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CommandQueue(...) { | |
// ... | |
override fun schedule(command: CommandSpecification) { | |
// add task to queue, log details, emit metrics | |
schedule(ScheduledTask( | |
command, | |
queueName, | |
clock, | |
// this is the important part for deduplication to work |
NewerOlder