问:
R source() not working, but script runs fine otherwise R-4.2.2
As stated, the problem is pretty clear cut. I have an R script which cannot be run by using source() but it runs fine if I paste the entire script into the console. I have R-4.2.2, but I am unable to currently update my RStudio at the moment---although I suspect updating that might fix the issue.

Here is a small working example:

```<code>library(quantmod)
getSymbols("TQQQ")
x <- as.numeric(TQQQ$TQQQ.Close)
d <- (x[2:length(x)]-x[1:(length(x)-1)])/x[1:(length(x)-1)]
dl <- log(x[2:length(x)]/x[1:(length(x)-1)])
curPrice <- tail(x,1)
nsims <- 10^2
endPrice <- numeric()
N <- 71
</code>```

When I run the above code in console and with source(), it works fine. Then I simply add the line for (k in 1:nsims){} and it breaks!

```<code>library(quantmod)
getSymbols("TQQQ")
x <- as.numeric(TQQQ$TQQQ.Close)
d <- (x[2:length(x)]-x[1:(length(x)-1)])/x[1:(length(x)-1)]
dl <- log(x[2:length(x)]/x[1:(length(x)-1)])
curPrice <- tail(x,1)
nsims <- 10^2
endPrice <- numeric()
N <- 71
for (k in 1:nsims){}
</code>```

The above code works fine when pasted into console, but not with source().

When I first load quantmod I get the error:

Warning message: R graphics engine version 15 is not supported by this
version of RStudio. The Plots tab will be disabled until a newer
version of RStudio is installed.

So I am wondering if my source() problem has something to do with the plots tab or otherwise the graphical system?

Even if updating my RStudio fixes this issue, it still seems like something that should receive attention from the RStudio developers since it is so strange.

===

UPDATE: issue appears fixed and was due to the offending R script file being empty on local disk (and in cloud backup) but not empty in the RStudio script editor!!!

I don't totally understand how this happened. Somehow the R script file opened in RStudio was disconnected from the version on local hard disk. I think this may have been a Google Drive error as that's where the file was being saved/backed up. I can't totally figure it out though.

I updated RStudio, and then re-opened the offending R script file and it was blank!!! So that could explain why running it with source() was literally behaving like running an empty file.

Given that the source() command behaved the same in default R console and in RStudio console, I don't think it was a problem with R or RStudio. It could have been an RStudio problem with how the script editor was saving the file, but that seems unlikely. I swear I uploaded the exact same file to rstudio.cloud and it was functional there and not empty. I feel that user error with file location is the most likely and sensible error, but I swear that I checked that carefully even renaming the file and saving it. The test file that I was using in the above MWE was not empty though.

Body:
As stated, the problem is pretty clear cut. I have an R script which cannot be run by using source() but it runs fine if I paste the entire script into the console. I have R-4.2.2, but I am unable to currently update my RStudio at the moment---although I suspect updating that might fix the issue.

Here is a small working example:

library(quantmod)
getSymbols("TQQQ")
x <- as.numeric(TQQQ$TQQQ.Close)
d <- (x[2:length(x)]-x[1:(length(x)-1)])/x[1:(length(x)-1)]
dl <- log(x[2:length(x)]/x[1:(length(x)-1)])
curPrice <- tail(x,1)
nsims <- 10^2
endPrice <- numeric()
N <- 71

When I run the above code in console and with source(), it works fine. Then I simply add the line for (k in 1:nsims){} and it breaks!

library(quantmod)
getSymbols("TQQQ")
x <- as.numeric(TQQQ$TQQQ.Close)
d <- (x[2:length(x)]-x[1:(length(x)-1)])/x[1:(length(x)-1)]
dl <- log(x[2:length(x)]/x[1:(length(x)-1)])
curPrice <- tail(x,1)
nsims <- 10^2
endPrice <- numeric()
N <- 71
for (k in 1:nsims){}

The above code works fine when pasted into console, but not with source().

When I first load quantmod I get the error:

Warning message: R graphics engine version 15 is not supported by this
version of RStudio. The Plots tab will be disabled until a newer
version of RStudio is installed.

So I am wondering if my source() problem has something to do with the plots tab or otherwise the graphical system?

Even if updating my RStudio fixes this issue, it still seems like something that should receive attention from the RStudio developers since it is so strange.

===

UPDATE: issue appears fixed and was due to the offending R script file being empty on local disk (and in cloud backup) but not empty in the RStudio script editor!!!

I don't totally understand how this happened. Somehow the R script file opened in RStudio was disconnected from the version on local hard disk. I think this may have been a Google Drive error as that's where the file was being saved/backed up. I can't totally figure it out though.

I updated RStudio, and then re-opened the offending R script file and it was blank!!! So that could explain why running it with source() was literally behaving like running an empty file.

Given that the source() command behaved the same in default R console and in RStudio console, I don't think it was a problem with R or RStudio. It could have been an RStudio problem with how the script editor was saving the file, but that seems unlikely. I swear I uploaded the exact same file to rstudio.cloud and it was functional there and not empty. I feel that user error with file location is the most likely and sensible error, but I swear that I checked that carefully even renaming the file and saving it. The test file that I was using in the above MWE was not empty though.


来源: stackexchange

问:
Kubernetes service access internal service
I have 2 services

eclipse-mosquitto

golang project consumer mqtt

I'm running in kubernetes
My mosquitto service

```<code>$ kubectl describe svc mosquitto -nproduction

Name:              mosquitto
Namespace:         production
Labels:            app.kubernetes.io/instance=mosquitto
                   app.kubernetes.io/managed-by=Helm
                   app.kubernetes.io/name=mosquitto
                   helm.sh/chart=mosquitto-2.4.1
Annotations:       meta.helm.sh/release-name: mosquitto
                   meta.helm.sh/release-namespace: production
Selector:          app.kubernetes.io/instance=mosquitto,app.kubernetes.io/name=mosquitto
Type:              ClusterIP
IP Family Policy:  SingleStack
IP Families:       IPv4
IP:                10.98.173.157
IPs:               10.98.173.157
Port:              mqtt  1883/TCP
TargetPort:        mqtt/TCP
Endpoints:         10.44.0.1:1883
Port:              websocket  9090/TCP
TargetPort:        websocket/TCP
Endpoints:         10.44.0.1:9090
Session Affinity:  None
Events:            <none>
</code>```

When I try acess with a golang sub

network Error : dial tcp: lookup mosquitto on 10.96.0.10:53: read udp 10.36.0.1:49071->10.96.0.10:53: i/o timeout

Edit

I create a new VM and using docker-compose I run a mosquito, if I use external IP in my local machine it works, but if I use inside kubernetes mais golang project using a external IP don't works

Edit 2

I create demo chart using

helm create demo

After that I installed using

helm upgrade -i demo demo --values demo/values.yaml

My result

```<code>$ kubectl get pods

NAME                  READY   STATUS    RESTARTS   AGE
demo-fdf6f77b-fbb4c   1/1     Running   0          22s
</code>```

So I tested

helm test demo

My result

```<code>NAME: demo
LAST DEPLOYED: Sat Jan 14 11:20:26 2023
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE:     demo-test-connection
Last Started:   Sat Jan 14 11:20:59 2023
Last Completed: Sat Jan 14 11:21:05 2023
Phase:          Failed
NOTES:
1. Get the application URL by running these commands:
  export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=demo,app.kubernetes.io/instance=demo" -o jsonpath="{.items[0].metadata.name}")
  export CONTAINER_PORT=$(kubectl get pod --namespace default $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
  echo "Visit http://127.0.0.1:8080 to use your application"
  kubectl --namespace default port-forward $POD_NAME 8080:$CONTAINER_PORT
Error: pod demo-test-connection failed
</code>```

When I try see the logs

```<code>$ kubectl logs -f demo-test-connection
wget: bad address 'demo:80'
</code>```

I don't where I need to search

This problem occurs when I try access external services

ContentLicense: CC BY-SA 4.0

Body:
I have 2 services

eclipse-mosquitto

golang project consumer mqtt

I'm running in kubernetes
My mosquitto service

$ kubectl describe svc mosquitto -nproduction

Name:              mosquitto
Namespace:         production
Labels:            app.kubernetes.io/instance=mosquitto
                   app.kubernetes.io/managed-by=Helm
                   app.kubernetes.io/name=mosquitto
                   helm.sh/chart=mosquitto-2.4.1
Annotations:       meta.helm.sh/release-name: mosquitto
                   meta.helm.sh/release-namespace: production
Selector:          app.kubernetes.io/instance=mosquitto,app.kubernetes.io/name=mosquitto
Type:              ClusterIP
IP Family Policy:  SingleStack
IP Families:       IPv4
IP:                10.98.173.157
IPs:               10.98.173.157
Port:              mqtt  1883/TCP
TargetPort:        mqtt/TCP
Endpoints:         10.44.0.1:1883
Port:              websocket  9090/TCP
TargetPort:        websocket/TCP
Endpoints:         10.44.0.1:9090
Session Affinity:  None
Events:            <none>

When I try acess with a golang sub

network Error : dial tcp: lookup mosquitto on 10.96.0.10:53: read udp 10.36.0.1:49071->10.96.0.10:53: i/o timeout

Edit

I create a new VM and using docker-compose I run a mosquito, if I use external IP in my local machine it works, but if I use inside kubernetes mais golang project using a external IP don't works

Edit 2

I create demo chart using

helm create demo

After that I installed using

helm upgrade -i demo demo --values demo/values.yaml

My result

$ kubectl get pods

NAME                  READY   STATUS    RESTARTS   AGE
demo-fdf6f77b-fbb4c   1/1     Running   0          22s

So I tested

helm test demo

My result

NAME: demo
LAST DEPLOYED: Sat Jan 14 11:20:26 2023
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE:     demo-test-connection
Last Started:   Sat Jan 14 11:20:59 2023
Last Completed: Sat Jan 14 11:21:05 2023
Phase:          Failed
NOTES:
1. Get the application URL by running these commands:
  export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=demo,app.kubernetes.io/instance=demo" -o jsonpath="{.items[0].metadata.name}")
  export CONTAINER_PORT=$(kubectl get pod --namespace default $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
  echo "Visit http://127.0.0.1:8080 to use your application"
  kubectl --namespace default port-forward $POD_NAME 8080:$CONTAINER_PORT
Error: pod demo-test-connection failed

When I try see the logs

$ kubectl logs -f demo-test-connection
wget: bad address 'demo:80'

I don't where I need to search

This problem occurs when I try access external services


问:
Carousel between string and non-string version of package in my yarn.lock
I've had this issue for a long time and I'm finally done with it! I've got a single package in my app that, after each time yarn [install] is run it switches from the string version to the non-string version and vise versa in the yarn.lock file. If I check in the change and commit it, the next time I yarn, it switches back.

Here's the example

```<code>+ "ember-phone-input@github:cph/ember-phone-input#cph-modification":
- ember-phone-input@cph/ember-phone-input.git#cph-modification:
</code>```

Anyone know of any settings to add to package.json do end this senseless psychic damage I'm taking

Body:
I've had this issue for a long time and I'm finally done with it! I've got a single package in my app that, after each time yarn [install] is run it switches from the string version to the non-string version and vise versa in the yarn.lock file. If I check in the change and commit it, the next time I yarn, it switches back.

Here's the example

+ "ember-phone-input@github:cph/ember-phone-input#cph-modification":
- ember-phone-input@cph/ember-phone-input.git#cph-modification:

Anyone know of any settings to add to package.json do end this senseless psychic damage I'm taking


问:
Cannot read properties of undefined (reading '0') parser
can someone please look into my parser. I keep getting this error, when trying to read the columns of my .csv:

```<code>    file:///C:/DEMO/Store_Content.mjs:12
        var element = records[index]
                             ^

TypeError: Cannot read properties of undefined (reading '0')
    at file:///C:/DEMO/Store_Content.mjs:12:30
    at Parser.<anonymous> (file:///C:/DEMO/node_modules/csv-parse/lib/index.js:87:7)
    at Parser.emit (node:events:525:35)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
</code>```

I get that my 'records' is not finding anything yet, but I followed along a tutorial which did it identically and it worked for them. Cant manage to figure this out myself. Thanks in advance

```<code>dotenv.config()
import { NFTStorage, File} from "nft.storage"
import fs from 'fs'
import dotenv from 'dotenv'
import { parse } from 'csv-parse';
const STORAGE_API_KEY = process.env.API_KEY;
const CSV_PATH = 'metadata/metacsv.csv'
const IMAGE_PATH = 'Images/'

var parser = await parse({ columns: true }, async function (err, records) {
    for (let index = 0; index < 2; index++) {
        var element = records[index]

        var name = element['Contestant'];
        var description = element['Description'];
        var race = element['Race'];
        var insanity = element['Insanity']
        var personality = element['Personality']
        var style = element['Style'];
        var number = element['Number'];
        var picture_path = `${IMAGE_PATH}${number}.png`;
        var health = element['Health'];

        var attributes = createAttributes(race, health, insanity, personality, style);

        await storeAsset(name, description, attributes, picture_path);
    }
});

fs.createReadStream(CSV_PATH).pipe(parser);

function createAttributes (race, health, insanity, personality, style){
    let health_attr = JSON.parse(`{"trait_type": "Health", "value": "${health}"}`)
    let race_attr = JSON.parse(`{"trait_type": "Type", "value": "${race}"}`)
    let style_attr = JSON.parse(`{"trait_type": "Type", "value": "${style}"}`)
    let insanity_attr = JSON.parse(`{"trait_type": "Type", "value": "${insanity}"}`)
    let personality_attr = JSON.parse(`{"trait_type": "Type", "value": "${personality}"}`)
    return [health_attr, race_attr, style_attr,insanity_attr, personality_attr]
}

async function storeAsset(name, description, attributes , picture_path){
    const client = new NFTStorage({ token : STORAGE_API_KEY})
    const metadata = await client.store({
        name:`BlockchainBob ${name}`,
        description: description,
        attributes: attributes,
        image: new File(
            [await fs.promises.readFile(picture_path)],
            `${name}Photo.png`,
            { type: 'image/png'}
        ),
    })
    console.log(`${name}: ${metadata.url}`)
}
</code>```

Body:
can someone please look into my parser. I keep getting this error, when trying to read the columns of my .csv:

    file:///C:/DEMO/Store_Content.mjs:12
        var element = records[index]
                             ^

TypeError: Cannot read properties of undefined (reading '0')
    at file:///C:/DEMO/Store_Content.mjs:12:30
    at Parser.<anonymous> (file:///C:/DEMO/node_modules/csv-parse/lib/index.js:87:7)
    at Parser.emit (node:events:525:35)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

I get that my 'records' is not finding anything yet, but I followed along a tutorial which did it identically and it worked for them. Cant manage to figure this out myself. Thanks in advance

dotenv.config()
import { NFTStorage, File} from "nft.storage"
import fs from 'fs'
import dotenv from 'dotenv'
import { parse } from 'csv-parse';
const STORAGE_API_KEY = process.env.API_KEY;
const CSV_PATH = 'metadata/metacsv.csv'
const IMAGE_PATH = 'Images/'

var parser = await parse({ columns: true }, async function (err, records) {
    for (let index = 0; index < 2; index++) {
        var element = records[index]

        var name = element['Contestant'];
        var description = element['Description'];
        var race = element['Race'];
        var insanity = element['Insanity']
        var personality = element['Personality']
        var style = element['Style'];
        var number = element['Number'];
        var picture_path = `${IMAGE_PATH}${number}.png`;
        var health = element['Health'];

        var attributes = createAttributes(race, health, insanity, personality, style);

        await storeAsset(name, description, attributes, picture_path);
    }
});

fs.createReadStream(CSV_PATH).pipe(parser);

function createAttributes (race, health, insanity, personality, style){
    let health_attr = JSON.parse(`{"trait_type": "Health", "value": "${health}"}`)
    let race_attr = JSON.parse(`{"trait_type": "Type", "value": "${race}"}`)
    let style_attr = JSON.parse(`{"trait_type": "Type", "value": "${style}"}`)
    let insanity_attr = JSON.parse(`{"trait_type": "Type", "value": "${insanity}"}`)
    let personality_attr = JSON.parse(`{"trait_type": "Type", "value": "${personality}"}`)
    return [health_attr, race_attr, style_attr,insanity_attr, personality_attr]
}

async function storeAsset(name, description, attributes , picture_path){
    const client = new NFTStorage({ token : STORAGE_API_KEY})
    const metadata = await client.store({
        name:`BlockchainBob ${name}`,
        description: description,
        attributes: attributes,
        image: new File(
            [await fs.promises.readFile(picture_path)],
            `${name}Photo.png`,
            { type: 'image/png'}
        ),
    })
    console.log(`${name}: ${metadata.url}`)
}


问:
ValueError: shapes (3,105) and (3,105) not aligned: 105 (dim 1) != 3 (dim 0)
I have written a following code:
from sys import stdout

```<code>import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import scipy.stats

data = pd.read_csv("C:/Users/pallerla/Desktop/Chicken/M.csv")
M1=np.transpose(data)
X = data.values[0:3, 0:105]
len(X)

texture=pd.read_csv("C:/Users/pallerla/Desktop/Chicken/texture.csv")

y = texture.iloc[:,:].values
y1 = np.transpose(y)
len(y1)

 scipy.stats.pearsonr(X, y1)   # Pearson's r**
</code>```

when I tried to run the code it is showing an error message

```<code>ValueError: shapes (3,105) and (3,105) not aligned: 105 (dim 1) != 3 (dim 0)

scipy.stats.pearsonr(X, y)   # Pearson's r**
</code>```

So, I tried to use "y" values whoes size is (105, 3) then it show the following error:

```<code>ValueError: x and y must have the same length.
</code>```

So, should they have same length and (dim 1) == (dim 0) to correlate ?

Body:
I have written a following code:
from sys import stdout

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import scipy.stats

data = pd.read_csv("C:/Users/pallerla/Desktop/Chicken/M.csv")
M1=np.transpose(data)
X = data.values[0:3, 0:105]
len(X)

texture=pd.read_csv("C:/Users/pallerla/Desktop/Chicken/texture.csv")

y = texture.iloc[:,:].values
y1 = np.transpose(y)
len(y1)

 scipy.stats.pearsonr(X, y1)   # Pearson's r**

when I tried to run the code it is showing an error message

ValueError: shapes (3,105) and (3,105) not aligned: 105 (dim 1) != 3 (dim 0)

scipy.stats.pearsonr(X, y)   # Pearson's r**

So, I tried to use "y" values whoes size is (105, 3) then it show the following error:

ValueError: x and y must have the same length.

So, should they have same length and (dim 1) == (dim 0) to correlate ?


问:
Test an Ant Design Select component -- that's in a Form component that's in a Modal -- using Jest in a React app
I have an app that has a button when clicked it opens an Ant Design Modal that has a Form component with a Select component in it.

I need to write a unit test to select one of the options of the Select component.

Here is my Select component

```<code><Form.Item label="Select" name="select">
    <Select
        data-testid="select-field"
        placeholder="Select something"
        options={[
            { value: "option1", label: "Option 1" },
            { value: "option2", label: "Option 2" },
        ]}
    />
</Form.Item>
</code>```

I tried the following solutions but nothing worked.

```<code>it("Select an option", async () => {
  render(<App />);

  fireEvent.click(screen.getByText("Create Event"));

  // TODO: select an option
  const selectField = screen.getByRole("combobox");

  userEvent.click(selectField);
  await new Promise((r) => setTimeout(r, 200));

  expect(screen.getByText("option 1")).toBeInTheDocument();
  userEvent.click(screen.getByText("option 1"));

  await new Promise((r) => setTimeout(r, 200));
  expect(selectField.value).toBe("option1");
});
</code>```
```<code>it("Select an option", async () => {
  render(<App />);

  fireEvent.click(screen.getByText("Create Event"));

  // TODO: add value to the type
  const selectField = screen.getByRole("combobox");

  userEvent.click(selectField);
  await new Promise((r) => setTimeout(r, 200));
  expect(screen.getByText("option 1")).toBeInTheDocument();

  userEvent.selectOptions(screen.getByText("option 1"));
  await new Promise((r) => setTimeout(r, 200));
  expect(selectField.value).toBe("holiday");
});
</code>```

Body:
I have an app that has a button when clicked it opens an Ant Design Modal that has a Form component with a Select component in it.

I need to write a unit test to select one of the options of the Select component.

Here is my Select component

<Form.Item label="Select" name="select">
    <Select
        data-testid="select-field"
        placeholder="Select something"
        options={[
            { value: "option1", label: "Option 1" },
            { value: "option2", label: "Option 2" },
        ]}
    />
</Form.Item>

I tried the following solutions but nothing worked.

it("Select an option", async () => {
  render(<App />);

  fireEvent.click(screen.getByText("Create Event"));

  // TODO: select an option
  const selectField = screen.getByRole("combobox");

  userEvent.click(selectField);
  await new Promise((r) => setTimeout(r, 200));

  expect(screen.getByText("option 1")).toBeInTheDocument();
  userEvent.click(screen.getByText("option 1"));

  await new Promise((r) => setTimeout(r, 200));
  expect(selectField.value).toBe("option1");
});

it("Select an option", async () => {
  render(<App />);

  fireEvent.click(screen.getByText("Create Event"));

  // TODO: add value to the type
  const selectField = screen.getByRole("combobox");

  userEvent.click(selectField);
  await new Promise((r) => setTimeout(r, 200));
  expect(screen.getByText("option 1")).toBeInTheDocument();

  userEvent.selectOptions(screen.getByText("option 1"));
  await new Promise((r) => setTimeout(r, 200));
  expect(selectField.value).toBe("holiday");
});


问:
How to call function next() of tRPC middleware when using Passport.js?
I'm having a problem using passport.js to authenticate jwt with tRPC middleware. I tried calling thre next() function in the callback of passport.authenticate function but it doesn't seem to be working and results in the error,

{"message": "No result from middlewares - did you forget to 'return next()'?", "code": -32603}

below is my code,

```<code>const t = initTRPC.create();

const jwtMiddleware = t.middleware(async ({ ctx, next }) =>
  passport.authenticate('jwt', { session: false }, async (err) => {
    if (err) throw new TRPCError({ code: 'UNAUTHORIZED' });
    // Calling next() here doesn't seem to be working
    return next();
  })(ctx.req, ctx.res, next),
);

const authedProcedure = t.procedure.use(jwtMiddleware);
</code>```

thanks for the help in advanced!

Body:
I'm having a problem using passport.js to authenticate jwt with tRPC middleware. I tried calling thre next() function in the callback of passport.authenticate function but it doesn't seem to be working and results in the error,

{"message": "No result from middlewares - did you forget to 'return next()'?", "code": -32603}

below is my code,

const t = initTRPC.create();

const jwtMiddleware = t.middleware(async ({ ctx, next }) =>
  passport.authenticate('jwt', { session: false }, async (err) => {
    if (err) throw new TRPCError({ code: 'UNAUTHORIZED' });
    // Calling next() here doesn't seem to be working
    return next();
  })(ctx.req, ctx.res, next),
);

const authedProcedure = t.procedure.use(jwtMiddleware);

thanks for the help in advanced!


问:
TypeError: The "options.agent" property must be one of Agent-like Object, undefined, or false. Received an instance of Object
I am trying to write a simple test for logging in.

The error message:

TypeError: The "options.agent" property must be one of Agent-like Object, undefined, or false. Received an instance of Object

The test:

```<code>import { QueryClient, QueryClientProvider } from 'react-query';
import SignIn from '../SignIn';
import { setupServer } from 'msw/node'
import { render, screen, fireEvent, waitFor, waitForElementToBeRemoved } from '@testing-library/react';
import { rest } from 'msw';

// set up server to mock API login requests
let server = setupServer();
beforeAll(() => server.listen())
// afterEach(() => server.resetHandlers())
afterAll(() => server.close())

const queryClient = new QueryClient();
const onSubmit = jest.fn();

beforeEach(() => {
    //onSubmit.mockClear();
    render(
        <QueryClientProvider client={queryClient}>
            <SignIn onSuccess={onSubmit} />
        </QueryClientProvider>
    );
})

describe('SignIn Domain', () => {
    test('Successful login', async () => {

        server.use(
            rest.post('/api/Auth/Login', (req, res, ctx) => {
                return res(ctx.json([{ token: 'myToken' }]));
            }),
        );

        await waitFor(() => {
            fireEvent.change(getEmail(), {
                target: {
                    value: "myemail@gmail.com"
                }
            })
        });

        // click the button
        await waitFor(() => {
            fireEvent.click(screen.getByText('Continue'));
        });

        await waitForElementToBeRemoved(screen.getByText('Processing...'));
    )}
)}
</code>```

Test test steps should be as follows:

- Enter email

- Click Next (This will grey out and a Spinner will appear while it loads)

- Re-render page to display password entry

- Enter password

- Click Sign In

I have looked deeply but can't find a resolution to the error that I am getting. Any help would be appreciated.

Thank you.

package.json

```<code>{
  "name": "airdrop-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@fluentui/react": "^8.104.5",
    "@fluentui/react-icons": "^1.1.145",
    "@fluentui/react-icons-mdl2": "^1.3.29",
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^11.2.7",
    "@testing-library/user-event": "^12.8.3",
    "@types/d3": "^6.7.5",
    "@types/file-saver": "^2.0.5",
    "@types/filesaver": "^0.0.30",
    "@types/geojson": "^7946.0.10",
    "@types/mapbox-gl": "^2.7.10",
    "@types/node": "^12.20.55",
    "@types/react": "^17.0.52",
    "@types/react-dom": "^17.0.18",
    "@types/react-motion": "0.0.29",
    "@types/react-router-dom": "^5.3.3",
    "axios": "^0.21.4",
    "d3": "^6.7.0",
    "d3-hexbin": "^0.2.2",
    "d3-svg-legend": "^2.25.6",
    "enzyme": "^3.11.0",
    "file-saver": "^2.0.5",
    "fluent": "^0.13.0",
    "formik": "^2.2.9",
    "mapbox-gl": "^2.12.0",
    "msw": "^0.28.2",
    "react": "^17.0.2",
    "react-cookie": "^4.1.1",
    "react-dom": "^17.0.2",
    "react-map-gl": "^6.1.21",
    "react-motion": "^0.5.2",
    "react-query": "^3.39.2",
    "react-rnd": "^10.4.1",
    "react-router-dom": "^5.3.4",
    "react-scripts": "5.0.1",
    "sprintf-js": "^1.1.2",
    "typescript": "^4.9.4",
    "web-vitals": "^1.1.2",
    "yup": "^0.32.11"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "jest",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "@types/d3-hexbin": "^0.2.3",
    "@types/enzyme": "^3.10.12",
    "@types/enzyme-adapter-react-16": "^1.0.6",
    "@types/sprintf-js": "^1.1.2",
    "enzyme-adapter-react-15": "^1.4.4",
    "enzyme-adapter-react-16": "^1.15.7",
    "jest": "^29.3.1",
    "jest-environment-jsdom": "^29.3.1",
    "ts-jest": "^29.0.3",
    "whatwg-fetch": "^3.6.2"
  }
}
</code>```

Body:
I am trying to write a simple test for logging in.

The error message:

TypeError: The "options.agent" property must be one of Agent-like Object, undefined, or false. Received an instance of Object

The test:

import { QueryClient, QueryClientProvider } from 'react-query';
import SignIn from '../SignIn';
import { setupServer } from 'msw/node'
import { render, screen, fireEvent, waitFor, waitForElementToBeRemoved } from '@testing-library/react';
import { rest } from 'msw';

// set up server to mock API login requests
let server = setupServer();
beforeAll(() => server.listen())
// afterEach(() => server.resetHandlers())
afterAll(() => server.close())

const queryClient = new QueryClient();
const onSubmit = jest.fn();

beforeEach(() => {
    //onSubmit.mockClear();
    render(
        <QueryClientProvider client={queryClient}>
            <SignIn onSuccess={onSubmit} />
        </QueryClientProvider>
    );
})

describe('SignIn Domain', () => {
    test('Successful login', async () => {

        server.use(
            rest.post('/api/Auth/Login', (req, res, ctx) => {
                return res(ctx.json([{ token: 'myToken' }]));
            }),
        );

        await waitFor(() => {
            fireEvent.change(getEmail(), {
                target: {
                    value: "myemail@gmail.com"
                }
            })
        });

        // click the button
        await waitFor(() => {
            fireEvent.click(screen.getByText('Continue'));
        });

        await waitForElementToBeRemoved(screen.getByText('Processing...'));
    )}
)}

Test test steps should be as follows:

- Enter email

- Click Next (This will grey out and a Spinner will appear while it loads)

- Re-render page to display password entry

- Enter password

- Click Sign In

I have looked deeply but can't find a resolution to the error that I am getting. Any help would be appreciated.

Thank you.

package.json

{
  "name": "airdrop-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@fluentui/react": "^8.104.5",
    "@fluentui/react-icons": "^1.1.145",
    "@fluentui/react-icons-mdl2": "^1.3.29",
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^11.2.7",
    "@testing-library/user-event": "^12.8.3",
    "@types/d3": "^6.7.5",
    "@types/file-saver": "^2.0.5",
    "@types/filesaver": "^0.0.30",
    "@types/geojson": "^7946.0.10",
    "@types/mapbox-gl": "^2.7.10",
    "@types/node": "^12.20.55",
    "@types/react": "^17.0.52",
    "@types/react-dom": "^17.0.18",
    "@types/react-motion": "0.0.29",
    "@types/react-router-dom": "^5.3.3",
    "axios": "^0.21.4",
    "d3": "^6.7.0",
    "d3-hexbin": "^0.2.2",
    "d3-svg-legend": "^2.25.6",
    "enzyme": "^3.11.0",
    "file-saver": "^2.0.5",
    "fluent": "^0.13.0",
    "formik": "^2.2.9",
    "mapbox-gl": "^2.12.0",
    "msw": "^0.28.2",
    "react": "^17.0.2",
    "react-cookie": "^4.1.1",
    "react-dom": "^17.0.2",
    "react-map-gl": "^6.1.21",
    "react-motion": "^0.5.2",
    "react-query": "^3.39.2",
    "react-rnd": "^10.4.1",
    "react-router-dom": "^5.3.4",
    "react-scripts": "5.0.1",
    "sprintf-js": "^1.1.2",
    "typescript": "^4.9.4",
    "web-vitals": "^1.1.2",
    "yup": "^0.32.11"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "jest",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "@types/d3-hexbin": "^0.2.3",
    "@types/enzyme": "^3.10.12",
    "@types/enzyme-adapter-react-16": "^1.0.6",
    "@types/sprintf-js": "^1.1.2",
    "enzyme-adapter-react-15": "^1.4.4",
    "enzyme-adapter-react-16": "^1.15.7",
    "jest": "^29.3.1",
    "jest-environment-jsdom": "^29.3.1",
    "ts-jest": "^29.0.3",
    "whatwg-fetch": "^3.6.2"
  }
}


问:
Google benchmarks - Setting properties inside the constructor/ `SetUp` method
Hi I am trying to set the following Google Benchmark fixture property in the class. But it seems like the property is not getting set correctly.
Ex:

class Foo : public benchmark::Fixture {
Foo(){
  this->Iterations(10);
}

// or
void SetUp(benchmark::State& state) override {
  this->Iterations(10);
}
}
```
<p>Both didn't seem to be working. But The following works without a problem.</p>
<pre class="lang-cpp prettyprint-override"><code>class Foo : public benchmark::Fixture {
...
}
BENCHMARK_DEFINE_F(Foo, foo_run)(benchmark::State& st) {
...
}
BENCHMARK_REGISTER_F(Foo, foo_run)->Iterations(10);
</code>```

What could be the issue here? Does the macro override my values with default values?

Body:
Hi I am trying to set the following Google Benchmark fixture property in the class. But it seems like the property is not getting set correctly.
Ex:

class Foo : public benchmark::Fixture {
Foo(){
  this->Iterations(10);
}

// or
void SetUp(benchmark::State& state) override {
  this->Iterations(10);
}
}

Both didn't seem to be working. But The following works without a problem.

class Foo : public benchmark::Fixture {
...
}
BENCHMARK_DEFINE_F(Foo, foo_run)(benchmark::State& st) {
...
}
BENCHMARK_REGISTER_F(Foo, foo_run)->Iterations(10);

What could be the issue here? Does the macro override my values with default values?