Skip to content

Commit 3b3a562

Browse files
authored
Merge pull request #1706 from reduxjs/feature/listener-middleware-enhancements
2 parents eaee744 + 2dd9d01 commit 3b3a562

File tree

12 files changed

+933
-1390
lines changed

12 files changed

+933
-1390
lines changed

.github/workflows/listenerTests.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: CI
2+
on: [push, pull_request]
3+
4+
jobs:
5+
build:
6+
name: Test Listener Middleware on Node ${{ matrix.node }}
7+
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
node: ['14.x']
12+
13+
steps:
14+
- name: Checkout repo
15+
uses: actions/checkout@v2
16+
17+
- name: Use node ${{ matrix.node }}
18+
uses: actions/setup-node@v2
19+
with:
20+
node-version: ${{ matrix.node }}
21+
cache: 'yarn'
22+
23+
- name: Install deps
24+
run: yarn install
25+
26+
# The middleware apparently needs RTK built first for tests to compile (?!?)
27+
- name: Build RTK
28+
run: cd packages/toolkit && yarn build
29+
30+
- name: Run action listener tests
31+
run: cd packages/action-listener-middleware && yarn test

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"build:examples": "yarn workspaces foreach --include '@reduxjs/*' --include '@examples-query-react/*' -vtp run build",
4747
"build:docs": "yarn workspace website run build",
4848
"build:packages": "yarn workspaces foreach --include '@reduxjs/*' --include '@rtk-query/*' --include '@rtk-incubator/*' --topological-dev run build",
49-
"test:packages": "yarn workspaces foreach --include '@reduxjs/*' --include '@rtk-query/*' run test",
49+
"test:packages": "yarn workspaces foreach --include '@reduxjs/*' --include '@rtk-query/*' --include '@rtk-incubator/*' run test",
5050
"dev:docs": "yarn workspace website run start"
5151
}
5252
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
dist
22
node_modules
3-
yarn-error.log
3+
yarn-error.log
4+
coverage
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = {
2+
testMatch: ['<rootDir>/src/**/*.(spec|test).[jt]s?(x)'],
3+
moduleNameMapper: {
4+
'^@reduxjs/toolkit$': '<rootDir>/../toolkit/src/index.ts', // @remap-prod-remove-line
5+
},
6+
preset: 'ts-jest',
7+
globals: {
8+
'ts-jest': {
9+
tsconfig: 'tsconfig.test.json',
10+
diagnostics: {
11+
ignoreCodes: [6133],
12+
},
13+
},
14+
},
15+
}

packages/action-listener-middleware/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"url": "https://phryneas.de/"
88
},
99
"license": "MIT",
10-
"type": "module",
1110
"source": "src/index.ts",
1211
"exports": "./dist/index.modern.js",
1312
"main": "./dist/index.cjs",
@@ -17,15 +16,20 @@
1716
"scripts": {
1817
"build": "rimraf dist && microbundle",
1918
"dev": "microbundle watch",
20-
"prepublishOnly": "yarn build"
19+
"prepublishOnly": "yarn build",
20+
"test": "jest --runInBand"
2121
},
2222
"peerDependencies": {
2323
"@reduxjs/toolkit": "^1.6.0"
2424
},
2525
"devDependencies": {
2626
"@reduxjs/toolkit": "^1.6.0",
27+
"@types/jest": "^24.0.11",
28+
"@types/node": "^10.14.4",
29+
"jest": "^26.6.3",
2730
"microbundle": "^0.13.3",
2831
"rimraf": "^3.0.2",
32+
"ts-jest": "^26.5.5",
2933
"typescript": "^4.3.4"
3034
},
3135
"publishConfig": {

0 commit comments

Comments
 (0)