Skip to content

Commit

Permalink
Merge pull request #28 from lawvs/chore/upgrade-deps
Browse files Browse the repository at this point in the history
chore: upgrade deps
  • Loading branch information
Whitewater committed Oct 31, 2023
2 parents 23a11e7 + 52e4e25 commit 90c03ba
Show file tree
Hide file tree
Showing 40 changed files with 8,935 additions and 8,769 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,22 @@ jobs:
build:
strategy:
matrix:
node-version: [16.x]
os: [ubuntu-latest]

if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
with:
version: 'latest'

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0

Expand All @@ -21,9 +21,9 @@ jobs:
version: 'latest'

- name: Use Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Install dependencies
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,22 @@ jobs:
story-book:
strategy:
matrix:
node-version: [16.x]
os: [ubuntu-latest]

if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
with:
version: 'latest'

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Install dependencies
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
9 changes: 3 additions & 6 deletions cypress/e2e/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@ const clickMocat = () => getMocatBtn().click()

export const baseTest = (target: { name: string; url: string }) =>
describe(`base on ${target.name}`, () => {
before(() => {
cy.visit(target.url)
})

beforeEach(() => {
cy.reload()
cy.visit(target.url)
cy.wait(1000)
})

it('should mocat loaded', () => {
Expand Down Expand Up @@ -68,7 +65,7 @@ export const baseTest = (target: { name: string; url: string }) =>
it('should PASS works', () => {
cy.intercept('/api/**', (req) => {
expect(req.url).to.include('/data.json')
req.reply((res) => res)
req.reply((res: unknown) => res)
}).as('api')

getFetchBtn().click()
Expand Down
1 change: 0 additions & 1 deletion examples/spa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"@vitejs/plugin-vue": "^2.3.3",
"@vitejs/plugin-vue-jsx": "^1.3.10",
"mocat": "^0.3.0",
"typescript": "^4.7.3",
"vite": "^2.9.12",
"vue-tsc": "^0.37.3"
}
Expand Down
4 changes: 0 additions & 4 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import type { Config } from '@jest/types'
import { defaults as tsjPreset } from 'ts-jest/presets'

const config: Config.InitialOptions = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
transform: {
...tsjPreset.transform,
},
clearMocks: true,
coverageDirectory: 'coverage',
moduleFileExtensions: ['js', 'json', 'ts', 'tsx'],
Expand Down
1 change: 0 additions & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"version": "0.3.0",
"npmClient": "pnpm",
"useWorkspaces": true,
"command": {
"version": {
"message": "chore(release): publish %s"
Expand Down
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,30 @@
"server-examples": "lerna run dev --parallel --scope *-example",
"test": "jest",
"test:e2e": "cypress run",
"test:e2e-ci": "start-server-and-test server-examples '3001|3002' test:e2e",
"test:e2e-ci": "WAIT_ON_TIMEOUT=10000 start-server-and-test server-examples 'tcp:3001|tcp:3002' test:e2e",
"typecheck": "lerna exec --parallel --ignore @mocat/eslint-config --ignore global-example --ignore esm-example -- tsc --noEmit --project ."
},
"devDependencies": {
"@jest/types": "^28.1.1",
"@types/jest": "^28.1.1",
"@types/node": "^17.0.42",
"@types/node-fetch": "^2.6.1",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^28.1.1",
"jest-environment-jsdom": "^28.1.1",
"lerna": "^5.1.1",
"ts-jest": "^28.0.4",
"ts-node": "^10.8.1",
"typescript": "^4.7.3"
"@jest/types": "^29.6.3",
"@types/jest": "^29.5.7",
"@types/node": "^20.8.10",
"@types/node-fetch": "^2.6.8",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"lerna": "^7.4.2",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typescript": "^5.2.2"
},
"optionalDependencies": {
"cypress": "^10.3.0",
"start-server-and-test": "^1.14.0"
"cypress": "^13.4.0",
"start-server-and-test": "^2.0.1"
},
"packageManager": "pnpm@8.8.0",
"engines": {
"node": ">=16.0.0",
"node": ">=18.0.0",
"npm": "please-use-pnpm",
"pnpm": ">=7.0.0",
"pnpm": ">=8.0.0",
"yarn": "please-use-pnpm"
}
}
3 changes: 1 addition & 2 deletions packages/eslint-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = {
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
'prettier',
],
Expand All @@ -35,7 +36,5 @@ module.exports = {
'prefer-const': 'error',
'no-console': ['warn', { allow: ['warn', 'error'] }],
'prettier/prettier': 'warn',
// fix https://github.com/yannickcr/eslint-plugin-react/issues/2834
'react/react-in-jsx-scope': 'off',
},
}
16 changes: 8 additions & 8 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
"description": "ESLint configuration",
"author": "lawvs",
"dependencies": {
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0",
"eslint": "^8.3.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.27.1",
"eslint-plugin-react-hooks": "^4.3.0",
"prettier": "^2.6.2"
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"prettier": "^3.0.3"
}
}
24 changes: 12 additions & 12 deletions packages/interceptor/src/__tests__/__snapshots__/fetch.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`snapshot test should network before event match snapshot 1`] = `
Object {
{
"pass": [Function],
"reject": [Function],
"request": Request {
Expand All @@ -11,14 +11,14 @@ Object {
"follow": 20,
"size": 0,
"timeout": 0,
Symbol(Body internals): Object {
Symbol(Body internals): {
"body": null,
"disturbed": false,
"error": null,
},
Symbol(Request internals): Object {
Symbol(Request internals): {
"headers": Headers {
Symbol(map): Object {},
Symbol(map): {},
},
"method": "GET",
"parsedURL": Url {
Expand All @@ -41,8 +41,8 @@ Object {
},
"requestType": "fetch",
"resolve": [Function],
"rule": Object {
"scenarios": Array [],
"rule": {
"scenarios": [],
"timeStamp": 0,
"type": "Register/networkRoute",
"url": "/",
Expand All @@ -53,21 +53,21 @@ Object {
`;

exports[`snapshot test should register route match snapshot 1`] = `
Object {
{
"desc": "login api",
"name": "login",
"scenarios": Array [
Object {
"scenarios": [
{
"name": "login success",
"response": Object {
"response": {
"code": 0,
"username": "admin",
},
},
Object {
{
"desc": "password incorrect",
"name": "login failure",
"response": Object {
"response": {
"code": 1,
"message": "password incorrect",
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`snapshot test event match snapshot 1`] = `
Array [
Object {
[
{
"desc": "it is a mock api",
"name": "login api",
"scenarios": Array [
Object {
"scenarios": [
{
"desc": "login success",
"name": "scenario 1",
"return": Object {
"return": {
"code": 0,
"data": Object {
"data": {
"username": "admin",
},
},
},
Object {
{
"desc": "login failure",
"error": Object {
"error": {
"code": 1,
"message": "password incorrect",
},
Expand All @@ -33,28 +33,28 @@ Array [
`;

exports[`snapshot test event match snapshot 2`] = `
Array [
Object {
[
{
"pass": [Function],
"reject": [Function],
"resolve": [Function],
"rule": Object {
"rule": {
"desc": "it is a mock api",
"name": "login api",
"scenarios": Array [
Object {
"scenarios": [
{
"desc": "login success",
"name": "scenario 1",
"return": Object {
"return": {
"code": 0,
"data": Object {
"data": {
"username": "admin",
},
},
},
Object {
{
"desc": "login failure",
"error": Object {
"error": {
"code": 1,
"message": "password incorrect",
},
Expand Down
2 changes: 1 addition & 1 deletion packages/interceptor/src/__tests__/fetch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('fetch', () => {

test('should fetch works with header', async () => {
const listener = jest.fn((payload) =>
payload.resolve({ headers: { status: 204 } })
payload.resolve({ headers: { status: 204 } }),
)
eventEmitter.on('Run/network/before', listener)
const resp = await fetch('/')
Expand Down
2 changes: 1 addition & 1 deletion packages/interceptor/src/__tests__/mockFn.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('mockAsync should works', () => {
const asyncFn = () => Promise.reject(new Error('1'))
const mockFn = mockAsyncFn()(asyncFn)
expect(await mockFn().catch((i) => i)).toEqual(
await asyncFn().catch((i) => i)
await asyncFn().catch((i) => i),
)
})
})
Expand Down
2 changes: 1 addition & 1 deletion packages/interceptor/src/__tests__/xhr.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('xhr', () => {

test('should xhr works with header', async () => {
const listener = jest.fn((payload) =>
payload.resolve({ headers: { 'Content-Type': 'application/json' } })
payload.resolve({ headers: { 'Content-Type': 'application/json' } }),
)
eventEmitter.on('Run/network/before', listener)
const xhr = await xhrRequest('/')
Expand Down

0 comments on commit 90c03ba

Please sign in to comment.