Skip to content

Commit 108ec3e

Browse files
authored
feat: add .hasTag(), .matches(), and .broadcast() (#41)
- `.broadcast()`, to send an event to all of the machines, allowing you to not use `autoforward` - `.hasTag()` will call against all the cached state objects (stopping at the first successful one) - `.matches()` will call against all the cached state objects (stopping at the first successful one) **NOTE**: Not a breaking change because the public API didn't meaningfully shift, but the internals of `xstate-component-tree` have been **significantly changed** in this release. Instead of invoking a new `ComponentTree` class for every child machine it now tracks them all without any need for recursion or new class instances. Should be a bit lighter at run-time as a result.
1 parent f82158c commit 108ec3e

20 files changed

+1444
-385
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ jobs:
4444
- name: npm install
4545
run: npm ci
4646

47-
- name: npm build
48-
run: npm run build --if-present
49-
5047
- name: test
5148
run: npm test
5249
env:
@@ -55,10 +52,12 @@ jobs:
5552
# Run codecov after all builds, and only on a single environment
5653
- name: Gather Coverage
5754
if: matrix.os == 'ubuntu-latest' && matrix.node-version == 16
58-
run: npm test -- --ci --coverage
55+
run: npm run test:coverage
56+
57+
- name: Create Coverage Report
58+
if: matrix.os == 'ubuntu-latest' && matrix.node-version == 16
59+
run: npm run test:report
5960

6061
- name: Upload Coverage
6162
uses: codecov/codecov-action@v2
6263
if: matrix.os == 'ubuntu-latest' && matrix.node-version == 16
63-
with:
64-
files: ./coverage/coverage-final.json

.vscode/launch.json

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,26 @@
55
"version": "0.2.0",
66
"configurations": [
77
{
8-
"type": "node",
9-
"request": "launch",
10-
"name": "Jest All",
11-
"program": "${workspaceFolder}/node_modules/.bin/jest",
12-
"args": ["--runInBand"],
13-
"console": "integratedTerminal",
14-
"internalConsoleOptions": "neverOpen",
15-
"disableOptimisticBPs": true,
16-
"windows": {
17-
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
18-
}
8+
"type": "pwa-node",
9+
"request": "launch",
10+
"name": "Run uvu",
11+
"console": "integratedTerminal",
12+
"skipFiles": [
13+
"<node_internals>/**"
14+
],
15+
"program": "${workspaceFolder}/node_modules/uvu/bin.js",
16+
"args": ["tests"],
1917
},
2018
{
21-
"type": "node",
22-
"request": "launch",
23-
"name": "Jest Current File",
24-
"program": "${workspaceFolder}/node_modules/.bin/jest",
25-
"args": [
26-
"${fileBasenameNoExtension}",
27-
"--config",
28-
"jest.config.js"
29-
],
30-
"console": "integratedTerminal",
31-
"internalConsoleOptions": "neverOpen",
32-
"disableOptimisticBPs": true,
33-
"windows": {
34-
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
35-
}
19+
"type": "pwa-node",
20+
"request": "launch",
21+
"name": "Run uvu (current file)",
22+
"console": "integratedTerminal",
23+
"skipFiles": [
24+
"<node_internals>/**"
25+
],
26+
"program": "${workspaceFolder}/node_modules/uvu/bin.js",
27+
"args": ["tests", "${fileBasenameNoExtension}"]
3628
}
37-
]
29+
]
3830
}

0 commit comments

Comments
 (0)