text:
Support vLLM

Exception: n=1 was passed to generate but the LLM VLLM
Params: {} does not support it. Raise an issue if you want support for {llm}.

Following the instructions from the exception.

Thank you for raising this and we are working on adding the feature to support this. Are you using this https://github.com/vllm-project/vllm directly or via huggingface?
Also, another thing to keep in mind is that all the tests have been done with openai so other opensource models might perform differently, which models are you considering using?

@sam-h-bean made a PR for this https://github.com/explodinggradients/ragas/pull/118

authors: ishaan-jaff jjmachan sam-h-bean

repo: explodinggradients/ragas


text:
Fix activation lookup with Python 3.12.3

Description

We used the metaclass EnumMeta/EnumType to override reporting of missing enum values (to give the full set of supported activations). However, in Python 3.12.3, the default value of the name parameter of EnumType.__call__ method was changed from None to _not_given:
https://github.com/python/cpython/commit/d771729679d39904768f60b3352e02f5f491966c
Even though this is a public API (which now uses a private default value), it seems too risky to continue using it. So in this change, we implement Enum.__mising__ instead for the improved error reporting.
Checklist

[x] I confirm that I have the right to submit this contribution under the project's MIT license.

LGTM! Is there a unit test for this behaviour?

Not yet, but it sounds good to have this. I'll do a PR for that after getting new releases for 2.0.x and 1.3.x out.

source: gharchive/pull-request

repo: explosion/curated-transformers

license: MIT

license_type: permissive

license_source: github-api


text:
Glue results

We're getting close to being able to put together a complete Glue run. The only task we can't support yet are the regression tasks. It should be a simple change, but I haven't gotten around to it yet. In the meantime, I'll update this thread with a log of experiments. All results refer to the development set. I'm running everything on a single Tesla V100.
xlnet-cased-base

softmax_class_vector model architecture
Learning rate of 0.001 for the output weights
Learning rate of 2e-5 for the transformer
Linear learning rate decay
Variable number of steps per task

MNLI
I stopped this after 2 epochs as it was taking a long time. It was at around 84.4%.
SST-2
Accuracy varies a lot here, but my best checkpoints are up around 94.5%. Not sure whether the same performance will carry over to the test set, as I'm check-pointing often and cherry-picking the best ones.
QQP
This is currently training. I set a batch size of 128 and 10 epochs because the dataset is large. Currently at 89.8%, and still training. Oops, that was the BERT model! Anyway, accuracies on this task aren't very spread out: everyone gets to about 90%, which I think is the noise ceiling. I'll run this last because it's expensive and uninformative.
RTE
My best runs have gotten to around 72% on the dev set.
QNLI
My first run has gotten to 89.8%.
bert-uncased-base
Unfortunately the BERT base models were trained with the original masking strategy, which did not guarantee that whole words were masked together. This problem makes the masking less effective, because the training objective becomes easier than it should be. It'd be cool to try fine-tuning to correct this.
Currently Devlin has only released whole-word masked models for BERT large :(. This is a shame as IMO the base models are much more useful.
As expected, the bert-uncased-base model performs quite a lot worse than the xlnet-cased-base model. If a whole-word-masked BERT model is released I think it would be interesting to look at, but until then I think we should focus on the XLNet model.
Current conclusions

xlnet-cased-base is getting us about the same Glue accuracies as the original BERT large. Nice!
Setting different learning rates for the output layer and the transformer is definitely recommended.
Better unfreezing schedules, learning rate schedules etc will probably be quite effective. There seems to be a lot of low-hanging-fruit in the optimization strategy.
Our scores are pretty good, so the wrapper library can't be doing all that much wrong in terms of the preprocessing?

Trying to put together a run with a single set of hyper-parameters. See here: https://github.com/explosion/spacy-pytorch-transformers/pull/36/ . Current dev scores:

Model
CoLa
SST-2
MRPC
STS-B
QQP
MNLI-m
MNLI-mm
QNLI
RTE
WNLI

xlnet-base-cased
60.0
94.6

70.8

source: gharchive/issue

repo: explosion/spacy-pytorch-transformers


text:
[update] Throw if useClassicUpdates is set when the developer is trying to use EAS Update

Why
Fail fast with a clear message if the app config contradicts itself or the developer's behavior.
How
Throw if useClassicUpdates is set in the app config and the developer is running an EAS Update-related command or if the app config uses an EAS Update URL.
Test Plan
Added a unit test for ensureEASUpdateIsConfiguredAsync

How about a middleground between both our PR's where you tell the user their configuration is incompatible and offer to change it for them (ie) remove useClassicUpdates from your app config?, since the solution is quite straightforward, it will help the user complete their workflow faster.

@quinlanj I'll look to see if there is a way to remove config options. I'm not sure it is worth it, though, since this affects just one SDK version.

Added context-aware prompts that ask the developer if they would like to remove updates.useClassicUpdates. It will not offer to automatically remove the field if the project doesn't use app.json. Confirmed in a test project that the field is actually deleted, not set to false.
Choosing no:

Choosing yes:

With app.config.js instead of app.json:

/changelog-entry bug-fix Ensure useClassicUpdates is not set when using EAS Update commands

authors: ide quinlanj

repo: expo/eas-cli


text:
Data types coming out of the db

Hi!
When creating a box, it's ok to pass Points to the model constructor, but when queried the data comes back as text. Do you have plans to fix this? What would you accept in a PR; the use of regexps to transform the string into tuples/Points or do you have cleaner ideas?
Thanks!

This was a weird side effect of something, the code does do Point objects (running the PR #3 code works).

@mjtorn I'm getting this same issue. I see your PR #3 code and that took care of your ticket #1, but as described in your comment above, I'm seeing the data returned as text in the shell rather than Point objects, e.g.
>>> myObject.box
'(5,5),(0,0)'

Are you getting something different?

False alarm. My shell wasn't using the updated code. Now I'm getting point objects:
[<Point(5.0,5.0)>, <Point(0.0,0.0)>]

authors: jessemorton mjtorn

repo: expobrain/django-postgres-geometry

license: mit

license_source: bigquery


text:
Add use_rng option to attribute macro extendr.

Fixes #474.
But depends on extendr/libR-sys#123 and corresponding generated_bindings pr before merging this.
I tested this on my forks of this, and you can too!
This also depends on #469.

Actually, I think this is very good instruction. I think it should be in the contributor guide or something.
This PR is fairly concise, and I tested it out, so it doesn't need this (I just need to finish some documentation and for the other PRs to merge). But it was a little cumbersome to get going.
Thanks for the tip.. I didn't understand it at first. I'll write a contributor-guide PR with this in it for prosterity.

Moved to #488 due to merging chaos.

repo: extendr/extendr


text:
Add support for Vault kvv1

Problem Statement
The documentation describes the ability to fetch multiple secrets:

https://external-secrets.io/latest/guides/getallsecrets/
https://external-secrets.io/latest/provider/hashicorp-vault/#getting-multiple-secrets

But when I try to use this with Vault kv version v1, I get the following error:
cannot perform find operations with kv version v1

Related Issue
Fixes https://github.com/external-secrets/external-secrets/issues/3518
Proposed Changes
As far as I've been able to tell, the existing implementation does already support listing secrets and finding by name for Vault kvv1. All I've had to do for actual code changes so far is change the condition to check for whether tags are provided, and to update the error message accordingly.
Partially because they were so minimal, I am not yet confident that these changes actually do implement Vault kvv1 support. I haven't yet tested them against a running instance of Vault using kvv1.
Checklist

[x] I have read the contribution guidelines
[x] All commits are signed with git commit --signoff
[x] My changes have reasonable test coverage
[x] All tests pass with make test
[ ] I ensured my PR is ready for review with make reviewable

I have run this, but I am not clear on what I'm supposed to do with this output. I'll put it in a comment.

I am on Windows so I'm doing this using WSL2. So far I haven't been able to get make reviewable to complete successfully, it is getting this error:
15:10:57 [ OK ] Finished generating deepcopy and crds
make -C ./hack/api-docs build
make[1]: Entering directory '/mnt/c/Users/nknowlson/Workspace/external-secrets/hack/api-docs'
docker build -t github.com/external-secrets-mkdocs:latest -f Dockerfile .
[+] Building 0.4s (1/2)                                                                                docker:default
[+] Building 0.5s (1/2)                                                                                docker:default
[+] Building 0.7s (2/2) FINISHED                                                                                docker:default
 => [internal] load build definition from Dockerfile                                                                                0.1s
 => => transferring dockerfile: 1.28kB                                                                                0.0s
 => ERROR [internal] load metadata for docker.io/library/alpine:3.20@sha256:0a4eaa0eecf5f8c050e5bba433f58c052be7587ee8af3e8b3910ef9ab5fbe9f5                                                                0.6s
------
 > [internal] load metadata for docker.io/library/alpine:3.20@sha256:0a4eaa0eecf5f8c050e5bba433f58c052be7587ee8af3e8b3910ef9ab5fbe9f5:
------
Dockerfile:14
--------------------
  12 |     # limitations under the License.
  13 |
  14 | >>> FROM alpine:3.20@sha256:0a4eaa0eecf5f8c050e5bba433f58c052be7587ee8af3e8b3910ef9ab5fbe9f5
  15 |     RUN apk add -U --no-cache \
  16 |         python3 \
--------------------
ERROR: failed to solve: alpine:3.20@sha256:0a4eaa0eecf5f8c050e5bba433f58c052be7587ee8af3e8b3910ef9ab5fbe9f5: failed to resolve source metadata for docker.io/library/alpine:3.20@sha256:0a4eaa0eecf5f8c050e5bba433f58c052be7587ee8af3e8b3910ef9ab5fbe9f5: error getting credentials - err: exit status 127, out: ``
make[1]: *** [Makefile:45: image] Error 1
make[1]: Leaving directory '/mnt/c/Users/nknowlson/Workspace/external-secrets/hack/api-docs'
make: *** [Makefile:200: docs] Error 2

Here is the output of make reviewable
ubuntu@AW-PF1HTH50-CVI:/mnt/c/Users/nknowlson/Workspace/external-secrets$ make reviewable
15:33:15 [ OK ] Finished generating deepcopy and crds
make -C ./hack/api-docs build
make[1]: Entering directory '/mnt/c/Users/nknowlson/Workspace/external-secrets/hack/api-docs'
docker build -t github.com/external-secrets-mkdocs:latest -f Dockerfile .
DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
            Install the buildx component to build images with BuildKit:
            https://docs.docker.com/go/buildx/

Sending build context to Docker daemon  25.09kB
Step 1/6 : FROM alpine:3.20@sha256:0a4eaa0eecf5f8c050e5bba433f58c052be7587ee8af3e8b3910ef9ab5fbe9f5
 ---> 324bc02ae123
Step 2/6 : RUN apk add -U --no-cache     python3     python3-dev     py3-pip     musl-dev     git     openssh     git-fast-import     bash     gcc     diffutils
 ---> Using cache
 ---> d55bf2bc0c8d
Step 3/6 : ENV PATH=$PATH:/.venv/bin
 ---> Using cache
 ---> da3a94aa3fcb
Step 4/6 : COPY requirements.txt /
 ---> Using cache
 ---> 38ec7df1b059
Step 5/6 : RUN python3 -m venv .venv &&     source .venv/bin/activate &&     pip3 install --upgrade pip &&     pip3 install -r /requirements.txt
 ---> Using cache
 ---> b41f15a31624
Step 6/6 : RUN git config --system --add safe.directory '*'
 ---> Using cache
 ---> 56aa3f79c1a6
Successfully built 56aa3f79c1a6
Successfully tagged github.com/external-secrets-mkdocs:latest
./generate.sh /mnt/c/Users/nknowlson/Workspace/external-secrets/hack/api-docs/../..//docs/api/spec.md
I0827 15:33:18.360866  259664 main.go:129] parsing go packages in directory github.com/external-secrets/external-secrets/apis/externalsecrets/v1beta1
W0827 15:36:11.654173  259664 parse.go:863] Making unsupported type entry "any" for: &types.Alias{obj:(*types.TypeName)(0xc000092a00), orig:(*types.Alias)(0xc00007e180), tparams:(*types.TypeParamList)(nil), targs:(*types.TypeList)(nil), fromRHS:(*types.Interface)(0xc000092960), actual:(*types.Interface)(0xc000092960)}
W0827 15:36:11.655638  259664 parse.go:863] Making unsupported type entry "reflect.uncommonType" for: &types.Alias{obj:(*types.TypeName)(0xc003e0fdb0), orig:(*types.Alias)(0xc004857d40), tparams:(*types.TypeParamList)(nil), targs:(*types.TypeList)(nil), fromRHS:(*types.Named)(0xc000112e70), actual:(*types.Named)(0xc000112e70)}
W0827 15:36:11.672819  259664 parse.go:863] Making unsupported type entry "sigs.k8s.io/controller-runtime.Manager" for: &types.Alias{obj:(*types.TypeName)(0xc013f89cc0), orig:(*types.Alias)(0xc01903f280), tparams:(*types.TypeParamList)(nil), targs:(*types.TypeList)(nil), fromRHS:(*types.Named)(0xc0164a8540), actual:(*types.Named)(0xc0164a8540)}
W0827 15:36:11.676448  259664 parse.go:863] Making unsupported type entry "sigs.k8s.io/controller-runtime/pkg/client.ObjectKey" for: &types.Alias{obj:(*types.TypeName)(0xc0202d8aa0), orig:(*types.Alias)(0xc0209d7800), tparams:(*types.TypeParamList)(nil), targs:(*types.TypeList)(nil), fromRHS:(*types.Named)(0xc007829f10), actual:(*types.Named)(0xc007829f10)}
I0827 15:36:11.681765  259664 main.go:231] using package=github.com/external-secrets/external-secrets/apis/externalsecrets/v1beta1
W0827 15:36:11.824717  259664 main.go:442] not found external link source for type *string
I0827 15:36:11.900173  259664 main.go:167] written to /mnt/c/Users/nknowlson/Workspace/external-secrets/hack/api-docs/../..//docs/api/spec.md
mkdir -p /mnt/c/Users/nknowlson/Workspace/external-secrets/hack/api-docs/../..//site
docker run \
    --mount type=bind,source=/mnt/c/Users/nknowlson/Workspace/external-secrets/hack/api-docs/../../,target=/repo \
        --sig-proxy=true \
        --rm \
        --user 1000:1000 \
        --env "GIT_COMMITTER_NAME=" \
        --env "GIT_COMMITTER_EMAIL=" \
        github.com/external-secrets-mkdocs:latest \
        /bin/bash -c "cd /repo && mike deploy --ignore --update-aliases -F hack/api-docs/mkdocs.yml main unstable;"
make[1]: *** [Makefile:50: build] Error 1
make[1]: Leaving directory '/mnt/c/Users/nknowlson/Workspace/external-secrets/hack/api-docs'
make: *** [Makefile:200: docs] Error 2

I think this is ready for at least an initial review now.
I've read over the contribution process https://external-secrets.io/main/contributing/process/
There are at least these things left to do before merging:

Should be tested with Vault kvv1 directly

It looks like this is something the e2e tests might do?

Figure out what to do with make reviewable output
Figure out why the License Compliance check is failing

Can you spot anything else to do to prep this PR for merging?
Thank you!

hey @nick-knowlson-alayacare ! thanks for your contribution!

Should be tested with Vault kvv1 directly
It looks like this is something the e2e tests might do?
I think e2e tests will not cover this functionality at all 🤔 - we'd need to add that test case to here https://github.com/external-secrets/external-secrets/blob/main/e2e/suites/provider/cases/vault/vault.go#L84-L93 (maybe something that could be added as part of your PR? 😄

Figure out what to do with make reviewable output
Lets see if the output from the pipeline is different. This might be an issue on your local development.

Figure out why the License Compliance check is failing
This one is a known issue... FOSSA re-scans once in a while and forgets about all of the issues that are false positives

Thanks for the review and comments!
I've fixed the lint error. I'll take a look at the vault e2e tests you linked to see if that is something I could add as part of this PR.

I think e2e tests will not cover this functionality at all 🤔 - we'd need to add that test case to here https://github.com/external-secrets/external-secrets/blob/main/e2e/suites/provider/cases/vault/vault.go#L84-L93 (maybe something that could be added as part of your PR? 😄

I have made a small update to that file, but I currently do not really grasp how these are transformed into test cases and then run. Do you know if I will need to make some more corresponding changes for this to execute, or is this enough and it can reuse the existing building blocks?

Hello! @gusfcarvalho, I think I've responded to all the points you brought up, just have a couple of questions for you.

/ok-to-test sha=de24cd74aa487155023813efd629872b5587829c

Hello! @gusfcarvalho, I think this PR is ready for review / merging, just need a response to https://github.com/external-secrets/external-secrets/pull/3790#discussion_r1734997357 and a review!

authors: gusfcarvalho nick-knowlson-alayacare

repo: external-secrets/external-secrets


text:
🛑 RoutineHub is down

In 4af2901, RoutineHub (https://routinehub.co) was down:

HTTP code: 521
Response time: 67 ms

Resolved: RoutineHub is back up in fdeaad9.

repo: extratone/up


text:
How to display SVG from URL?

Dear all,
I have tried Macaw's SVGView for drawing SVG in UITableViewCell, and the performance has been very good! Problem is, SVGView's API only allows loading SVG file from the resources bundle, and I want it to load an SVG from URL.
From what I know, iOS' resources bundle is read-only, so I need to store the SVG files somewhere else. Is there any way for Macaw's SVGView to load file outside of the resources bundle?
Thanks in advance!

Hello, @edopelawi, for the fast solution you can use the method "func parse(text: String)" from SVGParser for parsing SVG string content loaded from the network. You got Node after parsing which you can use in MacawView.

@amarunko, thank you for the reply! I'll try that out!

@amarunko, quick question - the code you provided above will block the main thread, no? What if I want to download the SVG in the background thread, and then load the "node" later on?

it is just an example, of course, you can use URLSession or wrappers (Moya, Alamofire, etc.) for downloading content in the background and then update node with downloaded and parsed SVG.

You're right! I just tried to parse the SVG directly and update the MacawView's node, and it worked correctly!
I'll close this issue then - thank you for the help, @amarunko ! 👍

@edopelawi  Could you please show me your sample code to load svg from URL.

Hey @luminkhant , sorry for the late reply. I didn't have access to the code anymore... my apologies!

Its ok. I handled it by myself. Thanks @edopelawi

authors: amarunko edopelawi luminkhant

repo: exyte/Macaw


text:
Sorting and page number-based pagination support

Fixes #12
Fixes #13

Closing in favor of splitting into separate PRs for sort and pagination.

repo: eyefloaters/console-api


text:
🛑 AUR Repo is down

In 6a7bf8c, AUR Repo (https://aur.eyenx.ch/x86_64/eyenx.db.tar.gz) was down:

HTTP code: 404
Response time: 403 ms

Resolved: AUR Repo is back up in 015d9fb.

repo: eyenx/upptime


text:
feat: update to eye v4.6.0

feat: update to eye v4.6.0

:tada: This PR is included in version 5.6.0 :tada:
The release is available on:

npm package (@latest dist-tag)
GitHub release
v5.6.0

Your semantic-release bot :package::rocket:

repo: eyereasoner/eye-js


text:
[FEAT] Busking

Summary
CRUD Busking located in map
Todos

[ ] Busking Creation
[ ] Busking Information Review
[ ] Busking Participation
[ ] Busking Participation Cancel
[ ] Busking End

Etc

Issues about several situation(ex. extend time, auto-end, etc) implement later

Case 1. Creation

USER may participate in only one busking
Creation fails when USER already create not ended busking
Creation fails when USER already participate in another's not-ended busking

Case 2. Participation

Participation fails when USER already participate in another not-ended busking no matter created by itself or not

Let the busking feed image stored in NCP Object Storage

Flexible architecture for data management(ex. Migration of images in personal server for price issues)
Easier to mirgrate images to personal NAS

TODO for busking creation

Interface & configuration for image storage
Test success for creation with postman or swagger
Delete images in storage when failed to create busking

repo: f-lab-edu/show-your-worth


text:
fix 'K' key binding

As per f/atom-term2#178, pressing 'K' just throws an error.
This PR fixes the bug!

To apply this patch locally on a Mac here are the steps:
cd ~/.atom/packages/term2/node_modules
rm -rf atom-term.js
git clone https://github.com/mmckegg/atom-term.js.git atom-term.js
cd atom-term.js
git checkout patch-1

great PR! fixes OSX for me :boat:
@f please merge

+1 fixes https://github.com/f/atom-term2/issues/178

authors: KylePDavis darol100 mmckegg reqshark


text:
Proxy and Frontend Health checks

We can make things a little more robust with proxy and frontend health check (former on the HTTP LB and Latter on readiness/liveliness on the pod). For the latter, look at the loadgen examples in the google microservices respository.

Added F5XC health checks to the origin pool and probes on the containers in the pod. Good to go.

license: Unlicense


text:
Fix bug in MPI_Reduce

In this PR I solve a bug in distributed reduce operations that re-use the send and receive buffers across different MPI_Reduce calls. This bug was first introduced with #191.
When performing the locality-aware reduce in a local leader that is not co-located with the rank that originated the reduce, we perform the following operations:

Receive data from local ranks.
Reduce data from local ranks (and ours).
Send reduced results to the rank that originated the reduce.

As the local leader is not expected to be receiving anything, it may be the case that, the recvBuffer in the method's signature is a nullptr (seems to be an unwritten agreement across MPI developers). Therefore, in (2) we were accumulating the partial reduce in the same buffer the local leader's data was provided (i.e. sendBuffer), and then sending this buffer in (3).
Unofrtunately, said sendBuffer is a pointer to the application's memory, and the application is not expecting that memory to be modified. In particular, if subsequent reduces are performed, the results returned by reduce are incorrect.

Does this fix any of the ignored mpi TSan race conditions by any chance? IIRC it was failing on reductions

@kubasz trying now. whilst we are at it, does #192 fix the ignore list entry here?

@kubasz trying now. whilst we are at it, does #192 fix the ignore list entry here?

Yes, it does, I forgot to remove it from the ignorelist

authors: csegarragonz kubasz

repo: faasm/faabric


text:
Maintaining precision with numbers

This is more of a question than a bug. I am trying to find a way to encode a decimal value with the proper precision. For example, with a precision of 1/1000, I want to encode 2.000 and not 2 or 2.0. The easy way would be to encode it as a string, but the FHIR spec requires that it be encoded as a number.
In Java I had access to a minimal JSON library where I had the option to encode the string sequence that would appear in the value even though the value itself was representing an integer.
In any case, is there a way I could encode a float. double, or Decimal value with the correct precision? What would it take to do it?

Actually I have a hunch I know how to do it looking at the encoder code but I am so new to Swift and Xcode I wouldn't put too much on that. So I am trying to figure out how to import this source into a test XCode project.

Is this a duplicate of #64?

Fabian,
In some sense yes. Though I am completely new to Swift and iOS, in Java the way that I was able to maintain precision was that I got a Java library that did not rely on your class variable names as providing the keys. IN the end I got the impression that the Encobable/Decoable protocol was forcing that (I may be wrong) which out the door meant it would not be possible to keep precision unless the class/struct itself did. In Java, there is a class 'BigDecimal' which DOES keep precision (though I did not use that).
But as I see it having the raw JsonValue and JsonObject and JsonArray classes works around the 'Codable' protocol allowing one to create JSON strings at a very basic level (so you can essentially pick and choose as you want). That solves the precision problem.
Brian

From: Fabian Fett notifications@github.com
Sent: Monday, September 14, 2020 3:32 AM
To: fabianfett/pure-swift-json pure-swift-json@noreply.github.com
Cc: Brian Reinhold BrianReinhold@lnihealth.com; Author author@noreply.github.com
Subject: Re: [fabianfett/pure-swift-json] Maintaining precision with numbers (#63)
Is this a duplicate of #64https://github.com/fabianfett/pure-swift-json/issues/64?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/fabianfett/pure-swift-json/issues/63#issuecomment-691875621, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AJMDO6YLG6YFFIPWSD2TVQLSFXBIPANCNFSM4RHRTN2A.

authors: brianreinhold fabianfett

repo: fabianfett/pure-swift-json


text:
NetworkFamily has incorrect casing

The StringEnum on IPv6 results in the first letter being lowercase iPv6, whereas the casing should be IPv6. Switching to [<StringEnum(CaseRules.None)>] should fix it. I was going to make the change and wanted to write a test for it, but I'm hitting some errors when trying to run tests:
Couldn't remove project reference Fable.Node from dll references
ERROR: The specified file name or path is too long, or a component of the specified path is too long.

The specified file name or path is too long, or a component of the specified path is too long.

It has been a long since I last saw this issue. I believe this is related to Windows path system.

I'm on a mac, but I use Nix. Perhaps it's something being referenced from the nix store. I'll try to build it again at some point and see if I can isolate it.

authors: MangelMaxime joprice

repo: fable-compiler/fable-node


text:
delete user data if not used for 30 days or more

(côté serveur) : Suppression automatique des données et de l'utilisateur si aucune utilisation pendant 30 jours

Nouvelle version disponible en test

authors: PatGendre iciatech-yprime

repo: fabmob/tracemob-phone


text:
fix(modal): cleanup scroll-doctor lock on unmount

This should ensure that the scroll lock gets removed when the modal closes

Adding @BalbinaK to give this a quick check!

@JosteinKringlen could you change base to next branch so we comply with the release process explained in the README.md? Then when we see that it triggered a release to NPM next, we can safely merge to main, which will cut a new release to NPM.

@BalbinaK Done! 😄

authors: BalbinaK JosteinKringlen pearofducks

repo: fabric-ds/react


text:
Booster catalog endpoints now return the original metadata from the booster catalog itself.

See fabric8-launcher/launcher-planning#120 and fabric8-launcher/launcher-planning#121

Weird, the build passed in https://semaphoreci.com/fabric8-launcher/launcher-backend/branches/pull-request-206 but I still see Waiting for status to be reported here

Don't forget to change the swagger.yaml file in https://github.com/fabric8-launcher/launcher-backend/blob/master/web/src/main/webapp/swagger.yaml

Fixing conflicts locally and adding tests. Will push soon

Merged in master. Closing

authors: gastaldi quintesse


text:
fix(dep-checker): calls dep editor component only if it's enabled

Added a check to the dependency-editor-step-component to load the depenency-editor component only if feature flag is enabled.

:tada: This PR is included in version 1.0.9 :tada:
The release is available on:

npm package (@latest dist-tag)
GitHub release

Your semantic-release bot :package::rocket:


text:
700 release work 3.1.80.redhat 000 m2e ignore

I need this feature to work with FIS 2.0 so I backport it to this branch

Wrong target branch. You want v3.1.80-redhat.

thanks @jamesnetherton I recreated the PR

authors: apupier jamesnetherton


text:
Expand arrow is not showing on current iteration

Closing as out of date - no longer an issue.


text:
dependent data sources?

perhaps i've missed something - I have some datasources that rely on other datasources to get their data. Is there some way of indicating in the Datasource implementation that fetch should be a Haxl expression, rather than just IO?

I probably don't fully understand your use case, but have you looked at cachedComputation?  This allows you to build a data source with the usual caching properties but whose implementation is a Haxl computation.  We use this to wrap other data sources at Facebook.

I think I sort of want the dual of that - I have a datasource Foo, and another datasource Baz that fetches some things, and also uses Foo. Looking at the typesig of fetch, it returns
data PerformFetch
  = SyncFetch  (IO ())
  | AsyncFetch (IO () -> IO ())

so I can only do IO in that fetch - I can't drop back into the Haxl env to use data from elsewhere.
Have I just mis-structured my app? I can sort of see how I could just use the DataSource to fetch, and then write the combination as computations in the Haxl applicative.

pretty sure I have mis-structured it now. Sorry for the noise.

As I understand your question, we solve this problem in haxl "client" code. We have, for example, abstractions that fetch Widgets and those will attempt to fetch them first from memcache, and them from the WidgetStore if memcache store (this is normal haxl code). This method for multi-stage fetching plays nicely with the rest of haxl as the memcache fetch in the first round will go out with other requests in that round.

Yep, I just misunderstood the model. All the dependencies are expressed in
Haxl expressions, not in data sources - all happy (and infinitely better
than my homebrew) now.
On Fri, 1 May 2015 2:15 am Louis Brandy notifications@github.com wrote:

As I understand your question, we solve this problem in haxl "client"
code. We have, for example, abstractions that fetch Widgets and those will
attempt to fetch them first from memcache, and them from the WidgetStore if
memcache store (this is normal haxl code). This method for multi-stage
fetching plays nicely with the rest of haxl as the memcache fetch in the
first round will go out with other requests in that round.
—
Reply to this email directly or view it on GitHub
https://github.com/facebook/Haxl/issues/29#issuecomment-97933649.

authors: lbrandy mwotton simonmar

repo: facebook/Haxl


text:
Min max package, update readme and add additional functionality for virtual_type

This allows you to do cool things like manage launchdaemons/agents dynamically depending on the version of software installed.
I am using this for Munki 3.2 -> 3.3 migration.

Looks good to me. @natewalck  Do you have any other comments? and would you be able to merge internally?

Looks good to me! I'll merge internally.

authors: erikng mikedodge04 natewalck

repo: facebook/IT-CPE


text:
Missing code coverage data with CRA 2.0.0-next

Is this a bug report?
Yes

Did you try recovering your dependencies?

Yes
Which terms did you search for in User Guide?

Yes
Environment

Environment:
  OS:  Windows 10
  Node:  10.4.1
  Yarn:  1.7.0
  npm:  6.1.0
  Watchman:  Not Found
  Xcode:  N/A
  Android Studio:  Not Found

Packages: (wanted => installed)
  react-scripts: ^2.0.0-next.3e165448 => 2.0.0-next.b2fd8db8

Steps to Reproduce

We have migrated to a monorepo using CRA next, everything works fine except that the code coverage of the test is only working for the main application project. It does not work anymore for the other project where our components are.

Clone this commit from our project, install the dependencies with yarn install and run the test with coverage using yarn coverage. Everything works fine, the code coverage is working as seen in the Travis build.
Now checkout this commit which configures everything for a monorepo architecture with two packages (app and core). Install everything and run the tests once again. As you could see it in the Travis build, the same tests are executed but the coverage report does not include anything anymore.

Expected Behavior

The code coverage report should include all the code covered by the executed tests.
Actual Behavior

Before

After

Reproducible Demo

Clone this commit.

yarn install
yarn coverage

The issue may be coming from the Jest config of CRA 2.0.0 next which seems to only look in the source folder here.
collectCoverageFrom: ['src/**/*.{js,jsx,mjs}']

Not sure if this is related, but you have the wrong version of the beta installed:
Packages: (wanted => installed)
  react-scripts: ^2.0.0-next.3e165448 => 2.0.0-next.b2fd8db8

Please remove the caret and re-install.

Thanks but we have tried by updating to the latest version of the beta and the issue remain.
Environment:
  OS:  Windows 10
  Node:  10.4.1
  Yarn:  1.7.0
  npm:  6.1.0
  Watchman:  Not Found
  Xcode:  N/A
  Android Studio:  Not Found

Packages: (wanted => installed)
  react-scripts: 2.0.0-next.3e165448 => 2.0.0-next.3e165448

/cc @bradfordlemley

Should be fixed by PR #4649.

authors: Timer bradfordlemley sbegaudeau

repo: facebook/create-react-app


text:
Provide a way to add a nonce to the inline webpack script

Version 2.0.0 adds an inline script, which causes a problem with more restrictive content security policies.  One way to selectively allow this inline script would be to set a nonce on it, and then whitelist that nonce in the CSP.
I don't know what would be the best way to pass this nonce to the build.

Can the nonce just be a static identifier or does it have to be generated dynamically?

I'm not sure I understand your question.  I don't need CRA to generate the nonce, but just to take a provided nonce and add it to the inline script tag.

The server must generate a unique nonce for each response (spec), so a nonce based approach would have to be used in combination with custom server configuration, eg:
https://scotthelme.co.uk/csp-nonce-support-in-nginx/
The other option is to add the hash of the inline content to the policy:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src#Sources
However given that the webpack runtime chunk changes often (hence why inlining it makes sense), the hash based approach would still need either:
(a) integration with whatever is serving the content (so the hash could be fed back from webpack to wherever the headers are generated)
(b) use of the <meta> tag based CSP (rather than the preferred Content-Security-Policy header, which support frame-ancestors, report-uri and sandbox) and say one of:

https://www.npmjs.com/package/csp-webpack-plugin (repo)
https://www.npmjs.com/package/csp-html-webpack-plugin (repo)

Does the index.html contain anything specifying that it's CSP'd? Is there a way we could "know" to not inline the runtime, barring configuration?

@edmorley The unique nonce requirement does complicate things, especially for a static server.  The hash approach does sound better, though I haven't been able to make it work so far.  And there is the question of how to feed it back.  Would it work to write it to a file in the build folder?
@Timer Are you suggesting to add something to index.html to signal that it will be CSP'd?

Since this is an edge case, we recommend you write a postbuild script that removes the inline script and switches it back to the runtime chunk. You can find the runtime chunk via asset-manifest.json, or globby. Whatever suits you.

@Timer We just ran into this issue and I read your comment about it. Having implemented a script like the one you suggested, we realised that this might be a rather fragile solution (searching for <script>...</script> and replacing it). Is there any reason against having a parameter for the build script that disables inlining of scripts (like react-scripts --no-inline-scripts)?

I think we should add an ID to that script. Then you can search by that ID and it should be robust enough.

@gaearon I like that. If no other scripts pop-up that solution should work 👍

What I ended up doing is writing a script that searches for the script and calculates its hash for inclusion in the CSP.  But I agree either an ID or, if there may be other scripts in the future, maybe a class, would make it feel less fragile.

We are also having this issue. It is not an edge case for projects that care about security. I agree with @PerfectPixel that there should be an option to avoid inline scripts and instead reference it as a link. Otherwise, we should at least have an id.

@Timer @gaearon
Just to explore, I tried to make inlining the runtime chunk configurable and it was not super difficult. Maybe it is worth a look: https://github.com/PerfectPixel/create-react-app/commit/14584aac78e7275693c4b9893e21f3ec8b21922c
However, I understand that adding plugins conditionally is not the best way. Or filter missing plugins for that matter. Replacing a plugin with a noop-plugin could also be an option.

We'd like to avoid adding a configuration flag for this when you can easily patch it with a postbuild script. Let's move discussion to https://github.com/facebook/create-react-app/issues/5288 so it doesn't get lost on this closed issue.

authors: PerfectPixel Timer caedmon edmorley gaearon iansu sarah12345


text:
Error after npm start

After doing npx create-react-app my-app, it gives me an error when starting the server on my macBook. However, it's working perfectly fine on my pc.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! omar@0.1.0 start: react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the omar@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Add .env with "SKIP_PREFLIGHT_CHECK=true" than npm start

problem solved @Aakashdeveloper

Add .env with "SKIP_PREFLIGHT_CHECK=true" than npm start

what does it actually do?

Add .env with "SKIP_PREFLIGHT_CHECK=true" than npm start

Omg it really worked. Thanks a lot.

@Amooryjubran  can we close this issue now

hi where to add .env , can you please help

create .env file in the root of your folder.
inside it put
NODE_ENV=development
PORT=8626
# Set your database/API connection information here
API_KEY=**************************
API_URL=**************************

where to add this line in that    "SKIP_PREFLIGHT_CHECK=true"  @sankshitpandoh

in .env file

NODE_ENV=development
PORT=8626
Set your database/API connection information here
API_KEY=**************************
API_URL=**************************
SKIP_PREFLIGHT_CHECK=true
like these right?

@k96white,
why we need DB connection for starting react app

@Aakashdeveloper I was just editing the file, just ignore those two lines, rest is right?

i think only Add .env with "SKIP_PREFLIGHT_CHECK=true" than npm start

It didn't solved my issue ,

I am able to run it now using an old version of react-scripts (the current version was 3.4.0)
npm install react-scripts@2.1.8
will it cause any problems in the future?

I am able to run it now using an old version of react-scripts (the current version was 3.4.0)
npm install react-scripts@2.1.8
will it cause any problems in the future?

There maybe some security vulnerabilities that may arose in future. but is should be fine as long as you are not using this for production.

i'm getting this error... please help.
D:\React\routertabs>npm start

routertabs@0.1.0 start D:\React\routertabs
react-scripts start

Starting the development server...
events.js:288
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn cmd',
path: 'cmd',
spawnargs: [ '/s', '/c', 'start', '""', '/b', '"http://localhost:3000"' ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! routertabs@0.1.0 start: react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the routertabs@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Arif\AppData\Roaming\npm-cache_logs\2020-03-17T09_34_39_313Z-debug.log

authors: Aakashdeveloper Amooryjubran aliarif7836 developerfunnel k96white sankshitpandoh


text:
ws affected by a DoS when handling a request with many HTTP headers

Have you read the Contributing Guidelines on issues?

[X] I have read the Contributing Guidelines on issues.

Prerequisites

[X] I'm using the latest version of Docusaurus.
[X] I have tried the npm run clear or yarn clear command.
[X] I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
[X] I have tried creating a repro with https://new.docusaurus.io.
[X] I have read the console error message carefully (if applicable).

Description

Reproducible demo
https://github.com/jy95/fhir-dosage-utils/tree/main/documentation
Steps to reproduce

npm install
npm audit

Expected behavior
No CSV
Actual behavior

Your environment
No response
Self-service

[ ] I'd be willing to fix this bug myself.

As explained in many other issues already, we don't plan to fix theoretical DOS vulnerabilities reported by npm audit, unless you prove how the vulnerability can be harmful to Docusaurus users.
A docusaurus site has no runtime and does not use WS. Only the dev server does. If you try to DOS yourself through that vulnerability, we don't plan to fix that sorry 😅
The reasons are explained here:
https://overreacted.io/npm-audit-broken-by-design/

repo: facebook/docusaurus


text:
Search returns no results since migrating DocSearch

Have you read the Contributing Guidelines on issues?

[X] I have read the Contributing Guidelines on issues.

Prerequisites

[X] I'm using the latest version of Docusaurus.
[X] I have tried the npm run clear or yarn clear command.
[X] I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
[X] I have tried creating a repro with https://new.docusaurus.io.
[X] I have read the console error message carefully (if applicable).

Description
Prior to the DocSearch migration, plaiceholder.co's search integration worked seamlessly
Since upgrading, I've been unable to get the search up and running again for over a week now – this is my resort! I've followed steps in #4872, #6693 and the migration guide, with no luck.
Additional context to the repro provided:

Crawler Config
new Crawler({
  appId: "<MY-APP-ID>",
  apiKey: "<MY-API-KEY>",
  rateLimit: 8,
  startUrls: ["https://plaiceholder.co/docs", "https://plaiceholder.co/"],
  sitemaps: ["https://plaiceholder.co/docs/sitemap.xml"],
  ignoreCanonicalTo: true,
  discoveryPatterns: ["https://plaiceholder.co/**"],
  actions: [
    {
      indexName: "plaiceholder",
      pathsToMatch: ["https://plaiceholder.co/**"],
      recordExtractor: ({ $, helpers }) => {
        // priority order: deepest active sub list header -> navbar active item -> 'Documentation'
        const lvl0 =
          $(
            ".menu__link.menu__link--sublist.menu__link--active, .navbar__item.navbar__link--active"
          )
            .last()
            .text() || "Documentation";

        return helpers.docsearch({
          recordProps: {
            lvl0: {
              selectors: "",
              defaultValue: lvl0,
            },
            lvl1: ["header h1", "article h1"],
            lvl2: "article h2",
            lvl3: "article h3",
            lvl4: "article h4",
            lvl5: "article h5, article td:first-child",
            lvl6: "article h6",
            content: "article p, article li, article td:last-child",
          },
          indexHeadings: true,
          aggregateContent: true,
          recordVersion: "v3",
        });
      },
    },
  ],
  initialIndexSettings: {
    plaiceholder: {
      attributesForFaceting: [
        "type",
        "lang",
        "language",
        "version",
        "docusaurus_tag",
      ],
      attributesToRetrieve: [
        "hierarchy",
        "content",
        "anchor",
        "url",
        "url_without_anchor",
        "type",
      ],
      attributesToHighlight: ["hierarchy", "content"],
      attributesToSnippet: ["content:10"],
      camelCaseAttributes: ["hierarchy", "content"],
      searchableAttributes: [
        "unordered(hierarchy.lvl0)",
        "unordered(hierarchy.lvl1)",
        "unordered(hierarchy.lvl2)",
        "unordered(hierarchy.lvl3)",
        "unordered(hierarchy.lvl4)",
        "unordered(hierarchy.lvl5)",
        "unordered(hierarchy.lvl6)",
        "content",
      ],
      distinct: true,
      attributeForDistinct: "url",
      customRanking: [
        "desc(weight.pageRank)",
        "desc(weight.level)",
        "asc(weight.position)",
      ],
      ranking: [
        "words",
        "filters",
        "typo",
        "attribute",
        "proximity",
        "exact",
        "custom",
      ],
      highlightPreTag: '',
      highlightPostTag: "",
      minWordSizefor1Typo: 3,
      minWordSizefor2Typos: 7,
      allowTyposOnNumericTokens: false,
      minProximity: 1,
      ignorePlurals: true,
      advancedSyntax: true,
      attributeCriteriaComputedByMinProximity: true,
      removeWordsIfNoResults: "allOptional",
      separatorsToIndex: "_",
    },
  },
});

I love using Docusaurus, so I'd really appreciate any support to get this up and running again
Reproducible demo
https://github.com/joe-bell/plaiceholder/tree/main/docs
Steps to reproduce

Visit https://plaiceholder.co/docs
Click on the search bar, or visit /docs/search
Enter get (this did return results prior to upgrade)
Enter any combination of letters or numbers
See that no results are returned

Expected behavior
In Algolia's Crawler editor page, I'm able to see that this should return results:

Actual behavior
Typing get (or any search) returns no results

Your environment

Public source code: https://github.com/joe-bell/plaiceholder/tree/main/docs
Public site URL: https://plaiceholder.co/docs
Docusaurus version used: 2.0.0-beta.21
Environment name and version (e.g. Chrome 89, Node.js 16.4): N/A (all affected)
Operating system and version (e.g. Ubuntu 20.04.2 LTS): N/A (all affected)

Self-service

[ ] I'd be willing to fix this bug myself.

cc @shortcuts

Hey, looking at the requests sent, contextualSearch option is set to true on the Docusaurus side but your Crawler config has changed (you can see the warning message on 1st screenshot) to a Docusaurus v2 config
This is indeed related to the issue you've linked, you can follow both https://github.com/facebook/docusaurus/issues/6693#issuecomment-1158568333 or https://github.com/facebook/docusaurus/issues/6693#issuecomment-1158639529 for the solution.
TLDR: Delete Algolia index from the dashboard and start a new crawl

Wow, a classic case of "turn it off and on again" 🙈
Thanks so much @shortcuts, that resolved it for me

Thanks @shortcuts!

No search result?
For anyone passing by, if you don't get any Algolia search results:

make sure that your Algolia index has the fields in the screenshot below
If you don't see these fields, then you have an index config problem
You should check your crawler config, make sure it matches the recommended one, and then delete/recreate your index based on the newly updated/fixed crawler config (Algolia team recommendation)

See also: https://github.com/facebook/docusaurus/discussions/10007#discussioncomment-9021352

authors: Josh-Cena joe-bell shortcuts slorber


text:
Add bundles from 'universal' example to eslintignore

After running the build step for the 'universal' example there is a bundle file which we don't want to lint. This fixes the issue.
Steps to reproduce the problem:

install dependencies and run npm run demo in the universal example directory.
then run npm run lint and see the errors from linting the bundle.js file

I really am not seeing the reason the tests failed. I even updated to the exact node version that travis is using, and still they all pass for me locally.

Will do a follow-up that:

merges the universal/.gitignore with the top level .gitignore
adds the yarn.lock file in universal to the top level .gitignore

repo: facebook/draft-js


text:
flow 0.35.0 "Function cannot be called on possibly undefined value" error after typeof === 'function' check

don't understand how i'm getting this error:
732:       this.gulp.task(gulpName, gulpDeps, function() { return fn(); });
                                                                  ^^^^ function call. Function cannot be called on possibly undefined value
732:       this.gulp.task(gulpName, gulpDeps, function() { return fn(); });
                                                                  ^^ undefined

in the following code (abridged):
setGulpTask(
    name: string,
    depsOrFn: Array<string> | Function,
    fn?: Function,
  ): void {
    // ...
    if (typeof fn === 'function') {
      this.gulp.task(gulpName, gulpDeps, function() { return fn(); });
    } else {
      this.gulp.task(gulpName, gulpDeps);
    }
  }

the usage of fn is inside a test for typeof fn === 'function', which i thought flow understood?

The problem is that function parameters can be reassigned, so flow can't be sure that when fn is called, that  it's still valid. You can do something like that to avoid this problem:
setGulpTask(
    name: string,
    depsOrFn: Array<string> | Function,
    fn?: Function,
  ): void {
    // ...
    if (typeof fn === 'function') {
      const callback = fn;
      this.gulp.task(gulpName, gulpDeps, function() { return callback(); });
    } else {
      this.gulp.task(gulpName, gulpDeps);
    }
  }

thanks, that's basically how i ended up solving it.
i see why it is necessary...
function f(fn) {
  const newFn = function() {
    return fn();
  }

  fn = function() {
    return 'redefined';
  }

  return newFn;
}

const arg = function() { return 'defined'; };

f(arg)(); // => 'redefined'

sigh.... such is javascript i guess.

authors: AugustinLF nrser

repo: facebook/flow


text:
(v0.70) Missing type annotation when using array methods with exported function

On flow v0.70, array methods / generic methods seem to be broken. This only happens when the function is exported, and uses an array method. Marking a return type of any[] makes flow pass.
Reproduction here:
// @flow
function noErrors() {
  return [].map(b => b);
}

export function noErrors1() : any[] {
  return [].filter(b => b);
}

export function hasErrors() {
  // Errors out below with "Missing type annotation"
  return [].map(b => b);
}

export function hasErrors2() {
  // Errors out below with "Missing type annotation"
  return [].filter(b => b);
}

Errors:
12:   return [].map(b => b);
             ^ Missing type annotation for `U`.
17:   return [].filter(b => b);
             ^ Missing type annotation for `T`.

Why use any? You can use something like Array<string>.
See the changelog:

New missing annotation errors might be reported.

Not an error.
You export a function — Flow expects you to document the function's return type. Your function has no return type annotation.
Fixed.

@villesau
You say:

The error message doesn't tell anything about missing return type

The error message says

^ Missing type annotation for U.

!!!

@lll000111 It asks you to annotate your U, something related to your map or filter, it doesn't say anything return type annotation related. That's the point. Flow rarely requires you to annotate your return type which doesn't make it obvious. When I tried to update to latest Flow, I couldn't even see the benefit of having to explicitly type it: Previously Flow was able to infer the type just fine. At least all the cases I tested. But that's maybe not strictly related to this issue.

@villesau The key is the return statement! "Missing annotation" is only applicable to function signatures and variables.

This seems like inconsistent behavior. Either all exports should require explicit annotations or non should as long as the implicit types are valid.

I'm pretty sure something seems wrong with exporting anything using an array method.
Given this example https://flow.org/try
// @flow

const someArray: Array<string> = ['hello'];

// Error Here
const a = {
  someValue: someArray.map((x) => x)
  //         ^ Missing type annotation for `U`.
};

// No Errors Here
const b = {
  someValue: someArray
}

export const c = {
  a: a,
  b: b
};

I'm seeing this too. You don't  need to wrap the array in an object, as you can see here. Happens in 0.7.0, but not 0.6.9. Adding a type annotation before exporting gets rid of the error

So where do 'U', 'T' or 'S' come from? Are they just randomly generated letters? In that case it would be very helpful to replace them with 'exported function return type' or something like that.

@schumannd this for map, this for filter.
It's technically doing things well: you're returning an Array or an Array and it needs a type annotation for the type parameters of the returned array; the problem is it's a little cryptic since the user didn't directly define map or filter, so they wouldn't know what U or T are.

Well yes, flow is throwing an error and thus doing things as it should.
If, however, the error message is not understandable, then there is definitely room for improvement. And saying "but it is working as intended" is not helpful.
Also, what are these Letters? Are they the names of the parameters of map and filter? What about 'S'?
I am strongly in favor of doing something about this. Operations on arrays are among the most common things to appear in any code. These cryptic error messages will cause a lot of new users trouble.

I'm not sure it technically is doing the right thing. Return type annotations are not required on all exported methods -- that's easy to verify. So what's special about methods that use array generics?

I don't understand this entirely, but if you do import * as React from "react"; instead of import React from "react"; flow doesn't complain anymore.

@amypellegrini I ended up finding the same conclusion. I still don't completely understand but here is a screenshot that somewhat confirms it

https://flow.org/en/docs/react/components/

We already have import * as React from 'react' in our file but it's still giving the error.

@peeyush-ad2games What version of flow are you using?

@functionalStoic we are using 0.78.0

I also ran into the same issue. What's the status of this?

So it's a great discussion, but how do we compile the code like that?

@innokenty the usual setting is with Babel and Webpack, shout out if need more details.

I hope this will help someone out: Map is typed as a generic.  You want to provide something in the place of U here, as in someArray.map<U>(someMapperFunction) where someMapperFunction is of type T => U.
An example:
dictToOptions = (options: {[string]: string}) => {
    const mapper = (key: string): React.Node => (
        <option key={key} value={options[key]}>{options[key]}</option>
    )
    return Object.keys(options).map<React.Node>(mapper)
  }

With an array of objects, using .map<ObjectType>, I got the following error:
type ObjectType = {
  id: number,
};

property id is missing in React.Element [1] but exists in ObjectType [2] in the return value.

I fixed this error using: .map<{}>

I think if you use $ReadOnlyArray it doesn't require annotation

I ran into this issue today with the following code:
 configuredFlags() {
    return this.props.availableFlags.filter((flag: string) => {
      return this.initialFlagStatus(flag) !== 'default';
    });
  }

The solution was to define a return type for the configuredFlags function:
 configuredFlags(): Array<string> {
    return this.props.availableFlags.filter((flag: string) => {
      return this.initialFlagStatus(flag) !== 'default';
    });
  }

Today I ran on this weird error.
I had this:
type Response = {
  viewer: { paymentRequests: $ReadOnlyArray<PaymentRequest> },
}

export default (companyID: string) => {
  const { data, ...info } = useQuery<Response>(  )
  return {
    ...info,
    data: {
      paymentRequests:  data.viewer.paymentRequests
            .slice()
            .sort(byPayDateDesc)
    },
  }
}

And I was getting this error:
Missing type annotation for T. Tis a type parameter declared in  read-only array type [1] and was implicitly instantiated at  call of methodslice [2].Flow(InferError)
Luckly I was able to properly "Cast" by doing this:
    data: {
      paymentRequests: data
        ? (data.viewer.paymentRequests
            .slice()
            .sort(byPayDateDesc): PaymentRequest[])
        : data,
    },

But I don't understand why flow was not capable of inferring what was already declared, slice should not change the data in any way, and it doesn't allow you to provide parameters, so this was kind of a dead end until I came to this funny cast.

We now requires annotation on exported stuff unconditionally.

authors: SamChou19815 amypellegrini apsavin chrisirhc danielo515 functionalStoic goodmind iainbeeston innokenty jfirebaugh kennethtruong kevindice lll000111 mrkev peeyush-ad2games radar rastegars schumannd vicapow villesau woniesong92


text:
Logically equivalent intersection/union constructs behave differently

Under Flow, the following are logically equivalent:

Discr & (B | C)
Discr & B | Discr & C
Discr & K, where type K = B | C
(I verified that & has higher precedence than | over here, here, and here).

Flow handles them inconsistently (in a case involving circular importing):
// main.js
import { B, C } from "./extensions";

type K = B | C;

type Discr = {
  which(): number;
};

export default class A {
  static sMethod(p: B | C): bool {
    return false;
  }
  static tMethod(p: Discr & (B | C)): bool {
  /*
    main.js:1:13,13: C
    This type is incompatible with
    main.js:1:10,10: B
  */
  //static tMethod(p: Discr & B | Discr & C): bool { /* OK */
  //static tMethod(p: Discr & K): bool {
  /*
    main.js:1:13,13: C
    This type is incompatible with
    main.js:1:10,10: B
  */
    if (p.which() === 5) {
      throw new Error("Peep");
    }
    return this.sMethod(p);
  }
}

// extensions.js
import A from "./main";

export class B extends A {
  which(): number {
    return 1;
  }
}
export class C extends A {
  which(): number {
    return 2;
  }
}

This will be fixed in an upcoming release.

authors: avikchaudhuri popham


text:
Empty vector access in c++ doesn't work

In docs, infer can detect Empty vector access for c++.
So I write a simple c++ program in a.cpp as below.
#include <vector>

int foo(){
  const std::vector<int> vec;
  return vec[0];
}

int main(){
  foo();
  return 0;
}

But when I run infer -- g++ -o a a.cpp. Output is No issues found.
I also tried other commands,

infer --debug -- clang++ -o a a.cpp
infer --debug -- clang++ -c a.cpp
infer -- g++ -c a.cpp

but all get the same results.  No issues found
So, Is there any missing option for infer? or, any problems in compile commands? or, some linking problems in c++?
If necessary, developing env shows as below.

Infer version v0.12.1
g++ 4.2.1
Apple LLVM version 8.1.0 (clang-802.0.42)
macOS Sierra version 10.12.6

Can you try infer -- clang -x c++ -std=c++1y -c a.cpp? That shows the bug for me.
I'm surprised Infer doesn't show compilation failures on the other commands; I couldn't get any of them to work locally.

@sblackshear Thanks~
infer -- clang -x c++ -std=c++1y -c a.cpp  works fine. I find out that key point is the option -std=c++1y.
Without option -std=c++1y, the result is No issues found.  but there is no compilation failures for this command.
Also, I tried other -std options. Only -std=c++11 or -std=c++1y works.
I guess some bug types should use newer language standard.

I've added a note in the documentation that this is only for C++11 and above: http://fbinfer.com/docs/infer-bug-types.html#EMPTY_VECTOR_ACCESS

authors: DDMing jvillard sblackshear

repo: facebook/infer


text:
C lang Project infer crash

Hello.
When I run infer make command at error happens.
Command:
/bin/infer run -- make

infer Version:
Infer version 0.15.0

Error Log:
#0 0x00000000020f116a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/karas/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x20f116a)
#1 0x00000000020ef25e llvm::sys::RunSignalHandlers() (/home/karas/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x20ef25e)
#2 0x00000000020ef4da (/home/karas/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x20ef4da)
#3 0x00007f0aa90ee150 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x13150)
#4 0x000000000151080a (/home/karas/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x151080a)
#5 0x0000000001512843 (/home/karas/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x1512843)
#6 0x00000000015157e9 (/home/karas/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x15157e9)
#7 0x0000000001983e69 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/home/karas/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x1983e69)
#8 0x0000000001c55eed llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/karas/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x1c55eed)
#9 0x0000000001c56aab llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/karas/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x1c56aab)
#10 0x00000000022a8e74 (/home/karas/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x22a8e74)
#11 0x00000000022aaf4a clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/home/karas/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x22aaf4a)
#12 0x00000000029c3dd5 (/home/karas/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x29c3dd5)
#13 0x00000000026ab9d8 clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/karas/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x26ab9d8)
#14 0x0000000002db2aac clang::ParseAST(clang::Sema&, bool, bool) (/home/karas/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x2db2aac)
#15 0x00000000029c1b57 clang::CodeGenAction::ExecuteAction() (/home/karas/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x29c1b57)
#16 0x000000000267be8e clang::FrontendAction::Execute() (/home/karas/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x267be8e)
#17 0x0000000002648d3e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/karas/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x2648d3e)
#18 0x0000000002719750 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/karas/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x2719750)
#19 0x0000000000bae3c0 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/karas/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0xbae3c0)
#20 0x0000000000b17f27 main (/home/karas/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0xb17f27)
#21 0x00007f0aa7bd71c1 __libc_start_main /build/glibc-itYbWN/glibc-2.26/csu/../csu/libc-start.c:342:0
#22 0x0000000000ba9549 _start (/home/karas/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0xba9549)
Stack dump:
0.	Program arguments: /home/karas/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0 @/tmp/clang_command_.tmp.135f65.txt
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module '/home/karas/infer-linux64-v0.15.0/C_proj/utils/script-python.c'.
4.	Running pass 'X86 FP Stackifier' on function '@insert_tuple_double'
Segmentation fault (core dumped)

Thanks.

i got an error while running build-infer that dependency not found in opam

@gy741 So that we can investigate, could you give the source file and the clang arguments that cause the crash?
In your run the arguments are in the file "/tmp/clang_command_.tmp.135f65.txt", and somewhere near the end of that file should be the corresponding source file.

0.	Program arguments: /home/karas/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0 @/tmp/clang_command_.tmp.135f65.txt

@Dhairya1734 that sounds like a completely separate issue, would you mind opening a new issue for your problem?

@jvillard  I will test it in a clean environment.
And I will write again.

@jvillard
Hello,
I tried testing in a clean environment.
And get the same error.
And the file tmp/clang_command_.tmp.*.txt does not exist.
Install log:
VERSION=0.15.0; \
curl -sSL "https://github.com/facebook/infer/releases/download/v$VERSION/infer-linux64-v$VERSION.tar.xz" \
| sudo tar -C /opt -xJ && \
ln -s "/opt/infer-linux64-v$VERSION/bin/infer" /usr/local/bin/infer

error log
karas:~/c_proj$ infer run -- make -j3
#0 0x00000000020f116a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/opt/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x20f116a)
#1 0x00000000020ef25e llvm::sys::RunSignalHandlers() (/opt/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x20ef25e)
#2 0x00000000020ef4da (/opt/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x20ef4da)
#3 0x00007f1478f07890 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
#4 0x0000000003997801 clang::Decl::isUsed(bool) const (/opt/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x3997801)
#5 0x00007f147773a922 ASTLib::ASTExporter<ATDWriter::BiniouWriter<llvm::raw_ostream> >::VisitDecl(clang::Decl const*) /home/vagrant/infer/facebook-clang-plugins/libtooling/ASTExporter.h:1123:0
#6 0x00007f147774910c ASTLib::ASTExporter<ATDWriter::BiniouWriter<llvm::raw_ostream> >::VisitNamedDecl(clang::NamedDecl const*) /home/vagrant/infer/facebook-clang-plugins/libtooling/ASTExporter.h:1384:0
#7 0x00007f147774910c ASTLib::ASTExporter<ATDWriter::BiniouWriter<llvm::raw_ostream> >::VisitValueDecl(clang::ValueDecl const*) /home/vagrant/infer/facebook-clang-plugins/libtooling/ASTExporter.h:1288:0
#8 0x00007f147774910c clang::declvisitor::Base<clang::declvisitor::make_const_ptr, ASTLib::ASTExporter<ATDWriter::BiniouWriter<llvm::raw_ostream> >, void>::VisitDeclaratorDecl(clang::DeclaratorDecl const*) /home/vagrant/infer/facebook-clang-plugins/clang/install/include/clang/AST/DeclNodes.inc:365:0
#9 0x00007f147774910c ASTLib::ASTExporter<ATDWriter::BiniouWriter<llvm::raw_ostream> >::VisitFunctionDecl(clang::FunctionDecl const*) /home/vagrant/infer/facebook-clang-plugins/libtooling/ASTExporter.h:1519:0
#10 0x00007f147773d9b5 clang::declvisitor::Base<clang::declvisitor::make_const_ptr, ASTLib::ASTExporter<ATDWriter::BiniouWriter<llvm::raw_ostream> >, void>::VisitCXXDeductionGuideDecl(clang::CXXDeductionGuideDecl const*) /home/vagrant/infer/facebook-clang-plugins/clang/install/include/clang/AST/DeclNodes.inc:393:0
#11 0x00007f147773d9b5 clang::declvisitor::Base<clang::declvisitor::make_const_ptr, ASTLib::ASTExporter<ATDWriter::BiniouWriter<llvm::raw_ostream> >, void>::Visit(clang::Decl const*) /home/vagrant/infer/facebook-clang-plugins/clang/install/include/clang/AST/DeclNodes.inc:393:0
#12 0x00007f147773dd4c ATDWriter::GenWriter<ATDWriter::BiniouEmitter<llvm::raw_ostream> >::leaveTuple() /home/vagrant/infer/facebook-clang-plugins/libtooling/atdlib/ATDWriter.h:208:0
#13 0x00007f147773dd4c ~TupleScope /home/vagrant/infer/facebook-clang-plugins/libtooling/atdlib/ATDWriter.h:267:0
#14 0x00007f147773dd4c ASTLib::ASTExporter<ATDWriter::BiniouWriter<llvm::raw_ostream> >::dumpDecl(clang::Decl const*) /home/vagrant/infer/facebook-clang-plugins/libtooling/ASTExporter.h:1086:0
#15 0x00007f1477746387 ASTLib::ASTExporter<ATDWriter::BiniouWriter<llvm::raw_ostream> >::VisitDeclContext(clang::DeclContext const*) /home/vagrant/infer/facebook-clang-plugins/libtooling/ASTExporter.h:668:0
#16 0x00007f14777465bb ASTLib::ASTExporter<ATDWriter::BiniouWriter<llvm::raw_ostream> >::VisitTranslationUnitDecl(clang::TranslationUnitDecl const*) /home/vagrant/infer/facebook-clang-plugins/libtooling/ASTExporter.h:1357:0
#17 0x00007f147773dad5 clang::declvisitor::Base<clang::declvisitor::make_const_ptr, ASTLib::ASTExporter<ATDWriter::BiniouWriter<llvm::raw_ostream> >, void>::Visit(clang::Decl const*) /home/vagrant/infer/facebook-clang-plugins/clang/install/include/clang/AST/DeclNodes.inc:553:0
#18 0x00007f147773dd4c ATDWriter::GenWriter<ATDWriter::BiniouEmitter<llvm::raw_ostream> >::leaveTuple() /home/vagrant/infer/facebook-clang-plugins/libtooling/atdlib/ATDWriter.h:208:0
#19 0x00007f147773dd4c ~TupleScope /home/vagrant/infer/facebook-clang-plugins/libtooling/atdlib/ATDWriter.h:267:0
#20 0x00007f147773dd4c ASTLib::ASTExporter<ATDWriter::BiniouWriter<llvm::raw_ostream> >::dumpDecl(clang::Decl const*) /home/vagrant/infer/facebook-clang-plugins/libtooling/ASTExporter.h:1086:0
#21 0x00007f147773e150 ~unique_ptr /usr/include/c++/4.9/bits/unique_ptr.h:235:0
#22 0x00007f147773e150 ~ASTExporter /home/vagrant/infer/facebook-clang-plugins/libtooling/ASTExporter.h:175:0
#23 0x00007f147773e150 ASTLib::ExporterASTConsumer<ATDWriter::BiniouWriter<llvm::raw_ostream>, true>::HandleTranslationUnit(clang::ASTContext&) /home/vagrant/infer/facebook-clang-plugins/libtooling/ASTExporter.h:5110:0
#24 0x00000000026ab9d8 clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x26ab9d8)
#25 0x0000000002db2aac clang::ParseAST(clang::Sema&, bool, bool) (/opt/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x2db2aac)
#26 0x00000000029c1b57 clang::CodeGenAction::ExecuteAction() (/opt/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x29c1b57)
#27 0x000000000267be8e clang::FrontendAction::Execute() (/opt/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x267be8e)
#28 0x0000000002648d3e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x2648d3e)
#29 0x0000000002719750 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0x2719750)
#30 0x0000000000bae3c0 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0xbae3c0)
#31 0x0000000000b17f27 main (/opt/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0xb17f27)
#32 0x00007f147798eb97 __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#33 0x0000000000ba9549 _start (/opt/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0+0xba9549)
Stack dump:
0.	Program arguments: /opt/infer-linux64-v0.15.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-7.0 @/tmp/clang_command_.tmp.161b12.txt
1.	<eof> parser at end of file
Segmentation fault (core dumped)
Uncaught Internal Error: (Bi_inb.End_of_input)

Thanks.

@gy741 could you please retry with the latest master? A lot has changed in clang part of the Infer since, might have been fixed.


text:
[Feature]: Allow Absolute Path Imports in Custom Test Environment

🚀 Feature Proposal
Allow absolute imports in the custom test environment, e.g.
const NodeEnvironment = require('jest-environment-node');
import config from 'src/config';

class CustomEnvironment extends NodeEnvironment {
  constructor(config, context) {
    super(config, context);
  }

  async setup() {
    await super.setup();
    this.global.someGlobalObject = { key: config };
  }

  async teardown() {
    await super.teardown();
  }
}

module.exports = CustomEnvironment;

Motivation
Our entire repository uses absolute paths for imports. Jest does not appear to support absolute paths using an import in the custom test environment. This sample repository shows the error thrown when running yarn int.
 FAIL  src/resolver/account.integration.test.ts
  ● Test suite failed to run

    Cannot find module 'src/config'
    Require stack:
    - /Users/kylebanner/dev/ts-customtestenvironment-jest/src/testUtils/testEnvironment.ts
    - /Users/kylebanner/dev/ts-customtestenvironment-jest/node_modules/jest-util/build/requireOrImportModule.js
    - /Users/kylebanner/dev/ts-customtestenvironment-jest/node_modules/jest-util/build/index.js
    - /Users/kylebanner/dev/ts-customtestenvironment-jest/node_modules/@jest/core/build/cli/index.js
    - /Users/kylebanner/dev/ts-customtestenvironment-jest/node_modules/@jest/core/build/jest.js
    - /Users/kylebanner/dev/ts-customtestenvironment-jest/node_modules/jest-cli/build/cli/index.js
    - /Users/kylebanner/dev/ts-customtestenvironment-jest/node_modules/jest-cli/bin/jest.js
    - /Users/kylebanner/dev/ts-customtestenvironment-jest/node_modules/jest/bin/jest.js

      14 |   async teardown() {
      15 |     await super.teardown();
    > 16 |   }
         |    ^
      17 | }
      18 |
      19 | module.exports = CustomEnvironment;

      at Object.<anonymous> (src/testUtils/testEnvironment.ts:16:34)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        1.767 s

Pitch
I have made every effort to change jest.config to allow for absolute paths, but it appears absolute paths in the custom test environment are not supported. Absolute imports and aliases are widely accepted as a best practice when importing/requiring in NodeJS. The ability to add a custom object to globals is a great feature but if importing from a relative path is required it will necessitate refactoring for every file file chain.

The environment is loaded by Node (require or import), so you'd need to do something like https://nodejs.org/api/packages.html#packages_self_referencing_a_package_using_its_name. Jest only really control resolution etc within the test env, this is outside of that

authors: SimenB kyle-banner

repo: facebook/jest


text:
.eventually property on expectations (similar to .not) for testing observables

🚀 Feature Proposal
A chainable .eventually property, similar to .not, on expectations for awaiting/making assertions about observables. The chained assertion would be evaluated on each new value emitted by the observable. If the assertion passes, a returned promise would be resolved. If the assertion never passes (timeout), we could construct an informed timeout failure message that is aware of both the values seen and the assertion failures for each value.
Motivation
In attempting to write tests for redux-observable Epics it is common to want to write a test of the form:

Dispatch an action.
Wait for some async stuff to happen.
Assert that we ended in the correct state.
(Possibly repeat 1-3 some number of times)

The difficult part here is the first word of number 2: "Wait".
In an ideal case, we can await something concrete, like a mocked API call, however that is not possible in all cases. In cases where it is not, or where it would require exposing implementation details, an alternative is needed.
One alternative, which I believe is generic enough to work in the majority of cases, is to wait for the value to match some predicate. Expressing that predicate in the form of a Jest expectation is expressive while also giving Jest enough information to construct a helpful timeout error when the condition is never met.
I believe that while I encountered this need in the context of redux-observable, that it's generalize-able to other types of observable tests, and perhaps even other types of async tests.
Example
test('can fetch todos and mark one completed', async () => {
  const states = Observable.from(store);

  store.dispatch({type: 'FETCH_TODOS'});
  await expect(states).eventually.toEqual({1: {text: 'Do Homework'}});

  // Now that we know the async TODOS have come back, we can mark one as completed...
  store.dispatch({type: 'MARK_COMPLETED', id: 1});
  expect(store.getState()[1].completed).toBe(true);
});

Pitch

Why does this feature belong in the Jest core platform?

I don't see a way to build this in user land.
Known shortcomings
A simple predicate is not always sufficient to robustly detect all "completion states". For example:

An intermediate completion state (when it's safe to take your next action) may not be expressed in the given observable.
The value may oscillate between the desired end state and some undesired end state.

Jest may not be interested in adding API which is specific to observables.
I'd like to help
If this seems reasonable, I'd be happy to work on a pull request.
If there is some reasonable way to implement this outside of Jest Core, let me know. I'd be happy to try that first.
cc @aaronabramov

Also cc @matthewwithanm who may have some opinions on this.

I really like this idea, it fits pretty nicely besides resolves and rejects.

I don't see a way to build this in user land.

I wonder if it is possible - we support asynchronous matchers now (only in master and in the RCs, #5919), so you should in theory be able to build it outside of core. Would be interesting to see if it's possible at least 🙂

I've played with this a bit more, and I think it may not be such a great API. The problem is that Observables as opposed to BehaviorSubjects do not have access to previous values.
So, if store.dispatch({type: 'FETCH_TODOS'});, in the example I gave, changes to resolve synchronously, there will be no state updates for it to run the predicate against, so it will simply timeout even thought we did still end up in the expected state. I think this is probably too confusing and error prone.

authors: SimenB captbaritone


text:
Testing function called as a parameter of another function

🐛 Bug Report
I am trying to test that a function is called and has a function as parameter. Trying to test it with a react component that is dispatching an action.

Here is the code of the component
import React from 'react';
import { connect } from 'react-redux';
import moment from 'moment';

import { startToggleTodo } from 'Actions/actions';

export class Todo extends React.Component {
    constructor(props) {
        super(props);

        this.onClick = this.onClick.bind(this);
    }

    onClick(event) {
        this.props.dispatch(startToggleTodo(this.props.id, !this.props.completed));
    }

    render() {
        ...
        return (
            <li className={ `list-group-item ${this.props.completed ? 'completed' : ''}` } onClick={ this.onClick }>
                ...
            </li>
        );
    }
};

export default connect()(Todo);

And here is my test
import React from 'react';
import { shallow } from 'enzyme';

import { Todo } from 'Todo';
import { startToggleTodo } from 'Actions/actions';

describe('Todo', () => {
    ...
    it('should dispatch TOGGLE_TODO action on click', () => {
        var todoData = {
            id: 199,
            text: 'Test features',
            completed: true
        };

        var action = startToggleTodo(todoData.id, !todoData.completed);

        var spy = jest.fn();
        var TodoTest = shallow(<Todo { ...todoData } dispatch={ spy } />);

        TodoTest.find('li').simulate('click');

        expect(spy).toHaveBeenCalledWith(action);
    });
});

And I get this message from the test:

To Reproduce
Just create a component like above and a test too. The action called is just a regular function that receives 2 parameters. Dispatch should be called with that function.
Don't know if I am testing it the wrong way.
Don't know if it is relevant but I am running the tests in npm with the following;
jest --verbose --setupFiles ./jest.config.js

Here is the action if needed
import moment from 'moment';

import firebase, { firebaseRef } from './../firebase/index';

...

export const updateTodo = (id, updates) => {
    return {
        type: 'UPDATE_TODO',
        id,
        updates
    };
};

export const startToggleTodo = (id, completed) => {
    return (dispatch, getState) => {
        var todoRef = firebaseRef.child(`todos/${id}`);
        var updates = {
            completed,
            completedAt: completed ? moment().unix() : null
        };

        return todoRef.update(updates).then(() => {
            dispatch(updateTodo(id, updates));
        });
    };
};

Expected behavior
I expect the function to be called and the test to pass. When I test in the browser it works as expected.
Link to repl or repo (highly encouraged)
I don't have a public repo. If is really needed I can create one.
Run npx envinfo --preset jest
Paste the results here:
System:
  OS: Windows 10
  CPU: x64 Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
Binaries:
  npm: 5.6.0 - C:\Program Files\nodejs\npm.CMD

You should assert on action values (e.g. call the action as it's probably an action creator which will return an object) instead of it being a function.
Also, this is not a help forum. You'll find more on Jest docs help page. Thank you :)

On the other hand, does it make sense for toHaveBeenCalledWith to support anonymous functions? cc @rickhanlonii @SimenB

Sorry, really thought that this was a bug since he is saying that it expects to be called with a function and it is called with a function.
Thanks for the help!

You can use .toHaveBeenCalledWith(expect.any(Function)). Not sure of the assertion error cpuld be improved? Saying something like 'function equality' blah blah

@SimenB That would work and would let me know if it was called with ANY function, right? But, in this case, there is no possible way to know that it was called with that specific function. Or is it?

You'll need a reference to that function, then.
https://repl.it/repls/ClosedRevolvingNotification

does it make sense for toHaveBeenCalledWith to support anonymous functions

It should handle the same anon function, but calling startToggleTodo returns a new function instance every time it's called, so the functions are not equal

@SimenB Got what you are saying and saw the example, but in this case it does not work for me.
I think my problem here is what @rickhanlonii said. I don't see any possible way I can test that the function was called

On the other hand, does it make sense for toHaveBeenCalledWith to support anonymous functions? cc @rickhanlonii @SimenB

Is there a definitive reply to this, besides
.toHaveBeenCalledWith(expect.any(Function))

I have the same issue... i had used toHaveBeenCalledWith(expect.any(Function)) to test it but i need to cover this situation... i tried some ways but it didnt work. Any idea?

Have exactly the same problem - need to test, if the anonymous function, that is the argument to a toHaveBeenCalledWith(), is the right one.
As I understand it, 'anonymous function' is just another  way of saying 'reference to a function body', isn't it? Is there a way to somehow de-reference this body and parse the actual function code?

I don't if my solution is fully correct but what I do is turn functions to .toString() and compare their values.
I want to test if a dispatch was called with a specific 'thunk' so I do
expect(mockedStore.dispatch.mock.calls[0][0].toString()).toBe(userLogout().toString())
Up to now it works for me.

erm...does this really checks the code of the function, or just the return value?

Checks the code. The userLogout() is actually a thunk, so it returns another function of form dispatch => {....}. So to toString() actually compares the implementations of the two functions.

oh cool - will try that asap. thanks!

just as an FYI this will not work if you do code coverage, istanbul will inject values for inspection and this breaks string equality

@nk2580 Using jest code coverage was not an issue for me. Haven't tried instanbul though.

Another approach that we can use for test coverage is
spyOn on function inside anonymous function or assert it return by calling it
mockedStore.dispatch.mock.calls[0]0

I have the same issue... i had used toHaveBeenCalledWith(expect.any(Function)) to test it but i need to cover this situation... i tried some ways but it didnt work. Any idea?

I have something similar. any solution for this type of case?

authors: SimenB TunvirRahman aakashrshah ahinvision db585 killerchip luissmg nk2580 rickhanlonii thymikee yurilongaray


text:
toHaveBeenCalledWith does not "snapshot" parameters and fails when they are updated

🐛 Bug Report
When an object passed in parameter of a mocked function is updated, the reference is used, and the test with toHaveBeenCalledWith simply fails
To Reproduce
it('test', () => {
  const update = jest.fn().mockImplementation(obj => {
    obj.id = 'xyz';
  });

  const proceed = (obj: any) => {
    update(obj);
    return obj;
  };

  const item = { label: 'test' };

  proceed(item);

  expect(item).toEqual({ id: 'xyz', label: 'test' });
  expect(update).toHaveBeenCalledWith({ label: 'test' });
});

Expected behavior
Should pass; instead, fails with:
    expect(jest.fn()).toHaveBeenCalledWith(expected)

    Expected mock function to have been called with:
      {"label": "test"} as argument 1, but it was called with {"id": "xyz", "label": "test"}.

      14 |
      15 |   expect(item).toEqual({ id: 'xyz', label: 'test' });
    > 16 |   expect(update).toHaveBeenCalledWith({ label: 'test' });
      17 | });
      18 |

      at Object.<anonymous>.it (src/xxx.test.ts:16:18)

Run npx envinfo --preset jest
Paste the results here:
npx: installed 1 in 2.248s

  System:
    OS: macOS High Sierra 10.13.4
    CPU: x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
  Binaries:
    Node: 8.9.3 - ~/.nvm/versions/node/v8.9.3/bin/node
    Yarn: 1.7.0 - /usr/local/bin/yarn
    npm: 5.7.1 - ~/.nvm/versions/node/v8.9.3/bin/npm
  npmPackages:
    @types/jest: ^22.2.0 => 22.2.0
    jest: ^22.4.3 => 22.4.3

Duplicate of #4715

Ok, thanks,
For my needs, I little updated the given solution with
import { cloneDeep } from 'lodash';

export function deepSpyOn<T extends {}, M extends keyof T>(object: T, methodName: M, implementation?: (...args: any[]) => any): jest.Mock {
  const fn = jest.fn();
  const method = (implementation || object[methodName]) as (...args: any[]) => any;
  (object as any)[methodName] = (...args: any[]) => {
    fn.apply(null, cloneDeep(args));
    return method.apply(object, args);
  };
  return fn;
}

I did not found right now an elegant solution to both deep clone & use a mockImplementation without adding a kind of option in the core of mockImplementation to deep clone its arguments

authors: SimenB jbdemonte


text:
Make Jest’s Test Runner configurable.

Summary
This change adds a runner option to ProjectConfig that points to jest-runner but can be customized per project to any test runner. To ensure performance doesn't suffer with this new feature when using the MPR, multiple contexts that point to the same runner are merged and tests are run in the same runner instance, rather than creating a new instance per context. This means that there should be no performance penalty for existing MPR projects.
This is conflicting somewhat with the testRunner option that allows to pick jest-jasmine2 or jest-circus, however in this new world ProjectConfigs will be entirely jest-runner specific and variadic, and out of Jest's immediate control, so I don't think this matters long term and there are pending changes to be made to configs to support that. I think it makes more sense to consider this option the runner, add an option library (for lack of a better name) which replaces testRunner. I think we can make this decision later and I expect there to be more runners than testRunners going forward, so we may even want to kill the setting entirely and make the runner as compose-able as possible.
Test plan
jest + manual verification that it only creates one runner for the MPR right now.

You need to update the config snapshot

authors: cpojer thymikee


text:
Added import to documentation

Thank you for the PR! Contributors like you keep React Native awesome!
Please see the Contribution Guide for guidelines:
https://github.com/facebook/react-native-website/blob/master/CONTRIBUTING.md
If your PR references an existing issue, please add the issue number below:
#

In fact, if we add the import in the example, we should wrap the lifecycle inside a proper React class.

Thank you for your PR. I think this example isn't great overall but just adding the import isn't really solving that. We are planning on rewriting most of this in the near future so I'm going to close this PR.

authors: charpeni cpojer danielbenedykt

repo: facebook/react-native-website


text:
js api facebook-chat-api doesn't run with react-native

I am trying to work with this api with react-native, but after import - var login = require("facebook-chat-api"); i am getting error

I tried clean installation again, but same error, any experiences with this error message?

So i fixed this error message by setting debug mode on, but now i am getting new error

After adding any node module I think you always have to restart the react native packager (react-native start), otherwise you get that 500 error.

I tried to delete entire project and create new, with restarting android, and computer too :D so it isn't this case :/

Try doing:
import { login } from "facebook-chat-api";

They're not exporting a default here: https://github.com/Schmavery/facebook-chat-api/blob/master/index.js#L433

I tried, but same.. and when i am using debug mode, i am getting
13:53:22 Adb connection Error:An existing connection was forcibly closed by the remote host
13:53:23 Connection attempts: 1

It has something in common with... ?

Don't think so. Try restarting your emulator.

I tried too... i restarted entire computer too :D same error all time :/ with new project too.. i just cant import anything from facebook-chat-api..

Closing this issue because it has been inactive for a while. If you think it should still be opened let us know why.

authors: Ehesp Proberts hramos uragecz

repo: facebook/react-native


text:
[PermissionsAndroid] request is not prompting and always return true

Description
I want to use the camera in my react-native application on Android. For this, I'm using the Camera from https://github.com/lwansbrough/react-native-camera.
So, in order to this, i'm using PermissionsAndroid to make sure that the user has the access to the camera. Here comes my problem.
I'm using the code from the doc (here https://facebook.github.io/react-native/docs/permissionsandroid.html) to do the request permission on camera and I'm having an issue with this as it never asks me to allow the camera and always returns true, even if I disable the camera permission on my device.
Here is the scenario when camera permission access is granted :

Here is the scenario when camera permission access is not granted :

Reproduction
What I'm doing is simply this :
export async function requestCameraPermission() {
  try {
    const granted = await PermissionsAndroid.request(
      PermissionsAndroid.PERMISSIONS.CAMERA,
      {
        'title': 'Cool Photo App Camera Permission',
        'message': 'Cool Photo App needs access to your camera ' +
                   'so you can take awesome pictures.'
      }
    )
    if (granted === PermissionsAndroid.RESULTS.GRANTED) {
      console.log("You can use the camera")
    } else {
      console.log("Camera permission denied")
    }
  } catch (err) {
    console.warn(err)
  }
}

  async componentWillMount() {
    await requestCameraPermission() // which always returns "You can use the camera" even if I disable camera permission access on my device
  }

Additional Information

React Native version: 0.40
Platform: Android 7.1.1
Development Operating System: Linux (Ubuntu 16.04)
Dev tools: android:minSdkVersion="16" android:targetSdkVersion="23"

I'm also experiencing this issue using https://github.com/yonahforst/react-native-permissions/ : https://github.com/yonahforst/react-native-permissions/issues/86

Hi, I had the same problem.
I solved it by changing the targetSdkVersion ( same to compileSdkVersion, in my case 23) in  android/app/build.gradle.

Much thanks @daniel90daniel  !!!!!!
I did what you did and this is now working perfectly !
If some guys are experimenting the same issue, be careful because as I said in my issue, my dev tools are android:minSdkVersion="16" android:targetSdkVersion="23" BUT those are the infos in my AndroidManifest.xml... in my android/app/build.gradle, the targetSdkVersion was 22 and not 23, and putting it to 23, as @daniel90daniel said, makes it work for me now !

@Blapi SDK <23 returns true, can not judge

@TrustTheBoy I don't know what you mean, I just had this issue because I was using a targetSdkVersion < 23, just setting it to 23 and everything worked for me. The user can now choose to allow/decline permissions because before that, it was granted automatically, even the dangerous ones.

@Blapi  if SDK< 23 PermissionsAndroid returns the result is always true, if so, Android 6.0 before the device can not detect whether the user manually closed the permissions

@Blapi According to your method, targetSdkVersion = 23 after, and did not solve, China's Android device there are most users of the system version is 6.0 before

@TrustTheBoy ???

@aronse I just want to say android 6.0 before the device how to detect, and no other meaning

@TrustTheBoy I guess we cannot trust you

Oh ok I see @TrustTheBoy thanks for the explanation it's crystal clear 👍👍

You do not believe me, hey, what am I doing wrong? Gentlemen, I did not lie to you 😭😭😭😭

First time user  permission given, but every time it go into to else  "show  Read Phone State permission denied"
try {
const granted = PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.READ_PHONE_STATE,
{
'title': 'Read Phone State Permission',
'message': 'To access you device data we needs access to Phone State '
}
)
  console.warn("DFA = ",granted)
  if (granted === PermissionsAndroid.RESULTS.GRANTED) {
    console.log("Device Unique ID", DeviceInfo.getUniqueID());

    console.log("Device Manufacturer", DeviceInfo.getManufacturer());

    console.log("Device Model", DeviceInfo.getModel());

    console.log("Device Name", DeviceInfo.getSystemName());

    console.log("Device Version", DeviceInfo.getSystemVersion());

    console.log("Bundle Id", DeviceInfo.getBundleId());

    console.log("Build Number", DeviceInfo.getBuildNumber());

    console.log("App Version", DeviceInfo.getVersion());

    console.log("App Version (Readable)", DeviceInfo.getReadableVersion());
  } else {

    console.log("Read Phone State permission denied")
  }
} catch (err) {

  console.log("errr",err)

}

This is because PermissionsAndroid.request returns a promise, you should put your method as async and await PermissionsAndroid.request as it still clearly stipulated on the doc.
https://facebook.github.io/react-native/docs/permissionsandroid.html

Thanks Blapi,
But when i function as async  it will give error , " Unexpected Token"
please check below Image

https://stackoverflow.com/questions/43070702/typescript-unexpected-token-a-constructor-method-accessor-or-property-was-exp

Hi ,
In my case its always return true and alert

"You can use the camera..1."

export default class Tab3 extends Component {
async requestCameraPermission(){
if(Platform.OS === 'ios'){
alert("You can use the camera ios");
}else{
const chckCamera =PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.CAMERA);
if(chckCamera === PermissionsAndroid.RESULTS.GRANTED){
alert("You can use the camera..0.");
}else{
try {
const granted = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.CAMERA,
{
'title': 'Cool Photo App Camera Permission',
'message': 'Cool Photo App needs access to your camera ' +
'so you can take awesome pictures.'
}
)
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
alert("You can use the camera..1.");
} else {
alert("Camera permission denied");
}
} catch (err) {
alert(err)
}
}
}
};
render() {
	return (

<Button block rounded onPress = {() => this.requestCameraPermission()} >
Camera

  </Container>

	);
}

}
compileSdkVersion 26
buildToolsVersion "26.0.1"
Android Emulator-Android Oreo 8.0.0
Can some check where i have done wrong or missed anything ?

@nitin0331 have you got any solution for the reported case? I'm stuck with it too.

@fahidmohammad the same code i have mentioned above start working after i have changed in gradle file of the android app.
minimum compilesdk/build too  version should be 23 .
Hope this will help.

@nitin0331 downgrading the version was never a solution for me, but luckly i've got a better  fix here.

but the weird thing is that i have integrating camera and its take 2 days and still lots more error in react-camera . So if you can help me on the same.

I believe the permission if what you are referring to? or could you share more info what exactly you the issue you are facing?