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 no-console: 0 */ | |
const axios = require("axios"); | |
const chalk = require("chalk"); | |
const KEYCLOAK_BASE_URL = process.env.DEMO | |
? "http://keycloak_iam:9090" | |
: "http://localhost:9090"; | |
const CLIENT_NAME = "sva"; | |
const CLIENT_ROLES = ["ROLE_DEP_ADMIN", "ROLE_DEP_GENERAL"]; |
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
stage ('Cypress'){ | |
parallel { | |
stage('Cypress 1') { | |
agent { | |
node { | |
label 'agent-1' | |
} | |
} | |
steps { | |
sh 'npm install --silent' |
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
# Set environment variables | |
export PORT=4000 | |
export PROFILER=true | |
export OUTPUT_DIR="profiles/$(date +%s)" | |
# Leverage pm2 to start server on specific port: | |
pm2 start npm --name server-profiler -- start | |
# Wait for server to start and then ping with post request to run campaign | |
npx wait-on http://localhost:4000 |
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
import express from 'express'; | |
import { ... } from './utils' | |
import Profiler from './Profiler' | |
// Create a profiler | |
const profiler = new Profiler({ | |
active: !!process.env.PROFILER, | |
title: new Date.getTime(), | |
outputDir: process.env.OUTPUT_DIR | |
}); |
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
import fs from 'fs'; | |
import v8profiler from 'v8-profiler-next'; | |
export class Profiler { | |
constructor(options) { | |
const { title, active, outputDir } = options; | |
this.title = title; | |
this.active = active; | |
this.outputDir = outputDir; | |
} |
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
{ | |
"scripts": { | |
"start": "node ./src/index.js", | |
"profile": "sh ./scripts/profile.sh" | |
} | |
} |
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
{ | |
"scripts": { | |
"start": "node ./src/index.js" | |
} | |
} |
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
import express from 'express'; | |
import { | |
simpleCalculation, | |
complexCalculation | |
} from './utils' | |
// Set up app | |
const app = express(); | |
const port = process.env.PORT ?? 8080; |