Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename projects ane examples folder #16

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,12 @@ This approach makes the E2E setup more **maintainable** and easier to serve edge
In summary, this new setup offers a more scalable, maintainable, and performant way to handle E2E testing.
By isolating environments and using NX’s powerful tools, it becomes easier to run, manage, and debug E2E tests across projects.

## Benchmarks

This repository maintains benchmarks for the certain relevant metrics.

See [detailed report](./benchmarks/benchmark.md)

## Connect with us!

- [Check out our services](https://push-based.io)
Expand Down
562 changes: 562 additions & 0 deletions benchmarks/benchmark.md

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions docs/motivation.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ P[project-e2e:e2e]:::e2e-.implicit.->E[project:build]:::build;
classDef e2e stroke:#f00
```

A common scenario would be to do `changes in the tests` multiple times and test if they pass.
For this scenario executing `nx run cli-e2e:e2e` would download **`3.27 MB`** every single task run.

### 🔫 DX

As the logic that starts and stops Verdaccio is backed into the setup script it is very hard and cumbersome to debug or even see what is going on.
Expand All @@ -211,3 +214,5 @@ This has several downsides when maintaining the code:
Developers have to manually step through the complex code to identify the problem, which slows down the development process a lot.
- The configuration for the local registry and other components is spread across different parts of the setup, adding to the complexity.
This makes it harder to ensure that the environment is correctly configured across all tests.

[Task graph opaque](./utils-e2e:e2e--task-graph_opaque.png)
Binary file added docs/utils-e2e:e2e--task-graph-idle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/utils-e2e:e2e--task-graph_opaque.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "cli-e2e-original",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "projects/cli-e2e-original/test",
"sourceRoot": "examples-e2e/cli-e2e-original/test",
"projectType": "application",
"tags": ["type:e2e", "scope:internal", "type:example"],
"implicitDependencies": ["cli", "test-utils"],
Expand Down
File renamed without changes.
15 changes: 7 additions & 8 deletions e2e/cli-e2e/README.md → examples-e2e/cli-e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,28 @@ End-to-end tests for the `cli-e2e` library.
- 🌐 `nx setup-npm-env cli-e2e`
- ▶️ start Verdaccio server
- 📑 init workspace folder
- 📦 `nx install-deps cli-e2e`
- 📦 `nx install-deps cli-e2e`
- 🧼 `nx teardown-npm-env cli-e2e`
- 🛑 stop Verdaccio server
- 🗑 delete storage folder
- 🔬 `nx run cli-e2e:e2e` - **👈 your entered command**

- _dependsOn:_ [`setup-env:cli-e2e`]
- 🧪run tests


- 🧰 `nx setup-env cli-e2e`
- _outputs:_ [`tmp/e2e/cli-e2e`] 💾
- _outputs:_ [`tmp/e2e/cli-e2e`] 💾
- 🌐 `nx setup-npm-env cli-e2e`
- start Verdaccio server
- init workspace folder
- start Verdaccio server
- init workspace folder
- 📦 `nx install-deps cli-e2e`
- 🧼 `nx teardown-npm-env cli-e2e`
- stop Verdaccio server
- delete storage folder
- stop Verdaccio server
- delete storage folder
- 🔬 `nx run cli-e2e:e2e` - **👈 your entered command**
- _dependsOn:_ [`setup-env:cli-e2e`]
- run tests


```mermaid
flowchart TB
pkg-e2e:e2e-. programmatic .->pkg-e2e:setup-npm-env;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "cli-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "projects/cli-e2e/test",
"sourceRoot": "examples-e2e/cli-e2e/test",
"projectType": "application",
"tags": ["type:e2e", "type:e2e-vi", "npm-env"],
"implicitDependencies": ["cli"],
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "cli-static-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "projects/cli-static-e2e/test",
"sourceRoot": "examples-e2e/cli-static-e2e/test",
"projectType": "application",
"tags": ["type:e2e", "type:e2e-vi", "npm-env"],
"implicitDependencies": ["cli"],
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "core-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "projects/core-e2e/test",
"sourceRoot": "examples-e2e/core-e2e/test",
"projectType": "application",
"tags": ["type:e2e", "type:e2e-vi", "npm-env"],
"implicitDependencies": ["core"],
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "models-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "projects/models-e2e/test",
"sourceRoot": "examples-e2e/models-e2e/test",
"projectType": "application",
"tags": ["type:e2e", "type:e2e-vi", "npm-env"],
"implicitDependencies": ["models"],
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "playground-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "projects/playground-e2e/test",
"sourceRoot": "examples-e2e/playground-e2e/test",
"projectType": "application",
"tags": ["type:e2e", "type:e2e-vi", "npm-env"],
"implicitDependencies": ["models", "utils", "core", "cli"],
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
{
"name": "utils-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "projects/utils-e2e/test",
"sourceRoot": "examples-e2e/utils-e2e/test",
"projectType": "application",
"tags": ["type:e2e", "type:e2e-vi", "npm-env"],
"implicitDependencies": ["utils"],
"targets": {
"lint": {},
"e2e": {
"dependsOn": [
{
"projects": "self",
"target": "setup-env",
"params": "forward"
}
],
"executor": "@nx/vite:test",
"inputs": ["default", "^production"],
"outputs": ["{options.reportsDirectory}"],
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions projects/cli/project.json → examples-projects/cli/project.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "cli",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "projects/cli/src",
"sourceRoot": "examples-projects/cli/src",
"projectType": "application",
"release": {
"version": {
Expand All @@ -18,20 +18,20 @@
"executor": "@nx/esbuild:esbuild",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/projects/cli",
"main": "projects/cli/src/index.ts",
"tsConfig": "projects/cli/tsconfig.lib.json",
"assets": ["projects/cli/*.md"],
"outputPath": "dist/examples-projects/cli",
"main": "examples-projects/cli/src/index.ts",
"tsConfig": "examples-projects/cli/tsconfig.lib.json",
"assets": ["examples-projects/cli/*.md"],
"generatePackageJson": true,
"additionalEntryPoints": ["projects/cli/src/bin.ts"],
"additionalEntryPoints": ["examples-projects/cli/src/bin.ts"],
"format": ["esm"]
}
},
"unit-test": {
"executor": "@nx/vite:test",
"outputs": ["{options.reportsDirectory}"],
"options": {
"reportsDirectory": "../../coverage/projects/cli"
"reportsDirectory": "../../coverage/examples-projects/cli"
}
}
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';

export default defineConfig({
root: __dirname,
cacheDir: '../../node_modules/.vite/projects/utils',
cacheDir: '../../node_modules/.vite/examples-projects/cli',

plugins: [nxViteTsPaths()],

Expand All @@ -20,7 +20,7 @@ export default defineConfig({
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
reporters: ['default'],
coverage: {
reportsDirectory: '../../coverage/projects/utils',
reportsDirectory: '../../coverage/examples-projects/cli',
provider: 'v8',
},
},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "core",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "projects/core/src",
"sourceRoot": "examples-projects/core/src",
"projectType": "library",
"release": {
"version": {
Expand All @@ -18,10 +18,10 @@
"executor": "@nx/esbuild:esbuild",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/projects/core",
"main": "projects/core/src/index.ts",
"tsConfig": "projects/core/tsconfig.lib.json",
"assets": ["projects/core/*.md"],
"outputPath": "dist/examples-projects/core",
"main": "examples-projects/core/src/index.ts",
"tsConfig": "examples-projects/core/tsconfig.lib.json",
"assets": ["examples-projects/core/*.md"],
"generatePackageJson": true,
"format": ["esm"]
}
Expand All @@ -30,7 +30,7 @@
"executor": "@nx/vite:test",
"outputs": ["{options.reportsDirectory}"],
"options": {
"reportsDirectory": "../../coverage/projects/core"
"reportsDirectory": "../../coverage/examples-projects/core"
}
}
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';

export default defineConfig({
root: __dirname,
cacheDir: '../../node_modules/.vite/projects/core',
cacheDir: '../../node_modules/.vite/examples-projects/core',

plugins: [nxViteTsPaths()],

Expand All @@ -20,7 +20,7 @@ export default defineConfig({
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
reporters: ['default'],
coverage: {
reportsDirectory: '../../coverage/projects/core',
reportsDirectory: '../../coverage/examples-projects/core',
provider: 'v8',
},
},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "models",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "projects/models/src",
"sourceRoot": "examples-projects/models/src",
"projectType": "library",
"release": {
"version": {
Expand All @@ -18,10 +18,10 @@
"executor": "@nx/esbuild:esbuild",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/projects/models",
"main": "projects/models/src/index.ts",
"tsConfig": "projects/models/tsconfig.lib.json",
"assets": ["projects/models/*.md"],
"outputPath": "dist/examples-projects/models",
"main": "examples-projects/models/src/index.ts",
"tsConfig": "examples-projects/models/tsconfig.lib.json",
"assets": ["examples-projects/models/*.md"],
"generatePackageJson": true,
"format": ["esm"]
}
Expand All @@ -30,7 +30,7 @@
"executor": "@nx/vite:test",
"outputs": ["{options.reportsDirectory}"],
"options": {
"reportsDirectory": "../../coverage/projects/models"
"reportsDirectory": "../../coverage/examples-projects/models"
}
}
}
Expand Down
1 change: 1 addition & 0 deletions examples-projects/models/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { type User, parseUser } from './lib/user';
14 changes: 14 additions & 0 deletions examples-projects/models/src/lib/user.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { parseUser } from './user';

describe('parseUser', () => {
it('should parse valid user', () => {
expect(parseUser({ name: 'Michael', color: 'Hotpink' })).toEqual({
name: 'Michael',
});
});
it('should parse valid user', () => {
expect(() => parseUser({ color: 'Hotpink' })).toThrow(
'Invalid user. Name is missing.'
);
});
});
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';

export default defineConfig({
root: __dirname,
cacheDir: '../../node_modules/.vite/projects/cli',
cacheDir: '../../node_modules/.vite/examples-projects/models',

plugins: [nxViteTsPaths()],

Expand All @@ -20,7 +20,7 @@ export default defineConfig({
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
reporters: ['default'],
coverage: {
reportsDirectory: '../../coverage/projects/cli',
reportsDirectory: '../../coverage/examples-projects/models',
provider: 'v8',
},
},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "utils",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "projects/utils/src",
"sourceRoot": "examples-projects/utils/src",
"projectType": "library",
"release": {
"version": {
Expand All @@ -18,10 +18,10 @@
"executor": "@nx/esbuild:esbuild",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/projects/utils",
"main": "projects/utils/src/index.ts",
"tsConfig": "projects/utils/tsconfig.lib.json",
"assets": ["projects/utils/*.md"],
"outputPath": "dist/examples-projects/utils",
"main": "examples-projects/utils/src/index.ts",
"tsConfig": "examples-projects/utils/tsconfig.lib.json",
"assets": ["examples-projects/utils/*.md"],
"generatePackageJson": true,
"format": ["esm"]
}
Expand All @@ -30,7 +30,7 @@
"executor": "@nx/vite:test",
"outputs": ["{options.reportsDirectory}"],
"options": {
"reportsDirectory": "../../coverage/projects/utils"
"reportsDirectory": "../../coverage/examples-projects/utils"
}
}
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import { sortUser } from './utils';

describe('sortUser', () => {
it('should sort a list of users', () => {
expect(sortUser([
{ name: 'Michael' },
{ name: 'Alice' },
])).toEqual([
expect(sortUser([{ name: 'Michael' }, { name: 'Alice' }])).toEqual([
{ name: 'Alice' },
{ name: 'Michael' },
]);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';

export default defineConfig({
root: __dirname,
cacheDir: '../../node_modules/.vite/projects/models',
cacheDir: '../../node_modules/.vite/examples-projects/utils',

plugins: [nxViteTsPaths()],

Expand All @@ -20,7 +20,7 @@ export default defineConfig({
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
reporters: ['default'],
coverage: {
reportsDirectory: '../../coverage/projects/models',
reportsDirectory: '../../coverage/examples-projects/utils',
provider: 'v8',
},
},
Expand Down
1 change: 0 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
}
},
"plugins": [
"./e2e-examples/cli-e2e-original/tooling/original.plugin.ts",
"@push-based/build-env",
{
"plugin": "@nx/eslint/plugin",
Expand Down
Loading
Loading