diff --git a/.cache/vitest/results.json b/.cache/vitest/results.json new file mode 100644 index 0000000..a8fca10 --- /dev/null +++ b/.cache/vitest/results.json @@ -0,0 +1 @@ +{"version":"2.1.5","results":[["packages/playground:packages/playground/src/demo/index.test.js",{"duration":0,"failed":false}]]} \ No newline at end of file diff --git a/package.json b/package.json index 926896f..97974e0 100644 --- a/package.json +++ b/package.json @@ -21,11 +21,15 @@ "release": "npm run release --workspaces", "release:proof": "npx dotenv-cli -- npm run release -- -- --dry-run", "test": "vitest", + "test:observables": "vitest --project packages/observables", + "test:operators": "vitest --project packages/operators", + "test: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", diff --git a/packages/observables/vitest.config.js b/packages/observables/vitest.config.js index e3fd592..e551e50 100644 --- a/packages/observables/vitest.config.js +++ b/packages/observables/vitest.config.js @@ -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' } }); diff --git a/packages/operators/vitest.config.js b/packages/operators/vitest.config.js index 42a246b..675d747 100644 --- a/packages/operators/vitest.config.js +++ b/packages/operators/vitest.config.js @@ -1,7 +1,9 @@ -import { defineProject } from 'vitest/config'; +import { defineProject, configDefaults } from 'vitest/config'; export default defineProject({ + cacheDir: '../.cache/vitest-operators', test: { + cacheDir: '../.cache/vitest', setupFiles: ['../../setup.js'], testTimeout: 10000, environment: 'happy-dom' diff --git a/packages/playground/package.json b/packages/playground/package.json new file mode 100644 index 0000000..b50a2d1 --- /dev/null +++ b/packages/playground/package.json @@ -0,0 +1,34 @@ +{ + "name": "@rxjs-collection/playground", + "version": "1.0.12", + "description": "rxjs playground", + "license": "MIT", + "contributors": [ + { + "name": "Stephan Gerbeth", + "email": "stephan.gerbeth@gmail.com" + } + ], + "type": "module", + "main": "src/index.js", + "files": [ + "./src/*" + ], + "scripts": { + "release": "npx semantic-release", + "dev": "npx vitest" + }, + "imports": { + "#observables/*": "../observables/src/*", + "#operators/*": "../operators/src/*", + "#mocks/*": "../mocks/*" + }, + "dependencies": { + "@rxjs-collection/observables": "*", + "@rxjs-collection/operators": "*", + "rxjs": "7.8.1" + }, + "devDependencies": { + "node-fetch": "3.3.2" + } +} diff --git a/packages/playground/src/demo/index.test.js b/packages/playground/src/demo/index.test.js new file mode 100644 index 0000000..6d32614 --- /dev/null +++ b/packages/playground/src/demo/index.test.js @@ -0,0 +1,14 @@ +import { delay, from } from 'rxjs'; +import { describe, test } from 'vitest'; + +describe('playground stephan', () => { + test('basics', async () => { + const s = from([1, 2, 3, 4, 5, 6, 7, 8, 9]) + .pipe(delay(4000)) + .subscribe(e => { + console.log(e); + // s.unsubscribe(); + }); + await new Promise(done => setTimeout(done, 5000)); + }); +}); diff --git a/packages/playground/vitest.config.js b/packages/playground/vitest.config.js new file mode 100644 index 0000000..20e7167 --- /dev/null +++ b/packages/playground/vitest.config.js @@ -0,0 +1,11 @@ +import { defineProject } from 'vitest/config'; + +export default defineProject({ + cacheDir: '../.cache/vitest-playground', + test: { + cacheDir: '../.cache/vitest', + setupFiles: ['../../setup.js'], + testTimeout: 10000, + environment: 'happy-dom' + } +}); diff --git a/vitest.config.js b/vitest.config.js index 235745c..fba5d6a 100644 --- a/vitest.config.js +++ b/vitest.config.js @@ -2,6 +2,8 @@ import { defineConfig, configDefaults } from 'vitest/config'; export default defineConfig({ test: { + cacheDir: './.cache/vitest', + coverage: { provider: 'v8', reporter: ['text', 'json', 'lcov', 'html'], @@ -11,10 +13,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'] } }); diff --git a/vitest.workspace.js b/vitest.workspace.js index f62b807..cc011cb 100644 --- a/vitest.workspace.js +++ b/vitest.workspace.js @@ -1 +1,18 @@ -export default ['packages/**/vitest.config.js']; +// 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 + } + })) +]);