-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGES: - migrate to esm requires user-flows to be .mts instead of .ts - migration to v11 means budgets are no longer supported
- Loading branch information
Showing
280 changed files
with
23,026 additions
and
34,851 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 |
---|---|---|
|
@@ -39,7 +39,9 @@ testem.log | |
.DS_Store | ||
Thumbs.db | ||
|
||
.nx/cache | ||
.nx | ||
|
||
.env | ||
.code-pushup | ||
|
||
examples/**/measures/* |
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 |
---|---|---|
|
@@ -3,4 +3,5 @@ | |
/dist | ||
/coverage | ||
|
||
/.nx/cache | ||
/.nx/cache | ||
/.nx/workspace-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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# path to a directory with all packages | ||
storage: ../tmp/local-registry/storage | ||
|
||
# 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 | ||
log: | ||
type: stdout | ||
format: pretty | ||
level: warn | ||
|
||
publish: | ||
allow_offline: true # set offline to true to allow publish offline |
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
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,21 @@ | ||
// @ts-ignore // This is a mock file! | ||
import { UserFlowContext, UserFlowInteractionsFn, UserFlowProvider } from '@push-based/user-flow'; | ||
|
||
const interactions: UserFlowInteractionsFn = async (ctx: UserFlowContext): Promise<any> => { | ||
const { flow, collectOptions } = ctx; | ||
const { url } = collectOptions; | ||
|
||
await flow.navigate(url, { | ||
name: `Navigate to ${url}`, | ||
}); | ||
|
||
// ℹ Tip: | ||
// Read more about the other measurement modes here: | ||
// https://github.com/push-based/user-flow/blob/main/packages/cli/docs/writing-basic-user-flows.md | ||
|
||
}; | ||
|
||
export default { | ||
flowOptions: {name: 'Basic Navigation Example'}, | ||
interactions | ||
} satisfies UserFlowProvider; |
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,25 @@ | ||
{ | ||
"name": "cli-e2e", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "e2e/cli-e2e/src", | ||
"projectType": "application", | ||
"targets": { | ||
"lint": { | ||
"executor": "@nx/linter:eslint", | ||
"outputs": ["{options.outputFile}"], | ||
"options": { | ||
"lintFilePatterns": ["e2e/cli-e2e/**/*.ts"] | ||
} | ||
}, | ||
"test": { | ||
"executor": "@nx/vite:test", | ||
"options": { | ||
"config": "e2e/cli-e2e/vite.config.e2e.mts" | ||
} | ||
} | ||
}, | ||
"implicitDependencies": [ | ||
"cli" | ||
], | ||
"tags": ["type:e2e"] | ||
} |
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,135 @@ | ||
import { afterAll, beforeAll, beforeEach, afterEach } from 'vitest'; | ||
|
||
import { cpSync, mkdirSync, rmSync, writeFileSync } from 'node:fs'; | ||
import { join, normalize, sep } from 'node:path'; | ||
|
||
import { CliTest, E2E_DIR, normalizePath } from './utils/setup'; | ||
import { spawn } from 'node:child_process'; | ||
|
||
const ANSI_ESCAPE_REGEX = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g; | ||
|
||
function filePath(p: string): string { | ||
const paths = normalizePath(p).split(sep); | ||
return paths.splice(0, paths.length - 1).join(); | ||
} | ||
|
||
beforeAll((ctx) => { | ||
mkdirSync(join(E2E_DIR, filePath(ctx.name)), { recursive: true }); | ||
}); | ||
|
||
beforeEach<CliTest>((ctx) => { | ||
ctx.root = join(E2E_DIR, filePath(ctx.task.file.name), normalizePath(join(ctx.task.suite.name, ctx.task.name))); | ||
|
||
ctx.setupFns = { | ||
setupRcJson: (rc: {}, rcName= `.user-flowrc.json`) => { | ||
writeFileSync( | ||
join(ctx.root, rcName), | ||
JSON.stringify(rc, null, 4), | ||
{ encoding: 'utf8' } | ||
); | ||
}, | ||
setupUserFlows: (mockUserFlow: string, userFlowDir = 'user-flows') => { | ||
cpSync(mockUserFlow, join(ctx.root, userFlowDir, normalize(mockUserFlow).split(sep).at(-1))) | ||
} | ||
} | ||
|
||
mkdirSync(ctx.root, { recursive: true }); | ||
}); | ||
|
||
export type CliProcessResult = { | ||
stdout: string; | ||
stderr: string; | ||
code: number | null; | ||
} | ||
|
||
beforeEach<CliTest>((ctx) => { | ||
ctx.cli = {} as any; | ||
ctx.cli.stdout = ''; | ||
ctx.cli.stderr = ''; | ||
ctx.cli.code = null; | ||
|
||
|
||
ctx.cli.run = (command: string, args: string[] = [], waitForClose = true) => new Promise<CliProcessResult>((resolve) => { | ||
ctx.cli.process = spawn(command, args, { stdio: 'pipe', shell: true, cwd: ctx.root }); | ||
|
||
ctx.cli.process.stdout.on('data', (data) => { | ||
const stdout = String(data).replace(ANSI_ESCAPE_REGEX, ''); | ||
|
||
if (ctx.cli.verbose) { | ||
console.log(stdout); | ||
} | ||
|
||
ctx.cli.stdout += stdout; | ||
}); | ||
|
||
|
||
ctx.cli.process.stderr.on('data', (data) => { | ||
const stderr = String(data).replace(ANSI_ESCAPE_REGEX, ''); | ||
|
||
if (ctx.cli.verbose) { | ||
console.log(stderr); | ||
} | ||
|
||
ctx.cli.stderr += stderr; | ||
}); | ||
|
||
|
||
ctx.cli.process.on('close', code => { | ||
ctx.cli.code = code; | ||
|
||
if (ctx.cli.verbose) { | ||
console.log(code); | ||
} | ||
|
||
resolve({ | ||
stdout: ctx.cli.stdout, | ||
stderr: ctx.cli.stderr, | ||
code: ctx.cli.code | ||
}); | ||
}); | ||
|
||
if (!waitForClose) { | ||
resolve({ | ||
stdout: ctx.cli.stdout, | ||
stderr: ctx.cli.stderr, | ||
code: ctx.cli.code | ||
}); | ||
} | ||
}); | ||
|
||
ctx.cli.waitForStdout = (expectedStdout: string) => { | ||
return new Promise((resolve) => { | ||
ctx.cli.process.stdout.on('data', (data) => { | ||
const stdout = String(data).replace(ANSI_ESCAPE_REGEX, ''); | ||
if (stdout.includes(expectedStdout)) { | ||
resolve(); | ||
} | ||
}); | ||
}); | ||
}; | ||
|
||
ctx.cli.waitForClose = () => { | ||
return new Promise((resolve) => { | ||
ctx.cli.process.on('close', (code) => { | ||
ctx.cli.code = code; | ||
resolve({ | ||
stdout: ctx.cli.stdout, | ||
stderr: ctx.cli.stderr, | ||
code: ctx.cli.code | ||
}); | ||
}); | ||
}); | ||
}; | ||
|
||
ctx.cli.type = (inputs: string) => { | ||
ctx.cli.process.stdin.write(inputs); | ||
}; | ||
}); | ||
|
||
afterEach<CliTest>((ctx) => { | ||
rmSync(ctx.root, { recursive: true }); | ||
}); | ||
|
||
afterAll((ctx) => { | ||
rmSync(join(E2E_DIR, filePath(ctx.name)), { recursive: true }); | ||
}); |
Oops, something went wrong.