Skip to content

Commit

Permalink
Merge pull request #105 from basics/feature/optimization
Browse files Browse the repository at this point in the history
Feature/optimization
  • Loading branch information
StephanGerbeth authored Nov 28, 2024
2 parents 244685f + 5511ec7 commit 87cebfe
Show file tree
Hide file tree
Showing 12 changed files with 179 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules

/coverage
/.github_old
/.cache
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"formulahendry.auto-rename-tag",
"naumovs.color-highlight",
"humao.rest-client",
"techer.open-in-browser"
"techer.open-in-browser",
"vitest.explorer"
]
}
128 changes: 125 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@
"release": "npm run release --workspaces",
"release:proof": "npx dotenv-cli -- npm run release -- -- --dry-run",
"test": "vitest",
"test:ui": "vitest --ui",
"test:project:observables": "vitest --project packages/observables",
"test:project:operators": "vitest --project packages/operators",
"test:project:playground": "vitest --project packages/playground",
"coverage": "vitest run --coverage"
},
"workspaces": [
"packages/operators",
"packages/observables"
"packages/observables",
"packages/playground"
],
"devDependencies": {
"@commitlint/config-conventional": "19.6.0",
Expand All @@ -36,21 +41,22 @@
"@semantic-release/npm": "12.0.1",
"@semantic-release/release-notes-generator": "14.0.1",
"@vitest/coverage-v8": "2.1.5",
"@vitest/eslint-plugin": "1.1.10",
"@vitest/ui": "^2.1.5",
"commitlint": "19.6.0",
"eslint": "9.15.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-no-secrets": "1.1.2",
"eslint-plugin-perfectionist": "4.0.3",
"eslint-plugin-prettier": "5.2.1",
"eslint-plugin-security": "3.0.1",
"@vitest/eslint-plugin": "1.1.10",
"fetch-mock": "12.2.0",
"happy-dom": "15.11.6",
"husky": "9.1.7",
"lint-staged": "15.2.10",
"prettier": "3.3.3",
"semantic-release": "24.2.0",
"semantic-release-monorepo": "8.0.2",
"vitest": "2.1.5"
"vitest": "^2.1.5"
}
}
3 changes: 3 additions & 0 deletions packages/observables/vitest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { defineProject } from 'vitest/config';

export default defineProject({
cacheDir: '../.cache/vitest-observables',
test: {
cacheDir: '../.cache/vitest',
setupFiles: ['../../setup.js'],
environment: 'happy-dom'
}
});
2 changes: 2 additions & 0 deletions packages/operators/vitest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { defineProject } from 'vitest/config';

export default defineProject({
cacheDir: '../.cache/vitest-operators',
test: {
cacheDir: '../.cache/vitest',
setupFiles: ['../../setup.js'],
testTimeout: 10000,
environment: 'happy-dom'
Expand Down
6 changes: 5 additions & 1 deletion packages/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"./src/*"
],
"scripts": {
"release": "npx semantic-release"
"release": "npx semantic-release",
"dev": "npx vitest"
},
"imports": {
"#observables/*": "../observables/src/*",
Expand All @@ -26,5 +27,8 @@
"@rxjs-collection/observables": "*",
"@rxjs-collection/operators": "*",
"rxjs": "7.8.1"
},
"devDependencies": {
"node-fetch": "3.3.2"
}
}
12 changes: 9 additions & 3 deletions packages/playground/src/demo/index.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import { from } from 'rxjs';
import { delay, from } from 'rxjs';
import { describe, test } from 'vitest';

describe('playground stephan', () => {
test('basics', () => {
from([1, 2, 3]).subscribe(e => console.log(e));
test('basics', async () => {
const s = from([1, 2, 3, 4, 5, 6, 7, 8, 9])

Check warning on line 6 in packages/playground/src/demo/index.test.js

View workflow job for this annotation

GitHub Actions / Install (ubuntu-latest, 20)

's' is assigned a value but never used
.pipe(delay(4000))
.subscribe(e => {
console.log(e);

Check warning on line 9 in packages/playground/src/demo/index.test.js

View workflow job for this annotation

GitHub Actions / Install (ubuntu-latest, 20)

Unexpected console statement
// s.unsubscribe();
});
await new Promise(done => setTimeout(done, 5000));
});
});
2 changes: 2 additions & 0 deletions packages/playground/vitest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { defineProject } from 'vitest/config';

export default defineProject({
cacheDir: '../.cache/vitest-playground',
test: {
cacheDir: '../.cache/vitest',
setupFiles: ['../../setup.js'],
testTimeout: 10000,
environment: 'happy-dom'
Expand Down
1 change: 1 addition & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ sonar.organization=basics
sonar.cpd.exclusions=./packages/**/*.test.js
sonar.javascript.lcov.reportPaths=./coverage/lcov.info
sonar.test.inclusions=**/*.test.js
sonar.coverage.exclusions=vitest.workspace.js

# This is the name and version displayed in the SonarCloud UI.
#sonar.projectName=rxjs-collection
Expand Down
7 changes: 4 additions & 3 deletions vitest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { defineConfig, configDefaults } from 'vitest/config';

export default defineConfig({
test: {
cacheDir: './.cache/vitest',
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'lcov', 'html'],
Expand All @@ -11,10 +12,10 @@ export default defineConfig({
'commitlint.config.js',
'eslint.ignores.js',
'vitest.workspace.js',
'./packages/observables/src/index.js',
'./packages/operators/src/index.js'
'./packages/mocks/',
'./packages/*/src/index.js'
]
},
include: ['**/packages/**/*.test.js']
include: ['./packages/**/*.test.js']
}
});
17 changes: 16 additions & 1 deletion vitest.workspace.js
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
export default ['packages/**/vitest.config.js'];
import { readFileSync } from 'node:fs';
import { defineWorkspace } from 'vitest/config';

const pkg = JSON.parse(readFileSync('./package.json', 'utf-8'));

export default defineWorkspace([
...pkg.workspaces
.filter(name => !['scripts'].includes(name))
.map(name => ({
extends: `./${name}/vitest.config.js`,
test: {
root: `./${name}`,
name
}
}))
]);

0 comments on commit 87cebfe

Please sign in to comment.