-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
124 changed files
with
8,144 additions
and
1,460 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# path to a directory with all packages | ||
storage: ../tmp/local-registry/storage | ||
|
||
auth: | ||
htpasswd: | ||
file: ./htpasswd | ||
|
||
# a list of other known repositories we can talk to | ||
uplinks: | ||
npmjs: | ||
url: https://registry.npmjs.org/ | ||
maxage: 60m | ||
|
||
packages: | ||
'**': | ||
# give all users (including non-authenticated users) full access | ||
# because it is a local registry | ||
access: $all | ||
publish: $all | ||
unpublish: $all | ||
|
||
# if package is not available locally, proxy requests to npm registry | ||
proxy: npmjs | ||
|
||
# log settings | ||
logs: | ||
type: stdout | ||
format: pretty | ||
level: http |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
test:$6FrCaT/v0dwE:autocreated 2020-03-25T19:10:50.254Z |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": ["../../.eslintrc.json"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": {} | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "audit-runner-e2e", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"implicitDependencies": ["audit-runner"], | ||
"projectType": "application", | ||
"targets": { | ||
"e2e": { | ||
"executor": "@nx/vite:test", | ||
"outputs": ["{workspaceRoot}/coverage/{e2eProjectRoot}"], | ||
"options": { | ||
"passWithNoTests": true | ||
} | ||
}, | ||
"lint": { | ||
"executor": "@nx/linter:eslint", | ||
"outputs": ["{options.outputFile}"], | ||
"options": { | ||
"lintFilePatterns": ["apps/audit-runner-e2e/**/*.{js,ts}"] | ||
} | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
apps/audit-runner-e2e/src/audit-runner/commands/user-flow.spec.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { describe, it, expect } from 'vitest'; | ||
import { execSync } from 'child_process'; | ||
|
||
import { getCliPath } from '../utils'; | ||
|
||
describe('user-flow command', () => { | ||
const cliPath = getCliPath(); | ||
const execPath = `node ${cliPath}`; | ||
|
||
function commandOutput(args: string): string { | ||
return execSync(`${execPath} ${args}`).toString() | ||
} | ||
|
||
it('should print a help message', () => { | ||
const u = commandOutput(`uf --queue local --dry-run`); | ||
expect(u).toBe(''); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { describe, it, expect } from 'vitest'; | ||
import { execSync } from 'child_process'; | ||
|
||
import { getCliPath } from '../utils'; | ||
|
||
const helpOutput = { | ||
headers: [ | ||
'audit-runner', | ||
'Commands:', | ||
'Options:', | ||
], | ||
commands: [ | ||
'audit-runner user-flow Load, Run and Store user-flow audits', | ||
], | ||
options: [ | ||
'--version Show version number', | ||
'-v, --verbose Run with verbose logging', | ||
'-h, --help Show help' | ||
] | ||
} | ||
|
||
describe('help argument', () => { | ||
const cliPath = getCliPath(); | ||
const execPath = `node ${cliPath}`; | ||
|
||
function commandOutput(args: string): string { | ||
return execSync(`${execPath} ${args}`).toString() | ||
} | ||
|
||
function expectHelpLog(commandOutput: string): void { | ||
helpOutput.headers.forEach(header => expect(commandOutput).toContain(header)); | ||
helpOutput.commands.forEach(commands => expect(commandOutput).toContain(commands)); | ||
helpOutput.options.forEach(options => expect(commandOutput).toContain(options)); | ||
} | ||
|
||
it('should print a help message', () => { | ||
expectHelpLog(commandOutput('--help')); | ||
expectHelpLog(commandOutput('--help true')); | ||
expectHelpLog(commandOutput('-h')); | ||
expectHelpLog(commandOutput('-h true')); | ||
}); | ||
it('should print a help command with and error message', () => { | ||
let errorMessage = ''; | ||
try { | ||
commandOutput(''); | ||
} catch (e) { | ||
if (e instanceof Error) { | ||
errorMessage = e.message; | ||
} | ||
} | ||
expectHelpLog(errorMessage); | ||
expect(errorMessage).toContain('Not enough non-option arguments: got 0, need at least 1'); | ||
}) | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { join } from 'node:path'; | ||
|
||
// this is a quick fix, ether implement a proper solution of fix the issue with configs | ||
export const getCliPath = (): string => { | ||
const cwd = process.cwd(); | ||
const rootPath = cwd.includes('audit-runner-e2e') ? '../../' : ''; | ||
return join(process.cwd(), rootPath, 'dist/apps/audit-runner'); | ||
}; |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"example": "Example" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"example": "Example1" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/// <reference types="vitest" /> | ||
import { defineConfig } from 'vite'; | ||
|
||
import viteTsConfigPaths from 'vite-tsconfig-paths'; | ||
|
||
export default defineConfig({ | ||
cacheDir: '../../node_modules/.vite/audit-runner-e2e', | ||
|
||
plugins: [ | ||
viteTsConfigPaths({ | ||
root: '../../', | ||
}), | ||
], | ||
|
||
// Uncomment this if you are using workers. | ||
// worker: { | ||
// plugins: [ | ||
// viteTsConfigPaths({ | ||
// root: '../../', | ||
// }), | ||
// ], | ||
// }, | ||
|
||
test: { | ||
globals: true, | ||
cache: { | ||
dir: '../../node_modules/.vitest', | ||
}, | ||
environment: 'node', | ||
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], | ||
}, | ||
}); |
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
{ | ||
"name": "audit-runner", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "apps/audit-runner/src", | ||
"projectType": "application", | ||
"targets": { | ||
"build": { | ||
"executor": "@nx/esbuild:esbuild", | ||
"outputs": ["{options.outputPath}"], | ||
"defaultConfiguration": "production", | ||
"options": { | ||
"platform": "node", | ||
"outputPath": "dist/apps/audit-runner", | ||
"format": ["esm"], | ||
"bundle": true, | ||
"main": "apps/audit-runner/src/main.ts", | ||
"tsConfig": "apps/audit-runner/tsconfig.app.json", | ||
"assets": ["apps/audit-runner/src/assets"], | ||
"generatePackageJson": true, | ||
"esbuildOptions": { | ||
"sourcemap": true, | ||
"outExtension": { | ||
".js": ".js" | ||
} | ||
} | ||
}, | ||
"configurations": { | ||
"development": {}, | ||
"production": { | ||
"esbuildOptions": { | ||
"sourcemap": false, | ||
"outExtension": { | ||
".js": ".js" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"serve": { | ||
"executor": "@nx/js:node", | ||
"defaultConfiguration": "development", | ||
"options": { | ||
"buildTarget": "audit-runner:build" | ||
}, | ||
"configurations": { | ||
"development": { | ||
"buildTarget": "audit-runner:build:development" | ||
}, | ||
"production": { | ||
"buildTarget": "audit-runner:build:production" | ||
} | ||
} | ||
}, | ||
"lint": { | ||
"executor": "@nx/linter:eslint", | ||
"outputs": ["{options.outputFile}"], | ||
"options": { | ||
"lintFilePatterns": ["apps/audit-runner/**/*.ts"] | ||
} | ||
}, | ||
"test": { | ||
"executor": "@nx/vite:test", | ||
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"], | ||
"options": { | ||
"passWithNoTests": true | ||
}, | ||
"configurations": { | ||
"ci": { | ||
"ci": true, | ||
"codeCoverage": true | ||
} | ||
} | ||
} | ||
}, | ||
"tags": [] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Options } from 'yargs'; | ||
|
||
export const dryRun: Options = { | ||
default: false, | ||
type: 'boolean' | ||
} | ||
|
||
export interface DryRunOption { | ||
dryRun?: boolean; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { DryRunOption, dryRun } from './dry-run'; | ||
import { HelpOption, help } from './help'; | ||
import { ShutdownOption, shutdown } from './shutdown'; | ||
import { VerboseOption, verbose } from './verbose'; | ||
|
||
export type GlobalOptions = DryRunOption & HelpOption & ShutdownOption & VerboseOption; | ||
export { dryRun, help, shutdown, verbose }; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Options } from 'yargs'; | ||
|
||
export const help: Options = { | ||
alias: 'h', | ||
default: false, | ||
type: 'boolean' | ||
} | ||
|
||
export interface HelpOption { | ||
help: boolean; | ||
h: boolean; | ||
} |
Oops, something went wrong.