How can I search emojis by name?

I want to creat a rust function that take a string input as a search term then return emojis. For example if the input "smile" is should get smile 😊 😃 😄

At present there is no way to search through all emojis. But for groups you can use this function and search by yourself. It would be a good adition. @Cryptjar do you have any ideas

Well, I guess, base_emojis might be a better start point.


Multipart upload stopped working when updating from 2.1.0 to 2.1.1

Hi DW-Team! 🙂
One of our tests stopped working after updating to Dropwizard 2.1.1. At first glance I thought it was caused by updating Jersey to 2.36 and created an issue in their repo: https://github.com/eclipse-ee4j/jersey/issues/5094
Then I found your update notes: https://www.dropwizard.io/en/latest/manual/upgrade-notes/upgrade-notes-2_1_x.html#modification-of-the-client-in-dropwizardappextension
Can you decide if there are more changes needed for migration? It does not seem to be 100% backwards compatible.
Cheers,
Christopher
Edit:
I could get my test running when I go back to the old client as documented in your upgrade notes. Do you think we should close this issue again?

Hi @christopher-cudennec. I think the upgrade notes should be enough. It wasn't an optimal solution to introduce the connector in 2.1.1, but we had to do so for proper Java 17 support. Since we provided a workaround, users can easily mitigate the problem by using that.

Thanks for clarification. If it helps with using Java 17 I really appreciate the change 🙂


enable top most nodeName

Make selectMode::selection's elements' nodeName available for DOM parsing
For instance if a user's selection is [H3, P, P, H3, P, P], the parser will treat them as [P, P, P, P, P, P]. The fix is necessary for enabling customized wraps on block DOM elements like H1~H6 and BLOCKQUOTE while using sibling elements selection.

Another great PR, thanks! :D

I have several feature commits in my local dev branch, is there anything that you think you would like to see in a PR?

Font-weight option in option page;
Width option for word box in option page;
Use {left: "#", right: ""} to wrap H1~H6;
Use {left: "›", right: ""} (U+203A) to wrap BLOCKQUOTE;
Grant paragraph modifiers to DL, UL and OL.

Yes please! They all sound good :+1:


Eslint breaks path modules when I try to refactor  tags

I've refactored many Fragment tags to the new pattern <>. But when I tried to refactor Fragment tags of specific files, the pre-commit structure has been blocked it, displaying errors about paths. The picture below illustrates the situation: The same path works in one place (Login.js) and doesn't work in another one (MobileLayout.js).

Browser Name: Google Chrome
Browser Version: 86.0.4240.111
Operating System: MacOS

Hi @evertonrbraga this should be resolved if you run npm run develop. That file gets generated as part of that.

Hi @evertonrbraga. I would recommend following our contributing guide closely. Closing but feel free to reach us in the help channels mentioned in the guide.


Address memory issues

When running biggish systems (500 states, 2000 samples/state), it takes between ~11 and 20 GB or so (on OS X), but only about 4 minutes. Once it exceeds the memory of the computer, then it slows down by a factor of 4-5. So for the largest systems on a standard memory computer, the time limiting factor becomes is memory swaps, not computation.  So we should spend some time figuring out how to minimize memory usage.
Note there still maybe value in solving the <10GB problem in seconds, not minutes, so acceleration could still be very good!

Some ideas for memory profiling here.

Started going through memory profiling.  Once using mprofile, I identified approximately where the issues were, and then just stepped through with PDB to discover the exact commands.
Fundamentally, there are large data structures that are NxK large that are very hard to avoid.  We need to know the u_kn matrix to do anything.  We need to keep track of the W_kn weights.

For the u_kn matrices, fundamentally, we need the data.  However, we might want to have the option to have u_kn be a callable function.  Exactly how to implement it will depend on the situation. For example, if the k states are K temperatures, then it's very easy to implement such a function. But if you need to evaluate an alchemical potential it could be complicated.  And accelerating such a function within the context of the mbar evaluations would be nontrivial.

The formula for the w_kn are w_kn = exp(-u_k(x_n)) / \sum k N_k exp(f-u_k(x_n).  It seems like it might be possible to just store the Nx1 denominators d(x_n), and reconstruct the NxK entries of the matrix when needed in the calculation, without creating the full matrix. We should probably store the log weights, for underflow reasons, but then in that case \log w_kn = -u_k(x_n) - \log d(x_n), and we can easily keep the simple sum, which with accelerated computations should be cheap.  However, rewriting this touches some of the most compute time-sensitive parts of the code, so should probably be done in conjunction with computational acceleration.

It does seem that at minimum we should not have more than one u_kn and one w_kn matrix stored, and maybe just one u_kn. So we should see if we could do some calculations in place. Any thoughts appreciated!

However, there are a number of things that could potentially be memory optimized beyond "keep one w_kn and one u_kn).   I'll start keeping track of those in extra comments.

OK, so one thing that surprises me that takes extra memory: in precondition_u_kn(u_kn, N_k, f_k), the command:
u_kn = u_kn - u_kn.min(0)
Increases the memory by quite a bit. In this case, exactly the size of the u_kn array (which for 500 x 500000, is 1.91 GB).  So it to seems to be creating a completely new array (checked by calling u_kn.array before and after, new address).
if I call it 2X, the memory increases permanently by the same 1.91 GB increment.  If I KEEP calling it after that, then the memory increases temporarily by the same amount, but then drops down to what it was before.  So the permanent increase is only 2x, but he address keep changing.  Beats me!
Just testing, this same behavior occurs if I subtract a constant from the 2D array, instead of a 1D vector.  Probably it should be min(axis=0) for clarity, but that doesn't affect the memory usage.
If I use u_kn = np.add(u_kn,-u_kn.min(axis=0)), then the memory usage increase to 2x only occurs during the 2nd command, but only is 1x permanently.
Yeah, I have no idea why.
Ah, potential solution:  np.add(u_kn,-u_kn.min(axis=0), out=u_kn).  Apparently, the output will be a fresh array if you do not specify out, even if you are overwriting the same variable.
This seems to preserve the array location (sends the output to the same array, AND is faster (the speed issue seems to be memory allocation).
After this change, the entire process seems to run at lower memory, so it seems to be a permanent fix.
I will investigate other places this happens.

Actually:
u_kn =-  u_kn.min(axis=0) works fine.

Just not:
u_kn = u_kn - u_kn.min(axis=0)

Who knew?

OK, another initial memory opening is the function call:
f_k_nonzero, all_results = solve_mbar(u_kn[states_with_samples], N_k[states_with_samples], f_k[states_with_samples], solver_protocol=solver_protocol)

Specifically the creation of the array u_kn[states_with_samples], which is a different array than u_kn.  Because all of the states have samples in this example, it's simply copying the array into a new one. It could be in cases where all states had samples, then one should simply pass the u_kn array.  Not sure if it would be worth doing in general.

Another memory hog:
Line ~200 of init does:
self.u_kn = np.array(u_kn, dtype=np.float64)

Which creates a new array u_kn.
I will change this to:
 self.u_kn = np.array(u_kn, dtype=np.float64, copy=False)

Which reformats (if needed) in place.

in mbar_gradient:
log_denominator_n = logsumexp(f_k - u_kn.T, b=N_k, axis=1)
log_numerator_k = logsumexp(-log_denominator_n - u_kn, axis=1)
The logsumexp temporarily raise the memory by 2x size(u_kn), but that is temporary by the end of the function.   Similar behavior with the mbar_hessian function and self_consistent_iteration.  Since these are going to be reoptimized, it's not clear it makes sense to clean up memory for now.

OK, after some more testing, I've concluded that it's not really possible to free up memory now.
There are two places where input u_kn energy data is duplicated, and then manipulated to make the data more numerically stable in various calculations (basically, ones where one computes ratios of exponentials of energies - you need do subtract of the minimum to prevent over/underflow.  If the data were entirely internal from that point forth, then the data would not need to be duplicated, but could just be copied over with the manipulated data. However, in many cases, this data is then used again after the call.  You don't want to the input data to be altered during the simulation run!
The other possibility to fix this is that the numerical stabilization could be run DURING the calculations that require numerical stabilization (i.e. computing expectations), instead of done beforehand.  However, it wouldn't really make sense to do this before because of the computational overload (and increase in complexity) except after the calculations are accelerated.
To see more details check closed branches #359 and #383.


[NEW]:

Please use this template to suggest a new event or update an existing event for the BBW website! You can also directly submit your event as a pull request to this repository. This will speed up things significantly!
name = “CryptoConverge with Kraken powered by DLT Finance”
shortname = “CryptoConverge with Kraken powered by DLT Finance”
types = [“meetup”]
status = “published”
org = “w3.fund”
dri = “tarahabsburg"
poc = “Vicktoria Klich”
date = “2024-05-22"
days = 1
times = “19:00-23:00”
venueName = “w3.hub”
languages = [“english”]
tags = [“kraken”, “dlt finance”, “w3.hub”]
logo = “BBW - Kraken x DLTF.png”
# a description of the event.
description = “”"
Join us at CryptoConverge with Kraken powered by DLT Finance during Berlin Blockchain Week for a dynamic event where industry leaders, innovators, and enthusiasts come together to explore the future of decentralized finance and blockchain technology. Engage in insightful discussions, network with fellow crypto enthusiasts, and discover the latest trends shaping the digital asset landscape.
“”"
[cfp]
link = “https://lu.ma/krakenDLTfinance”
[registration]
type = “invites”
price = “Free!”
link = “https://example.org/tickets”
#button = “Request tickets!”
status = “available”
[links]
web = “https://lu.ma/krakenDLTfinance”

Your event is added live, please double check :) https://blockchainweek.berlin/24

HI kusdogan, thank you for posting! We realised that we pasted an invalid link for the ticket request, could you update it with the following:
name = “CryptoConverge with Kraken powered by DLT Finance”
shortname = “CryptoConverge with Kraken powered by DLT Finance”
types = [“meetup”]
status = “published”
org = “w3.fund”
dri = “tarahabsburg"
poc = “Vicktoria Klich”
date = “2024-05-22"
days = 1
times = “19:00-23:00”
venueName = “w3.hub”
languages = [“english”]
tags = [“kraken”, “dlt finance”, “w3.hub”]
logo = “BBW - Kraken x DLTF.png”
# a description of the event.
description = “”"
Join us at CryptoConverge with Kraken powered by DLT Finance during Berlin Blockchain Week for a dynamic event where industry leaders, innovators, and enthusiasts come together to explore the future of decentralized finance and blockchain technology. Engage in insightful discussions, network with fellow crypto enthusiasts, and discover the latest trends shaping the digital asset landscape.
“”"
[cfp]
link = “https://lu.ma/krakenDLTfinance”
[registration]
type = “invites”
price = “Free!”
link = “https://lu.ma/krakenDLTfinance”
#button = “Request tickets!”
status = “available”
[links]
web = “https://lu.ma/krakenDLTfinance”

Should be fixed thanks https://blockchainweek.berlin/24


[de] Generalize German article usages

Making article usage optional in general along with accepting inputs with wrong grammar.
Closes #948
Some additional notes:
I decided to include the [...] part right into the artikel expansion rules to encourage optional article usage whenever possible (instead of leaving it to the user as in [<artikel>]). Cases in which an article is actually required will probably be very rare.
A few hardcoded usages remained, because I couldn't replace them without running into an AssertionError: Recursive rule detected issue. This is true when using the same placeholder multiple times in the same rule (e.g. I couldn't replace the second [der] in alle: "((alle|sämtliche)[r]|jede[r|s|n]|<artikel> (ganze|komplette|sämtliche)[n]) [der]). I think I already saw an open issue for this somewhere.
I added a few new tests, but didn't want to scatter incorrect grammar usages all over the place, as those tend to increase confusion when reading.

@easterapps @mib1185 May I ask, if you're still going to review this PR?
 I understand that open source work may just need time. If that's the case, that's of course alright. Nevertheless, I'd actually like to propose other PRs, but don't think that makes sense before this one got handled.

@easterapps @mib1185 May I ask, if you're still going to review this PR?
 I understand that open source work may just need time. If that's the case, that's of course alright. Nevertheless, I'd actually like to propose other PRs, but don't think that makes sense before this one got handled.

Sorry for the late review, I will do it today.


No podspec

Hi,
We are facing an issue when trying to implement IDFA plugin :
[!] No podspec found for 'segment_analytics_plugin_idfa' in '.symlinks/plugins/segment_analytics_plugin_idfa/ios'
Maybe there is a mistake on the configuration of the podspec on your side ?
Thank you for investigating.

Hi @devmobile-vulog  thank you for your report. We start looking into this.

hi @devmobile-vulog sorry to answer late:
You can use this configuration on you pubspec.yaml:

And you can call like this on your code:

Hi @edsonjab
It works fine, thank you.
However, now i am not able to apply the IDFA Plugin to the analytics client instance. When trying to call addPlugin(PluginIdfa()) method, i am faced to this error :
The argument type 'PluginIdfa' can't be assigned to the parameter type 'Plugin'
Maybe i am missing something about the configuration.
The documentation says : Follow the instructions for adding plugins on the main Analytics client but the url is not working anymore.
Could you please provide the right url or tell me what i am missing please ?
Thank you !

Hi @devmobile-vulog this the new URL with the instructions to add plugins.

Hi @edsonjab ,
Thank you for providing the right url. Everything seems to be good on configurations side.
However, there is still an error when trying to add the plugin: it seems that there is a conflict on imports into the package, and an alias is missing for the 'plugin.dart' import into 'analytics.dart' class (I think there is a name conflit with another Plugin class) causing the following error :
The argument type 'PluginIdfa' can't be assigned to the parameter type 'Plugin'
Thank you !

Hi @devmobile-vulog you can add a cast on the line when you add your plugin
analytics.addPlugin(PluginIdfa() as Plugin);
I have identified the problem, we will fix the issue.

Updating the podspec name to segment_analytics_plugin_idfa fixes this issue.


Equip ever command with at least one example

ever? or every?

You know, I looked at that title on multiple occasions and kept feeling like something was :potato:

@wkoszek Is this another confusion with the similar ruby based project? It sounds like you're saying there aren't tests? We have quite a few integration tests located here: https://github.com/zaquestion/lab/tree/master/cmd
You can checkout the coverage here as well https://codecov.io/gh/zaquestion/lab
Regarding help, when you run lab help the git help is printed and we append on our own commands
These GitLab commands are provided by lab:

  ci            Work with GitLab CI pipelines and jobs
  fork          Fork a remote repository on GitLab and add as remote
  issue         Describe, list, and create issues
  mr            Describe, list, and create merge requests
  project       Perform project level operations on GitLab
  snippet       Create a personal or project snippet

From there you can use these help command/flags to get more information. This is where the examples would be store as well.
$ git help ci
Work with GitLab CI pipelines and jobs

Usage:
  lab ci [command]

Available Commands:
  lint        Validate .gitlab-ci.yml against GitLab
  trace       Trace the output of a ci job
  view        (beta) render the CI Pipeline to the terminal

Use "lab ci [command] --help" for more information about a command.

$ git ci --help
Work with GitLab CI pipelines and jobs

Usage:
  lab ci [command]

Available Commands:
  lint        Validate .gitlab-ci.yml against GitLab
  trace       Trace the output of a ci job
  view        (beta) render the CI Pipeline to the terminal

Flags:
  -h, --help   help for ci

Use "lab ci [command] --help" for more information about a command.

Additionally you can view the help with the generated docs over here: https://zaquestion.github.io/lab/

@zaquestion Yes. Feel free to ignore my feedback here. I was trapped by 2 commands having the same name here.


Uncaught SyntaxError: Unexpected token u

I'm in the process of switching a large code base from RequireJS and AMD to webpack and CommonJS. My configuration seems fine, and there are no errors when I run:
webpack -d --display-error-details
However when I launch the application on my localhost (the server is Django/Python), I'm getting a single error in the JavaScript console on line 1 of localhost:
Uncaught SyntaxError: Unexpected token u
I assume something is undefined, but I'm not sure how to track this down since the error doesn't mention an entry file, chunk file, or any other JavaScript file in particular—just localhost:1. Moreover, my application actually seems to be working.
Any ideas? (By the way, webpack is freaking awesome!)

Nevermind. This was totally my fault. I discovered some code that was trying to JSON.parse() the undefined value. The Firefox console actually showed me the correct line number in my 1.bundle.js file. I'm not sure why Chrome was saying line 1.


Feature: Allow initialization via constructor arguments.

@eyas-ranjous – I want to start by thanking you for this library; for classical, mutable ADTs it is compendious. These abstract data types are an essential addition to the JavaScript language that I know we all wish were part of the language. I wanted to ask you if allowing for initialization values via the constructor is something you would be willing to add (or allow via PR), for the collection types (e.g. Stack, Queue, Set, etc.). Signatures similar to those of Immutable.js is what I had in mind.

The example below is for a stack but would apply to other applicable collection types

e.g.
// Stack<T>(): Stack<T>
let s1 = ds.stack();
// s1._elements === []

// Stack<T>(collection: Iterable<T>): Stack<T>
let s2 = ds.stack([1, 2, 3]);
// s2._elements === [1, 2, 3]

@clarketm I appreciate your feedback and thanks for the suggestion 👍yes it makes sense to enable initializing the structures from constructor, I built them without taking that in consideration, please feel free to submit a PR and assign it to me for review. Cheers!

@eyas-ranjous – Sorry, I haven't had the time recently to work on this, but I still have this feature request planned. I can revisit this in the coming weeks at which time we can reopen if this is still something of interest.

no worries. please feel free to re-open it and add the feature. cheers!


⚠ Bofrost.be has degraded performance

In 0e55bdd, Bofrost.be (https://www.bofrost.be) experienced degraded performance:

HTTP code: 200
Response time: 957 ms

Resolved: Bofrost.be performance has improved in 0a1b057.


Add multiplier for estimate fee

use 1.5 coefficient for fee estimation, for both gas_price and max_amount

hey @rianhughes looking to pick up a contribution, can you explain where i should add the coefficient?


Fix CONTRIBUTING.md

Fixes typo in CONTRIBUTING.md

Closes #57, fixing repetition of "issues".

Thanks for catching that one!


[flutter_tools] update dart cache clear hint

This pull request proposes to update the output message of flutter doctor when encountering issues related to the Dart cache. Currently, it suggests using the command dart pub cache clear which doesn't exist. Instead, it should recommend using dart pub cache clean as it is the correct command to clear Dart's cache.
Steps to reproduce the issue:

Run flutter doctor.
If an existing Pub cache issue is found, the output message includes a suggestion to run dart pub cache clear.

Expected Result:
The output message should suggest running dart pub cache clean to clear Dart's cache.
Actual Result:
The output message suggests running dart pub cache clear, which is not a valid Dart command.

flutter --version
Flutter 3.10.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 9cd3d0d9ff (8 days ago) • 2023-05-23 20:57:28 -0700
Engine • revision 90fa3ae28f
Tools • Dart 3.0.2 • DevTools 2.23.1

Pre-launch Checklist

[x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
[x] I read the [Tree Hygiene] wiki page, which explains my responsibilities.
[x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
[x] I signed the [CLA].
[ ] I listed at least one issue that this PR fixes in the description above.
[x] I updated/added relevant documentation (doc comments with ///).
[x] I added new tests to check the change I am making, or this PR is [test-exempt].
[x] All existing and new tests are passing.

Your test is failing on CI:
01:24 +2359 ~2 -1: test/general.shard/dart/pub_get_test.dart: shouldSkipThirdPartyGenerator skips pub get if the package config "generator" is different than "pub" [E]
  Expected: contains 'It can be reset by running `dart pub cache clean`'
    Actual: 'Skipping pub get: generated by third-party.\n'
              ''
     Which: does not contain 'It can be reset by running `dart pub cache clean`'

  package:matcher                                  expect
  test/general.shard/dart/pub_get_test.dart 249:7  main.<fn>.<fn>

https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8778805477762119169/+/u/run_test.dart_for_tool_tests_shard_and_subshard_general/test_stdout

Thanks for submitting this, however, it was since fixed in https://github.com/flutter/flutter/pull/128171.

Well that's break my heart
But I understand that because of lack of skills, I'm not able to contribute the correct code as it suppose to be.
Sincerely, codenoid

Well that's break my heart
But I understand that because of lack of skills, I'm not able to contribute the correct code as it suppose to be.

It's definitely not because of a lack of skills. As this was a high profile bug, we had many PRs submitted to fix it, however only one had tests that were all passing, so I merged that one.
Please don't be discouraged from contributing in the future. To maximize the odds your PR is merged, I would suggest:

ensure the change you want to make is being tracked by an issue. ensure that tracking issue is not already assigned to someone.
If it is a non-trivial change (this was a trivial change), outline your general approach first in the issue and try to get approval from a maintainer. This is not required, but it may save you from spending time working on a feature and having a reviewer say, "I actually don't agree with this approach, sorry I have to close this PR".
Ensure you follow all the steps in the PR template checklist (I believe you checked that the PR had tests before you wrote one)
Once you open the PR, ensure all the CI checks are passing. If they're not, investigate the failures and try to fix them.

Good luck!


WIP: Fixes: #100 Add "region" as variable for s3-remote-state

Added a variable to the main.tf file and updated the README accordingly

Hey! I have pushed new changes for you to review...

Thanks for the contribution!


Feature/70 resource model

merged in https://github.com/Tonomy-Foundation/Tonomy-Contracts/pull/78


Support 2021.2

Fix #332

Yeah this PR doesn't actually add support to 2021.2
It just changes some strings to force the plugin to run on it.
No changes for deprecation/compatibility were made so I assume no tests were made either?
Use at your own risk.
I'm working on adding actual support at #332 .


How do you not

Where to find the issue
Release 2.13.2 apparently checks that a certificate has not been revoked.
The Adolf Hitler and Mickey Mouse certificates are still importable over a month after being made public.
https://www.zerozone.it/cybersecurity/e-se-spunta-fuori-il-green-pass-di-adolf-hitler/20305

Describe the issue
How can you report a rogue certificate? That’s not documented anywhere as far as I could see.

Suggested change
Describe the process for reporting rogue certificates in the online help.

@alanrick

Could you edit the title which currently says "How do you not"? It looks like you were interrupted whilst writing.
You also have a duplicate under https://github.com/corona-warn-app/cwa-documentation/issues/750, so maybe you could close the other one.
You refer to 2.13.2 so I presume you are referring to iOS, because Android is 2.13.3 for this functionality.
If there is going to be some advice published about how to report forgeries, then it would be quicker to publish it in the FAQs.

I was indeed.
closed. Didn’t even notice it was created.
Yes, iOS
I agree. Then the OS is irrelevant. I’ll change the description.

Regarding digital covid certificates please use the contacts from covpass
https://digitaler-impfnachweis-app.de/kontakt


Only add extra field info in CD as needed.

In the JDK there's a bug in the native implementation where they do a weird thing and they ignore the compressed size if the file is STORED [1], but then later when parsing the extra data, they read from the same variable (that could have been set to zero) instead of the actual data to see if it’s 0xFFFFFFFF and if the extra field for compressed size should be present [2].  This causes corruption in their parsing, because for STORED files they were reading the loc offset from the extra compressed size and causing it to report invalid LOC headers.
Previously, we were just always using all of the extra fields to simplify the logic, regardless of the size of the fields being 4 GiB+ or not (this is explicitly allowed in the ZIP spec).  As to not trigger the bug, I’ve added more complicated logic that only adds the extra fields for the CD directory if they’re needed.  Since we shouldn’t be dealing with any 4 GiB+ stored segments, this shouldn’t be an issue for our use case.  This should fix the issues people have been seeing with trying to parse aff4imager images with the java library.
[1]https://github.com/openjdk/jdk/blob/6bab0f539fba8fb441697846347597b4a0ade428/src/java.base/share/native/libzip/zip_util.c#L1040
[2]https://github.com/openjdk/jdk/blob/6bab0f539fba8fb441697846347597b4a0ade428/src/java.base/share/native/libzip/zip_util.c#L1073

I actually think this is fine because it only changes the CD handling. We will still write the extensible zip64 file header always so we can still stream the output to non seekable streams. We write the CD at the end where we already know the compressed and uncompressed size. So we end up writing the extensible file header but the regular CD header in most cases where the segment size is smaller than 2gb.


jest.clearAllMocks(); does not remove mock implementation within afterEach

🐛 Bug Report
jest.clearAllMocks(); does not remove mock implementation within afterEach
To Reproduce
I have a file called src/layouts/index.js
// ./src/layouts/index.js
const importAll = (r) =>
    r.keys().reduce(
        (acc, key) => ({
            ...acc,
            [key.replace(/^\.\/(.*).json$/, '$1')]: r(key)
        }),
        {}
    );

module.exports = importAll(require.context('./', true, /\.json$/));

It utilizes webpack require.context so I am trying to mock with jest.mock.
I have another file... say file util.js
//./src/util.js
import layouts from '../layouts';
export const getLayout(name) {
  return layouts[name];
}

in my test I'm trying to clear the mocks after each test
//./src/util.test.js
describe('my test suite', () => {
  afterEach(() => {
     jest.clearAllMocks();
  })
  test('test number one', () => {
      jest.mock('./layouts', () => ({
          layout1 : { a : 1 },
          layout2 : { b: 2 },
     }));
     assert.equals(getLayout('layout1').a, 1);
     assert.equals(getLayout('layout2').b, 2);
  });
  test('test number two', () => {
     assert.equals(getLayout('layout1').a, 1);
     assert.equals(getLayout('layout2').b, 2);
  });
});

Expected behavior
I would expect for the first test to pass and the second test to fail... because the mock should have been cleared.
Link to repl or repo (highly encouraged)
https://repl.it/@CharlieHoover/SorrowfulBackSandboxes

As I understand the parallel execution model of jest the tests inside each suite are run sequentially so you should be able to mock per individual test.

FYI The mocking documentation is extremely unclear.

jest.clearAllMocks does not remove mock implementations by design - try jest.resetAllMocks
Here are the relevant docs:

Still does not work with resetAllMocks:
Example included:
https://repl.it/@CharlieHoover/SorrowfulBackSandboxes-2
Aside from that that is extremely ambiguous. Why would a function called clearAllMocks not clear the mocks... Name the function resetMockState or something more descriptive. clearAllMocks implies the mocks are being cleared.

@rickhanlonii my issue is not yet answered.

Ah, yeah, looks like resetAllMocks does not reset mock module factories just the implementations set by mockImplementation. If you want to post what you want to do to stackoverflow I can help you do what you want there but it doesn't look like there's a bug here

Why would a function called clearAllMocks not clear the mocks

I think the confusion is that the "mock" in "clearAllMocks" does not refer to the mock implementations, it refers to the Jest mock objects. So this function means "clear out all jest mock objects" which is to say call .mockClear on all mock objects (i.e. clear the calls)

@rickhanlonii
omg so #1 it seems like "clear" and "reset" are being used opposite to what their logical meaning is.
Also, it's very clear what he's trying to do; remove the mock implementation, and you're saying there's no way to do that orrr.....?????

This should be reopened

+1

+1

+1

I have a similar issue, when I mock an implementation in previous it case, the next it case will be affected.

+1

also struggling with this!

+1 please update the docs to explain how to REMOVE a mock/spy

+1 please update the docs to explain how to REMOVE a mock/spy

Isn't this what mockRestore is for? https://jestjs.io/docs/en/mock-function-api#mockfnmockrestore

I think the default config should include:
{
  restoreMocks: true,
  clearMocks: true,
  resetMocks: true
}

It is shocking that the default behaviour is to vomit state between tests. Can you please just keep my tests isolated by default?

`
describe('test', () => {
beforeEach(() => {
const WelcomeService = require('./../SOME_MODULE')
WelcomeServiceSpyOfMessage = jest.spyOn(
WelcomeService,
'message', // some function I mocked
)
const IsUserAuthentic = require('./../SOME_MODULE')
IsUserAuthenticSpyOnIsUserAuthentic = jest.spyOn(
  IsUserAuthentic,
  'isUserAuthentic' // some function I mocked
)
app = require('../src/server') // my Express server

})
afterEach(() => {
jest.restoreAllMocks()
})
it('1. Mock implementation', async () => {
const mockedMessage = faker.lorem.sentence()
WelcomeServiceSpyOfMessage.mockImplementation(() => mockedMessage)
IsUserAuthenticSpyOnIsUserAuthentic.mockImplementation(() => {
console.log('>>> MOCKED MW 1')
return true
})
const result = await request(app)
.get('/api')
expect(result.statusCode).toBe(200)
expect(result.body).toHaveProperty('message', mockedMessage)
})
it('2. After restored implementation', async () => {
IsUserAuthenticSpyOnIsUserAuthentic.mockImplementation(() => {
console.log('>>> MOCKED MW 2')
return true
})
const result = await request(app)
.get('/api')
expect(result.statusCode).toBe(200)
expect(result.body).toHaveProperty('message', 'hello world')
})
})
`
Output:
console.log test/routes.test.js:36
>>> MOCKED MW 1
console.log test/routes.test.js:36
>>> MOCKED MW 1
Same mocked version of function is called for both the tests. Although I have restored all mocks in afterEach call, still same mock is getting called. Please tell me where I missed.
Thanks

+1 🥂

👍

+1

Is there a fix for this issue? +1

1

Facing the same issue!

I have same issue but I not found solution from jest official documentation.
So I make a not graceful solution below. Then use it in everywhere that need to remove mock.
// jestUtil.js
const mockArr = [];
export function doAMock(moduleName, cb = null) {
  if (!mockArr.includes(moduleName)) {
    mockArr.push(moduleName);
  }
  if (cb) {
    jest.doMock(moduleName, cb);
  } else {
    jest.doMock(moduleName);

  }
}

export function removeAllMock() {
  mockArr.forEach(m => {
    jest.dontMock(m);
  });
  mockArr.length = 0;
}

// usage
// other.test.js
import * as jsUtil from './jestUtil.js';
jsUtil.doAMock('module');
jsUtil.removeAllMock();

IMO this is a super confusing API naming and deserves to be renamed.

IMO this is a super confusing API naming and deserves to be renamed.

yeah, totally agree - but I'm still wondering if this is currently possible - naming aside. If yes, how?

This should really be fixed. No reason one unit test should affect the other. Has anyone found a viable workaround? Really odd functionality.

Is anyone ever going to do something about this? I am also facing the same issue.

This is still a problem

I'm also having an issue with this.

For anyone running into this, I've set the command line flag --restoreMocks which can also be set in jest.config.js:
   restoreMocks: true,

As the default for my tests so that mocks are always restored each after test run. Here is the documentation link: https://jestjs.io/docs/en/configuration#restoremocks-boolean

Agreed it is a strange default that keeps state between unit tests.

@ewhauser neither the command line flag nor the config-option is working for me. once I mock a module, it stays mocked till I overwrite the mock :(
are you sure it is working for you?

@pkyeck It seems to depend on the environment. If I run the test suite in my local environment it clears all the mocks, but when I run it inside a docker container it doesn't seem to reset them properly.

I just came across mockRestore, which works if you are using spyOn.

Does everything that mockFn.mockReset() does, and also restores the original (non-mocked) implementation.
This is useful when you want to mock functions in certain test cases and restore the original implementation in others.
Beware that mockFn.mockRestore only works when the mock was created with jest.spyOn. Thus you have to take care of restoration yourself when manually assigning jest.fn().
The restoreMocks configuration option is available to restore mocks automatically between tests.

https://jestjs.io/docs/en/mock-function-api#mockfnmockrestore

I found this helpful. Call this function with an await every time right after a mocked fn is expected to be called.
flushAllPromises() {         return new Promise(resolve => setImmediate(resolve));     }
This should make the last call to YourClass.yourFunction.mockResolvedValue() in the executing test case to work, instead of relying on the resolved value of the last executed unit test.

So basically, it is impossible to change the implementation of a mock on a per test basis.

Come on guys, this is sheer incompetence. I don't use Jest out of choice, I use it because you have made it popular. This issue has been open since OCT 2018. You're just doing a disservice to the community you're trying to serve..? Get it together.

These APIs need to be renamed. Settling for bad naming due to inertia is unprofessional to say the least.

Come on guys, this is sheer incompetence. I don't use Jest out of choice, I use it because you have made it popular. This issue has been open since OCT 2018. You're just doing a disservice to the community you're trying to serve..? Get it together.

These APIs need to be renamed. Settling for bad naming due to inertia is unprofessional to say the least.

I agree that it is 'unprofessional', I and all others who have maintained Jest in the last ~2 years have done it in their free time, thus not professionally. I'd stop short of 'incompetence' though.
Either way, please do not use the issue tracker for off-topic comments or (successful or unsuccessful) abuse; such comments will be hidden or reported.

Abuse? Don't make me laugh. Fair point, I suppose PRs are always welcome.

For me, jest.restoreAllMocks(); helped finally clear the spy on jest

For anyone running into this, I've set the command line flag --restoreMocks which can also be set in jest.config.js:
   restoreMocks: true,

As the default for my tests so that mocks are always restored each after test run. Here is the documentation link: https://jestjs.io/docs/en/configuration#restoremocks-boolean

It worked fine to me.

For anyone running into this, I've set the command line flag --restoreMocks which can also be set in jest.config.js:
   restoreMocks: true,

As the default for my tests so that mocks are always restored each after test run. Here is the documentation link: https://jestjs.io/docs/en/configuration#restoremocks-boolean

It worked fine to me.

I have no idea why this makes the difference, but I managed to work around this by swapping
afterEach(() => {
     jest.clearAllMocks();
  })

for
beforeEach(() => {
    jest.clearAllMocks();
});

I assumed they would be synonymous (although then I guess why have two methods) but :shrug:

I have no idea why this makes the difference, but I managed to work around this by swapping
afterEach(() => {
     jest.clearAllMocks();
  })

for
beforeEach(() => {
    jest.clearAllMocks();
});

I assumed they would be synonymous (although then I guess why have two methods) but :shrug:

All other mock frameworks I can remember using across languages hook into the test framework to automatically reset all test doubles' state to the pristine declared form after each individual example run.
Any other behavior results in unexpected non-deterministic and order-dependent behavior when running multiple examples in the same suite.
And in this case, there doesn't even seem to be a way to manually achieve the desired behavior.
It's confusing and mystifying why Jest wouldn't just reset everything after each example by default.

All other mock frameworks I can remember using across languages hook into the test framework to automatically reset all test doubles' state to the pristine declared form after each individual example run.
Any other behavior results in unexpected non-deterministic and order-dependent behavior when running multiple examples in the same suite.
And in this case, there doesn't even seem to be a way to manually achieve the desired behavior.
It's confusing and mystifying why Jest wouldn't just reset everything after each example by default.

For what its worth I found that clearAllMocks stopped working properly after an upgrade of our app.  replaced is with this and things seem to pass:
afterEach(()=> {jest.restoreAllMocks()});

Got a nasty issue where tests work with .only but fail in sequence. Tried the clear/reset/restore triad with all sorts of configurations described in this issue page and still no results. Worst part is, I have whole suites that have been working just fine with the same setup/teardown.
Unit  tests should be isolated from each other on principle, it's a tremendous problem for Jest to not have it.
Who knows how many unit tests are out there with strange behavior inherited by this.
With the info on this page, now I can't even tell if my unit tests are even to be trusted because this teardown seems so impossible to gauge. It's that huge.

Moving the mockImplementation functions to beforeEach block worked for me. Make sure you do restore in the afterEach block.

Had this super annoying issue today. Just save you time and do what @damien-roche said above.

afterEach(() => {
    jest.resetModules();
  });

try it to solve direct mock implementations

I tried all of this solutions and all of them does not work for me. Does anyone manage to solve this problem ??

@amirensit I'm using this now:
beforeEach(async () => {
  jest.resetModules();
  // manually reset mocks
  jest.dontMock('@okta/jwt-verifier');
  jest.dontMock('axios');
});

//
//
test('1) oidc token not active anymore but refresh succeded', async () => {
  const mockedVerifyAccessToken = jest.fn().mockResolvedValue();
  jest.doMock(
    '@okta/jwt-verifier',
    () =>
      function OktaJwtVerifier() {
        return {
          verifyAccessToken: mockedVerifyAccessToken,
        };
      }
  );

  // ...
});

//
//
test('2) mock axios', async () => {
  jest.doMock(
    'axios',
    // ...
  );

  // ...
});

//
//
test('3) mocks should be reset from beforeEach', async () => {
  // ...
});

So you have to keep a list of all modules that you want to mock in one or multiple tests but the order of the tests doesn't matter anymore (or .only/.skip or running all tests).

I have mocked a module in my jest setup like this
jest.mock('containers/PatientsList/SignalRConnection')
you can unmock it by using
jest.unmock("containers/PatientsList/SignalRConnection");
It didn't work in beforeEach and beforeAll, so I had to put it above describe and it worked

has anyone found a fix for this ?
I am passing jest.clearAllMocks resetAllMocks under beforeEach and it definitely is still not clearing the mockImplementation

@SidKhanna296 Same for me !

has anyone found a fix for this ?
I am passing jest.clearAllMocks resetAllMocks under beforeEach and it definitely is still not clearing the mockImplementation

@SidKhanna296 jest.restoreAllMocks() is the one you're looking for.

I think the default config should include:
{
  restoreMocks: true,
  clearMocks: true,
  resetMocks: true
}

It is shocking that the default behaviour is to vomit state between tests. Can you please just keep my tests isolated by default? Then the [hopeful minority] who want to spread state across multiple tests can do so by opt-in.

This really works. I have suffered with that for 2 hours, finally I found answer. Thanks.

@yongyiwong If that is really true, then this project needs to deploy an update with a MAJOR version increase with this new default config (which will break a lot of faulty tests).

and for the current issue- we really need to have something that clears everything out out the box. I want to run every test as isolated as possible, like killing jest and running it from scratch after every test. this should be the default behaviour of jest, I don't see why anyone would prefer having leaks between his tests.

Are any of the maintainers paying attention?
Tests need to run in total isolation otherwise they are worthless.

{
restoreMocks: true,
resetMocks: true
}
seems to be pretty reliable for my needs.

@JRRS1982 try doing inside some it something like this:
it('mock something', () => {
   jest.mock('someModule', () => 'fake value')
})

you will see that from that moment on, all the tests that are running after this test, will get 'fake-value' if they try to import someModule. that means that you have a leak between tests. if your other tests will count on that return value, and you'll ever remove this test, all the other tests will fail. and there are more serious issues that leaks like this can cause.

@JRRS1982 try doing inside some it something like this:
it('mock something', () => {
   jest.mock('someModule', () => 'fake value')
})

you will see that from that moment on, all the tests that are running after this test, will get 'fake-value' if they try to import someModule. that means that you have a leak between tests. if your other tests will count on that return value, and you'll ever remove this test, all the other tests will fail. and there are more serious issues that leaks like this can cause.

The docs say that resetMocks resets mock state before every test and restoreMocks will restore implementation. someModule is your example would be scoped in the it block so others would not have that implementation value - going to have to test.

I can confirm @Niryo comment. I have 3 tests, one of which needs to mock axios. If I put that test first, all my other tests fail (they use axios but don't need to mock it for that use case), and if I put it last, when I actually mock the API call they all pass.

Interested in hearing alternatives, if restore, clear, reset cause flakiness, and reset,restore is not complete what is the correct setup?
{
  restoreMocks: true,
  clearMocks: true,
  resetMocks: true
}

I haven't been able to find a working way of doing any of those combinations, unfortunately.

@JRRS1982 i am using resetModules and resetMocks. It's not enough in terms of assuring isolation but at least it's not flaky

@JRRS1982 i am using resetModules and resetMocks. It's not enough in terms of assuring isolation but at least it's not flaky

Cheers, i will follow your lead! Thanks for the heads up.

restoreAllMocks

this worked for me

I tried restoreAllMocks and all the other restores, resets, and clears and none of them worked for me.

Me too, is there a solution?

has anyone found a fix for this ?
I am passing jest.clearAllMocks resetAllMocks under beforeEach and it definitely is still not clearing the mockImplementation

@SidKhanna296 jest.restoreAllMocks() is the one you're looking for.

damn, I've just struggled too much trying to get why clear or reset mocks don't actually CLEAR and RESET mocks, thank you!!! you are my savior

Fuck u bitch

Shouldn't the clearAllMocks and restoreAllMocks combo work for any use case?
clearAllMocks clears all mock calls
restoreAllMocks restores all mocked implementations to their default (non-mocked) state
The way I see it, the resetAllMocks still keeps mocked implementations as mocks, only without return values or defined implementation.
If I'm wrong here, anyone please correct me

Shouldn't the clearAllMocks and restoreAllMocks combo work for any use case?
clearAllMocks clears all mock calls restoreAllMocks restores all mocked implementations to their default (non-mocked) state
The way I see it, the resetAllMocks still keeps mocked implementations as mocks, only without return values or defined implementation.
If I'm wrong here, anyone please correct me

mockClear clears only data pertaining to mock calls
mockReset resets to mock to its initial implementation.
Have a read of this on SO

Shouldn't the clearAllMocks and restoreAllMocks combo work for any use case?
clearAllMocks clears all mock calls restoreAllMocks restores all mocked implementations to their default (non-mocked) state
The way I see it, the resetAllMocks still keeps mocked implementations as mocks, only without return values or defined implementation.
If I'm wrong here, anyone please correct me

mockClear clears only data pertaining to mock calls
mockReset resets to mock to its initial implementation.
Have a read of this on SO basically if you change mocks between tests then your mock changes, but the mock is not reset as its not been used (at least my understanding)
resetModules and resetMocks is i think the right setup - keen to get a consensus though.

As explained in the link you sent, I'm understanding that the mockReset just resets the method to a new jest.fn(), not the original implementation of the method, while the mockRestore restores the original implementation of each method.
I've been using the restoreAllMocks together with the clearAllMocks with that purpose so far, and it has been working great.
Don't know if using resetModules I'd have any advantage though.

to get around the issue, here's a pattern that works for and makes sense to me
the issue for me was resetting my mocks to those which are declared in mocks directories.  The easiest solution I saw was to reset modules and re-require them before each test.  This way resetAllMocks didn't wipe out all the mocks I wanted persisted.  Essentially only the one-off mocks I created in the tests were being reset.
* the example is in typescript in case anyone has trouble figuring out the syntax there.  Using require instead of dynamic import gets around typing nonsense
// declare 'let' for each dependency
let fs: jest.MockedObject<typeof import('fs')>
let doSomething: typeof import('./do-something')

beforeEach(() => {
  jest.resetAllMocks()
  jest.resetModules()

  fs = require('fs').default
  doSomething = jest.requireActual('./do-something').default
})

describe('some block', () => {
  it('should return a 404', () => {
    fs.stat.mockImplementation(() => throw new Error('file not found'))

    doSomething() // will have the mock implementation above
  })

  it('should work', () => {
    doSomething() // will **not** have the mock implementation above
  })
})

@SimenB Hi, could you add some labels to this issue? It's a pretty hot topic and is indexed on google, but it seems like it is outside of the radar of those who can assist with this.

I really have to wonder why facebook does not seem to have those problems? How are they testing over there?!
I was always frustrated jest can't execute tests inside a file in random order, like a proper testing framework should be able to do. The reason for that could be this weird, unpredictable mess of mocks.

to get around the issue, here's a pattern that works for and makes sense to me
the issue for me was resetting my mocks to those which are declared in mocks directories. The easiest solution I saw was to reset modules and re-require them before each test. This way resetAllMocks didn't wipe out all the mocks I wanted persisted. Essentially only the one-off mocks I created in the tests are reset.

the example is in typescript in case anyone has trouble figuring out the syntax there. Using require instead of dynamic import gets around typing nonsense

let's assume I mock fs.stat to return a particular object
// /__mocks__/fs.ts

// here we declare mocks we want persisted
const mockFs = {
  stat = jest.fn(() => ({ size: 100, blocks: 2, ... })
}

export default mockFs

and depend on that mock to test ./do-something.ts
// /do-something.test.ts

// declare 'let' for each dependency
let fs: jest.MockedObject<typeof import('fs')>
let doSomething: typeof import('./do-something')

beforeEach(() => {
  jest.resetAllMocks()
  jest.resetModules()

  fs = require('fs').default
  doSomething = jest.requireActual('./do-something').default
})

describe('some block', () => {
  it('should return a 404', () => {
    fs.stat.mockImplementation(() => throw new Error('file not found'))

    doSomething() // will have the mock implementation above
  })

  it('should work', () => {
    doSomething() // will have the mock implementation from /__mocks__/fs.ts
  })
})

This is a good imo

Still can't find a solution.
I'm testing a class instance and I need to mock one of the class functions that is called by another other function in the same class.
I tried all the "clean" methods, even together, in the file (before, after) and in the configs.
Nothing worked.
If I change the order of the tests (so, I first test the function (A) and then I test the other function (B) that uses function A and it works.
Not sure what is wrong with it and how to fix it.

beforeEach(() => {
jest.useFakeTimers();
});
afterEach(() => {
jest.resetAllMocks();
});
This worked for me !

I think the default config should include:
{
  restoreMocks: true,
  clearMocks: true,
  resetMocks: true
}

It is shocking that the default behaviour is to vomit state between tests. Can you please just keep my tests isolated by default? Then the [hopeful minority] who want to spread state across multiple tests can do so by opt-in.

^^ this should be reconsidered.
This problem gets worse when fake timers are used. May be worth adding a clearAllTimers option too.

But even this default config does not work reliably :( How is facebook working with such a broken test framework?

` describe('test', () => { beforeEach(() => { const WelcomeService = require('./../SOME_MODULE') WelcomeServiceSpyOfMessage = jest.spyOn( WelcomeService, 'message', // some function I mocked ) const IsUserAuthentic = require('./../SOME_MODULE') IsUserAuthenticSpyOnIsUserAuthentic = jest.spyOn( IsUserAuthentic, 'isUserAuthentic' // some function I mocked ) app = require('../src/server') // my Express server })
afterEach(() => {
  jest.restoreAllMocks()
})

it('1. Mock implementation', async () => {
  const mockedMessage = faker.lorem.sentence()
  WelcomeServiceSpyOfMessage.mockImplementation(() => mockedMessage)
  IsUserAuthenticSpyOnIsUserAuthentic.mockImplementation(() => {
    console.log('>>> MOCKED MW 1')
    return true
  })
  const result = await request(app)
    .get('/api')
  expect(result.statusCode).toBe(200)
  expect(result.body).toHaveProperty('message', mockedMessage)
})

it('2. After restored implementation', async () => {
  IsUserAuthenticSpyOnIsUserAuthentic.mockImplementation(() => {
    console.log('>>> MOCKED MW 2')
    return true
  })
  const result = await request(app)
    .get('/api')
  expect(result.statusCode).toBe(200)
  expect(result.body).toHaveProperty('message', 'hello world')
})

}) ` Output: console.log test/routes.test.js:36 >>> MOCKED MW 1
console.log test/routes.test.js:36 >>> MOCKED MW 1
Same mocked version of function is called for both the tests. Although I have restored all mocks in afterEach call, still same mock is getting called. Please tell me where I missed.
Thanks

I think after whichever test you want to reset/clear the mock, you should add there
afterAll(() => {   jest.restoreAllMocks(); })
Because that did the job for me.
Wherever I was mocking modules or making spyOn. I added the afterAll in describe. It worked for me.

@SimenB would you kindly triage this for us? It's a very old issue that could be either a serious problem or just a documentation task. It remains untagged with no consensus on what it really is.

But even this default config does not work reliably :( How is facebook working with such a broken test framework?

Until we get this issue tagged so it becomes reachable, it will remain a mystery whether or not it's actually bugged or there's a large misunderstanding from lack of documentation. People only end up here because of search engine results.

Still can't find a solution.
I'm testing a class instance and I need to mock one of the class functions that is called by another other function in the same class.
I tried all the "clean" methods, even together, in the file (before, after) and in the configs.
Nothing worked.
If I change the order of the tests (so, I first test the function (A) and then I test the other function (B) that uses function A and it works.
Not sure what is wrong with it and how to fix it.

Same same. I can get them to clean up correctly in every other case. But trying to mock a module that will be instantiated in another the method  i'm testing, I can never seem to clean it up. I've tried literally everything. Whatever it gets mocked with the first time persists through all the tests.

@agilgur5 for me jest.restoreAllMocks() is working fine when it's called from within afterEach(). Furthermore I used mockReturnValueOnce() and mockResolvedValueOnce. Maybe this helps?

@agilgur5 for me jest.restoreAllMocks() is working fine when it's called from within afterEach().

@paulmax-os restoreMocks: true should theoretically have the same effect as that.
Though it's possible that afterEach has an effect on Jest's concurrency model 🤷

Furthermore I used mockReturnValueOnce() and mockResolvedValueOnce.

I'm not sure that these are related? I don't have a need or use-case for these

@agilgur5 yeah, I just wanted to share a (another) working "solution" for anyone reaching this page. I am using the ...Once() methods in my code, but I think you're right: It should also work without ...Once().

did you find a solution in the end? nothing seems to work

For me it worked in the end by doing this:
let wrapper;

beforeEach(() => {
    wrapper = null;
    jest.clearAllMocks();
})

it('makes bar out of foo', async () => {
    const mockMethod = jest
      .spyOn(Class, 'methodName')
      .mockImplementation();

    wrapper = someActionYouWantToPerform('foo');
    await flushPromises(); // depends on your implementation

    expect(mockMethod).toHaveBeenCalledWith('foo');
  });

For me the problem was that I had a static property. And the problem happened since they aren't part of the instance and are remembered. I have changed it to a normal class property. and it worked, maybe someone else didn't pay attention to this and had the same case 😊

my function is still being mocked after calling:

    jest.restoreAllMocks()
    jest.resetAllMocks()
    jest.clearAllMocks()

am i missing something?

that's what helped me, ty

jest.clearAllMocks does not remove mock implementations by design - try jest.resetAllMocks
Here are the relevant docs:

this helped me; I was mocking a hook like this         jest.spyOn(Hooks,'useTest').mockImplementationOnce(mockUseTest);

I too can call all three function and set the equivalents in config, and my call counts still retain their increments from one test to the next.
The only thing that works for me to to create new mocks in beforeEach:
import createMockInstance from "jest-create-mock-instance";

describe("MyUnitUnderTest", () => {
  let reservationRepo: jest.Mocked<ReservationRepository>;
  let eventPublisher: jest.Mocked<EventPublisherService>;
  let usecase: MyUnitUnderTest;

  beforeEach(() => {
    reservationRepo = createMockInstance(ReservationRepository);
    eventPublisher = createMockInstance(EventPublisherService);
    usecase = new MyUnitUnderTest(reservationRepo, eventPublisher);
  });

For me the problem was that I had a static property. And the problem happened since they aren't part of the instance and are remembered. I have changed it to a normal class property. and it worked (clearAllMocks), maybe someone else didn't pay attention to this and had the same issue 😊

same here, is there a work around for static properties as we shouldn't have to change our implementation to pass a unit test.  Atleast, I never do.

I solve my issue saving the original behavior from my function in another const and after it restore my behavior to original function.
const MyObject = {   getValue() {     return original value`
}
}
describe('Test restore original implementation', function () {
const originalObjectState = {...MyObject}
test('Mock original function', async function () {
MyObject.getValue = jest.fn(() => mocked value)
const value = MyObject.getValue()
expect(value).toBe(mocked value)
});
test('Restore original function', async function () {
MyObject.getValue = originalObjectState.getValue
const value = MyObject.getValue()
expect(value).toBe(original value)
});
});`

I solve my issue saving the original behavior from my function in another const and after it restore my behavior to original function.

const MyObject = {
  getValue() {
    return 'original value'
  }
}
describe('Test restore original implementation', function () {
  const originalObjectState = {...MyObject}

  test('Mock original function', async function () {
    MyObject.getValue = jest.fn(() => 'mocked value')
    const value = MyObject.getValue()
    expect(value).toBe('mocked value')
  });

  test('Restore original function', async function () {
    MyObject.getValue = originalObjectState.getValue
    const value = MyObject.getValue()
    expect(value).toBe('original value')
  });

});

I solve my issue saving the original behavior from my function in another const and after it restore my behavior to original function.
const MyObject = {
  getValue() {
    return 'original value'
  }
}
describe('Test restore original implementation', function () {
  const originalObjectState = {...MyObject}

  test('Mock original function', async function () {
    MyObject.getValue = jest.fn(() => 'mocked value')
    const value = MyObject.getValue()
    expect(value).toBe('mocked value')
  });

  test('Restore original function', async function () {
    MyObject.getValue = originalObjectState.getValue
    const value = MyObject.getValue()
    expect(value).toBe('original value')
  });

});

@agilgur5 for me jest.restoreAllMocks() is working fine when it's called from within afterEach(). Furthermore I used mockReturnValueOnce() and mockResolvedValueOnce. Maybe this helps?

Friday afternoon, ready to give up. hallelujah this comment actually helped me, thank you


Add Row Json Deserializer

Add basic Deserializer to allow converting Json objects to Rows.
Doesn't support nullables at the moment. Isn't wired up to SQL yet.

Follow this checklist to help us incorporate your contribution quickly and easily:

[ ] Make sure there is a JIRA issue filed for the change (usually before you start working on it).  Trivial changes like typos do not require a JIRA issue.  Your pull request should address just this issue, without pulling in other changes.
[ ] Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue.
[ ] Write a pull request description that is detailed enough to understand:

[ ] What the pull request does
[ ] Why it does it
[ ] How it does it
[ ] Why this approach

[ ] Each commit in the pull request should have a meaningful subject line and body.
[ ] Run mvn clean verify to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.
[ ] If this contribution is large, please file an Apache Individual Contributor License Agreement.

R: @apilloud @kennknowles

@kennknowles:

It might be preferable to have the conversion driven by the expected type in the schema instead of by the JSON type. It doesn't seem to be a problem, though.

That's what happens. These checks look at the schema type, and primitive value look up also happens by schema type name.
@kennknowles

Can you have tests for out-of-bounds numerical constants? I may have just missed them. The reason I ask is to deliberately focus on the places where the JSON is valid and almost fits the schema, but there is a minor mismatch in the data models.

Working

@kennknowles added test for overflowing integer numbers

Ah, sorry I misread that. Then the choice of when to reject and when to wrap and when to lose precision is a bit complicated. I think we might need a design doc and to discuss a little bit on dev@ as a next gen of the schema design, but we can move forward with almost anything for now.

@kennknowles  added stricter validation, does this approach look better?
Few quirks:

not sure if I can quickly come up with a prettier solution for validation, JSON+Jackson+Java makes a weird combination;
jackson allows few type widening configuration options, like it can automatically convert all ints to BigIntegers, I haven't tested that bit yet. And it's an ObjectMapper configuration option, so it's not directly exposed to the serializer. And it doesn't feel right to automatically widen everything;
jackson always parses 1.02e5 as float node but 1.02 as double node, which leads to things like 1.02d != (double)(float)(1.02d). Easy workaround is to define Schema field as Long but it feels super subtle and unclear if you don't have a debugger at hand. I don't believe there's a configuration flag for this;
additionally, rejecting 1.00 -> int conversion or number -> string feels restrictive;

At this point I think that having a more restricting approach is better even while we don't have a robust type system in Schemas:

probably easier to make it less restricting in general when we encounter the use cases which require less strict conversions;
configuration options to control strictness can be wired up easier when there's something to wire them up to;

run java gradle precommit

run java precommit

run java precommit

Yes, I like this. If we do decide to make the extractors less strict, the structure of things can stay the same.


Enable testing for pull requests

Blocked by #490 [RESOLVED].

@vpavlin has agreed to perform the set up. The progress thereof is tracked in the internal GitLab instance.

PR testing implemented. Documentation pending.


Gitkraken hash doesnt match

Winget install doent work, the hash doesnt match

[ X] I would like someone else to build the manifest.

Version: 7.7.1
Publisher: Axosoft, LLC
Author: Axosoft, LLC
Moniker: gitkraken
Description: Legendary Git GUI client for Windows, Mac & Linux.
Homepage: https://www.gitkraken.com/git-client
License: Proprietary
License Url: https://www.gitkraken.com/eula
Installer:
Type: Exe
Locale: en-US
Download Url: https://release.axocdn.com/win64/GitKrakenSetup.exe
SHA256: e4d8f1772cf389e17e7921f8664a943e7ff6e67691aa9bf28e88da3f7616d8f6

But the hash already is  e4d8f1772cf389e17e7921f8664a943e7ff6e67691aa9bf28e88da3f7616d8f6?

But the hash already is e4d8f1772cf389e17e7921f8664a943e7ff6e67691aa9bf28e88da3f7616d8f6?
And the hash matches on my end
PS C:\Users\Esco> winget install gitkraken
Found GitKraken [Axosoft.GitKraken]
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://release.axocdn.com/win64/GitKrakenSetup.exe
  ██████████████████████████████   149 MB /  149 MB
Successfully verified installer hash
Starting package install...
Successfully installed

Same here. Installation worked perfectly fine for x64 and x86. The current hash is correct for both installers.

I leave my prompt, i dont know if there is a problem with locales
PS C:\Users\idbl6> winget install gitkraken
Encontrado GitKraken [Axosoft.GitKraken]
La licencia de esta aplicación fue concedida por el propietario.
Microsoft no es responsable de los paquetes de terceros, ni les concede ninguna licencia.
Downloading https://release.axocdn.com/win64/GitKrakenSetup.exe
██████████████████████████████   149 MB /  149 MB
El hash del instalador no coincide; para anular este control use --force
---- translated ---
PS C: \ Users \ idbl6> winget install gitkraken
Found GitKraken [Axosoft.GitKraken]
The license for this application was granted by the owner.
Microsoft is not responsible for third-party packages, nor does it grant any licenses to them.
Downloading https://release.axocdn.com/win64/GitKrakenSetup.exe
█████████████████████████████ 149 MB / 149 MB
The installer hash does not match; to override this control use --force

have you tried winget source update?

It worked


Ignoring hits inside of parallel block

I'm using the parallel gem for this. It seems like the code coverage is not counting the hits inside of the parallel block.

Hi there @vinnyoodles !
Thanks for the report. Could you provide us with a test repository/test script? That would make this much easier to debug, otherwise it's quite hard to debug sadly :(

Also I'm guessing that the parallel block might spawn new processes which might be where the interference comes from. Without a test repo to reproduce this is quite hard to fix.

Without a test repo there isn't much to be done here sadly. The problem might also be based on the forking which might be an inherent challenge with the way thecoverage library works so fixing it would be pretty hard/almost impossible either way.


What is new in the 3rd edition

Hello John,
I bought 2nd edition of Introduction to Compiler Design: An Object-Oriented Approach Using Java in August just before the 3rd edition was published. Can you please write a few words about the difference between the 2nd and 3rd editions ? I'm tempted to buy the 3rd edition if there are substantial differences compared with the 2nd.
Regards,
Gherghe

Thank you for purchasing the second edition.  The summary of the differences below is taken directly from the Preface of the third edition.
John I. Moore, Jr.
Changes in the Third Edition
The third edition retains the objectives, emphasis, and general structure of the first two editions, but there are a number of significant changes that can be grouped into four broad categories.
1. CPRL Language Changes.

The CPRL language is now a little more like C-based languages and less like Pascal-based languages.  For example, reserved words “begin” and “end” have largely been replaced by braces “{” and “}”, and program execution now starts with a parameterless procedure named “main()”.  Similarly, subroutine declarations and calls now require parentheses even if there are no parameters.
Subprograms, including main(), can now be called before they have been declared, but initial declarations (i.e., variables, constants, and types) must still appear before being used.
String types are now fully supported (the previous edition supported only string literals), and record types (a.k.a., structures) were added.
Similar to C, array parameters in CPRL are now passed by reference whether or not they are declared as such, even for functions.

2. CVM Changes.

There are new instructions to support string input and assignment plus several new optimized versions of existing instructions.•	Instructions that read from standard input (e.g., GETINT) now write directly to the variable address found on the top of the stack.  Previously these instructions pushed the input value onto the stack, and a store instruction was required to update the variable.
The CMP (compare) instruction was removed.  So, for example, branch instructions like BL (branch less than) and BGE (branch greater or equal) now pop two integers off the stack, compare them, and branch accordingly.  This approach is similar to the way branch instructions work in the JVM and other stack-based architectures.

3. Compiler Implementation Changes.

The use of null values has been greatly reduced, especially with respect to abstract syntax trees.  For example, most parser methods now return either EmptyExpression, EmptyInitialDecl, EmptySubprogramDecl, or EmptyStatement rather than null when a syntax error in encountered.
The parser can now use more than one lookahead token to make parsing decisions.

4. Other Changes.

The notation for context-free grammars was changed to more closely resemble the one defined in ISO/IEC 14977, an international standard for EBNF notation.  For example, “zero or more” is now represented by braces “{“ and “}”.
A more complete discussion of scopes has been added together with a cleaner implementation of scopes in the compiler.

In addition, there are two new chapters, several new exercises, many new paragraphs, various rewordings to make the presentation easier to understand, and a few corrections.  Overall I am extremely pleased with the final result.


TOML Refactor [WIP]

Refactoring for the new InstantiateFromURL and TOML structure.

@arnavs can you ping me when this is ready and if needing support to change sphinxcontrib-jupyter to copy the files. Thanks!

https://github.com/QuantEcon/sphinxcontrib-jupyter/pull/232

Adds directory-specific *.toml wherever we would use QELAP and seed the top-level source/ with the QELP.
Update conf.py to use the new Jupinx dependency tools.


Tool displays a blank page / crashes on Internet Explorer 11

Describe the bug
This tool doesn't work on Internet Explorer 11. It just displays a blank page. If I open the developer console, there seems to be an error (please refer to screenshots).
In the IE11 console it reports "MediaStream is undefined" when we generate a bundle file using yarn run build
Expected Behaviour
The tool should be able to test the browser on Internet Explorer 11 or atleast should not crash.
Steps to Reproduce the Problem

yarn install
yarn start
Run the project and go to the web page http://localhost:8081.

Minimalistic code (recommended)
I have cloned the repo directly.
Specifications

Device: Desktop

OS: Windows

Browser Version: 11.765.17134.0

Version:

for each libraries : name -> version
voxeet-web-sdk: ^3.0.0
bowser: ^2.11.0
node: v12.18.2
npm version: 6.4.1

Hardware:

list of each specific hardware element on the system
Default - Microphone (Realtek High Definition Audio(SST))
Inbuilt webcam

Screenshots

IE 11 Error

Error in console when run after generating bundle file on IE11

IE 11 Version details

Working perfectly on Chrome

@Energizz any update on this?

@Energizz any update on this?

You will find the list of supported web browsers on this web page https://dolby.io/developers/interactivity-apis/client-sdk/articles/supported-client-platforms#web-sdk (the voxeet-sdk-web-tool is using the Web SDK)

You will find the list of supported web browsers on this web page https://dolby.io/developers/interactivity-apis/client-sdk/articles/supported-client-platforms#web-sdk (the voxeet-sdk-web-tool is using the Web SDK)


xarray backend crashesh on hv.Image if theres a 'z'-dimension on xarray.

This works:
arr = np.random.rand(3,3)
cube = xr.DataArray(arr, dims=['c', 'x'], coords={'c':[1,2,3], 'x':[1,2,3]})
hv.Image(cube)

This also works:
arr = np.random.rand(3,3)
cube = xr.DataArray(arr, dims=['c', 'x'], coords={'c':[1,2,3], 'x':[1,2,3]})
hv.Image(cube, vdims=['aaaa'])

This crashes:
arr = np.random.rand(3,3)
cube = xr.DataArray(arr, dims=['z', 'x'], coords={'z':[1,2,3], 'x':[1,2,3]})
hv.Image(cube)

This is because there is 'z' in xarray coords and dims, and holoviews uses 'z' as a hv.Dimension if vdims is not defined. I think better solution would be for example make vdims from other dimensions, like this:
cube = xr.DataArray(arr, dims=['z', 'x'], coords={'z':[1,2,3], 'x':[1,2,3]}) ==> hv.Image(cube) has dimensions 'z', 'x' and 'zx'.
Then it would be impossible to get a duplicate hv.Dimension, since the name of the new hv.Dimension is guaranteed to be longer than any other dimension.
I imagine this problem could be for more than just hv.Images, that it would be same for all structures that use vdims, but I havent really tested it.

I think better solution would be for example make vdims from other dimensions, like this:

This seems like a reasonable suggestion, it will still try to use the default value dimension name (which in the case of an Image is 'z') but if that's not valid it will fall back to your suggestion.

Okay thinking about this again I think that behavior would be a little bit weird, because you could end up with really long composite names. Better to raise a more informative error message and make the user supply a name.

I went with the improved error message.


vendor: update pdf.js to v2.1.266

May f-ix #7139 but I haven't tested this case. (just tested that it still load a normal pdf)
As mentioned by @zeripath, the current version of pdfjs is realy old so it is maybe a good idea to update it.
Changelog: https://github.com/mozilla/pdf.js/compare/v1.4.20...v2.1.266

It seems to support annotations now : https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-annotations

Codecov Report

:exclamation: No coverage uploaded for pull request base (master@c662f4c). Click here to learn what that means.
The diff coverage is n/a.

@@           Coverage Diff            @@
##             master   #7834   +/-   ##
========================================
  Coverage          ?   41.4%
========================================
  Files             ?     474
  Lines             ?   63780
  Branches          ?       0
========================================
  Hits              ?   26407
  Misses            ?   33935
  Partials          ?    3438

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c662f4c...7078a49. Read the comment docs.


chore(master): release 1.1.234

:robot: I have created a release beep boop
1.1.234 (2023-11-06)
Miscellaneous

deps: update dependency @types/alpinejs to v3.13.4 (9042a4d)

This PR was generated with Release Please. See documentation.

:robot: Release is at https://github.com/wayofdev/keywind/releases/tag/v1.1.234 :sunflower:


Felix incorrectly assumes that ipsets treat port 0 as 'all ports'.

Per the comment on line 623 of frules.py, Felix believes that port 0 means 'all ports' in ipsets. Based on my testing this is untrue, and I can find no support for this view in the man page.

Turns out that you can create such rules quite successfully, but they don't work, at least not on the version I was running with. The correct way to specify them is to give them as port range 1 to 65535, which then hits issue #197.

Resolved in #223.


chore(main): release 0.3.2

:robot: I have created a release beep boop
0.3.2 (2022-07-22)
Bug Fixes

correct release please token (86b0547)

This PR was generated with Release Please. See documentation.

:robot: Release is at https://github.com/eMerzh/ebike-dl/releases/tag/v0.3.2 :sunflower:


feat: add @zeabur/svelte-adapter support in adapter-auto

Introduce support for @zeabur/svelte-adapter in adapter-auto.
This PR simplifies the deployment process for developers aiming to host their Svelte applications on Zeabur.
It eliminates the need for manual installation and configuration updates, as outlined in the Zeabur documentation (https://zeabur.com/docs/guides/nodejs/svelte-kit#step-2-set-up-zeabursvelte-adapter).
Example Svelte Kit website deployed on Zeabur with @zeabur/svelte-adapter: https://svelte-kit.zeabur.app/

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

[ ] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
[x] This message body should clearly illustrate what problems it solves.
[ ] Ideally, include a test that fails without this PR but passes with it.

Tests

[x] Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

[x] If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

[x] Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

I've never particularly liked that this file is a kitchen sink for various adapters. I don't know if we want a giant list of relatively new and unknown hosting providers here. At the same time, it would be nice if adapter-auto didn't work only for the major players.
Perhaps we need a new way to handle this like process.env.SVELTEKIT_DEFAULT_ADAPTER and process.env.SVELTEKIT_DEFAULT_ADAPTER_VERSION could specify to download and use @zeabur/svelte-adapter version 1 and then we don't need to update this file whenever a new hosting provider would like to list their platform as they could provide those environment variables instead.


Do we need to support HTTPS requests?

With HTTP only I'm getting 301 redirect from a lot of other websites than my cloudflare worker which supports http and works fine.
Kind of weird to profile 301 redirect responses from other websites. The directions say to "send a HTTP request"
I'm using boost::asio with C++

You have a few options.
Some have used a TLS library and write the output directly to the socket.
Others have found sites that still honor vanilla HTTP.
Joaquin
On Tue, Oct 20, 2020 at 6:11 PM 'Ayush Khanal' via
cloudflare-assignment-application <
<EMAIL_ADDRESS>wrote:

With HTTP only I'm getting 301 redirect from a lot of other websites than
my cloudflare worker which supports http.
Kind of weird to profile 301 redirect responses from other websites. The
directions say to "send a HTTP request"
I'm using boost::asio with C++
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/cloudflare-hiring/cloudflare-2020-systems-engineering-assignment/issues/7,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ARBVIAMOQVDE6V7QN6VERWDSLYKIPANCNFSM4SY7YKZQ
.
--
You received this message because you are subscribed to the Google Groups
"cloudflare-assignment-application" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to<EMAIL_ADDRESS>To view this discussion on the web visit
https://groups.google.com/a/cloudflare.com/d/msgid/cloudflare-assignment-application/cloudflare-hiring/cloudflare-2020-systems-engineering-assignment/issues/7%40github.com
https://groups.google.com/a/cloudflare.com/d/msgid/cloudflare-assignment-application/cloudflare-hiring/cloudflare-2020-systems-engineering-assignment/issues/7%40github.com?utm_medium=email&utm_source=footer
.
For more options, visit
https://groups.google.com/a/cloudflare.com/d/optout.

--
Joaquin Madruga | Engineering Director
<EMAIL_ADDRESS>1 888 99 FLARE  |  www.cloudflare.com


[Bug ] As I have to solve the bug which comes in the Kushagra Saxena testimonial

What happened?
In this bug the  Kushagra Saxena testimonial   is not arranged in a proper way it it overlapping the card .
See this Screenshot for reference

How can we reproduce this bug?
I have to fix this bug as i can set the text in it proper way and looks good please assign me this issue as i am the contributor in GGSOC23
Desktop Information (Optional)
Lenovo ThinkPad i3
Urgency (Optional)
Medium priority
Record

[X] I agree to follow this project's Code of Conduct
[X] I have checked the existing issues
[X] I'm a GSSoC'23 contributor
[X] I want to work on this issue

Sure @SaiyamTuteja , add your testimonial too in that section

Ok i am adding my testimonial too


Disable SSL certificate verification for private apps

What is this PR
Fixes Ability to trust self-signed or expired certificates with private apps? #278

For security reasons, I would prefer that this parameter would be behind an opt-in config per app:

upon install
in Preferences / My Apps
optionally: When detecting SSL certificate errors on pages, propose feature similar to Chrome/Firefox to bypass SSL cert verification for current app (which would also be saved)

For security reasons, I would prefer that this parameter would be behind an opt-in config per app:

upon install
in Preferences / My Apps
optionally: When detecting SSL certificate errors on pages, propose feature similar to Chrome/Firefox to bypass SSL cert verification for current app (which would also be saved)

I totally agree with you. As for me the best way is to create parameter "Disable SSL check" or something like this. And enable-disable it at the first time with confirmation dialog like we do (should do 😄 ) with notifications.
But then it wouldn't be a 10 lines of code issue and it doesn't worth efforts.

Feel free to merge it as-is, I understand that adding this feature in the UI and what not is not the focus here.


The processing of score maps

Thanks for this amazing work, but could you please provide the code for the score map processing ?

I am not sure about your question, but this code would be helpful
https://github.com/clovaai/wsolevaluation/blob/master/inference.py

I am not sure about your question, but this code would be helpful https://github.com/clovaai/wsolevaluation/blob/master/inference.py

The problem I encountered is how to convert the generated score maps into heat maps (i.e. like cams) for display, you may provide code for this simple problem.


Unable to import plugin in TypeScript

Hello, I'm trying to import monthSelect plugin into my project:
import flatpickr from 'flatpickr'
import monthSelectPlugin from 'flatpickr/dist/plugins/monthSelect'

And getting an error while trying to init calendar instance as documentation says:
plugins: [
    new monthSelectPlugin({
       shorthand: true
    })
]

Where new declaration becomes faulty.

'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. ts(7009)

Am I importing it right or there is an error in types declaration? I was able to fix this with next lines of code:
plugins: [
    new (monthSelectPlugin as any)({
        shorthand: true
    })
]

Your Environment

flatpickr version used: 4.6.1
Browser name and version: Chrome 75
OS and version: Windows 10, TypeScript 3.4.5

I have same issue.

I managed to use it like this:
import * as _flatpickr from 'flatpickr';
import { FlatpickrFn } from 'flatpickr/dist/types/instance';
const flatpickr: FlatpickrFn = _flatpickr as any;

import * as _monthSelectPlugin from 'flatpickr/dist/plugins/monthSelect';
const monthSelectPlugin:Function = _monthSelectPlugin as any;

let monthPicker = flatpickr(document.getElementById("month"), {
      plugins: [ monthSelectPlugin({
            shorthand: true, //defaults to false
            dateFormat: "m/Y", //defaults to "F Y"
            altFormat: "m/Y", //defaults to "F Y"
          })
      ]
});

@bangnk hi, I tried using the same way, months are coming but styling is not proper...its coming in one row.
How do i add styles also for monthselect plugin.

@SalkiDixit  You have to copy the css in the flatpickr/src/style/themes folder in node_modules folder to your main css file.

Any updates on this? Running into this still

Where are you stuck?
On Thu, Oct 8, 2020, 3:22 AM marcellino ornelas<EMAIL_ADDRESS>wrote:

Any updates on this? Running into this still
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/flatpickr/flatpickr/issues/1848#issuecomment-705213379,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AMIRK5JOMJBGNEDOU6KHPD3SJTPKZANCNFSM4HYP4UFQ
.

Nevermind got this to work with
import confirmDatePlugin from 'flatpickr/dist/plugins/confirmDate/confirmDate';

Got the same issue today.
import flatpickr from "flatpickr";
import weekSelectPlugin from "flatpickr/dist/plugins/weekSelect/weekSelect";

flatpickr('#week-select', {
    "plugins": [new weekSelectPlugin({})]
});

With this i get two TypeScript errors:

TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type.
TS2554: Expected 0 arguments, but got 1.

And one browser error:

Uncaught TypeError: weekSelect_1.default is not a function

Any way to fix this?

The way I got it working was simply to remove the new keyword:
import flatpickr from 'flatpickr'
import monthSelectPlugin from 'flatpickr/dist/plugins/monthSelect'

plugins: [
    monthSelectPlugin({
        shorthand: true
    })
]


Reqwest Client SDK Move wip - do not merge

Ok, so I like where the separate clients angle is going but I think we may want to re-think how the clients are separated. I don't think it makes sense to make different clients for each type of resource defined (org, agent, location, etc.) but instead perhaps by the smart contracts that oversee those objects since we're separating things by smart contract throughout grid.
So, I think in this case the client organization would look more like sdk/client/pike and in the mod.rs file you would define the PikeClient trait. Then, in sdk/client/pike/reqwest would be the Reqwest-backed implementation of that client. The pike client would contain methods to access orgs, agents, roles, so pike-related objects. And then the same so on and so forth for each smart contract.
In terms of the resources that are used to deserialize the rest responses and what is available in our public API, these should be separate. For the top-level client trait definitions, these methods should return a non-(de)serializable struct. Then, in the reqwest modules for each client, we can define client-specific structs that are able to deserialize (i.e., have serde's deserialize trait) the rest responses. These structs would then be able to be converted (pretty simply, the main difference here is the publicly available resource structs shouldn't have serde traits) to the top-level resource struct once the response has been deserialized.

Ok, so I like where the separate clients angle is going but I think we may want to re-think how the clients are separated. I don't think it makes sense to make different clients for each type of resource defined (org, agent, location, etc.) but instead perhaps by the smart contracts that oversee those objects since we're separating things by smart contract throughout grid.
So, I think in this case the client organization would look more like sdk/client/pike and in the mod.rs file you would define the PikeClient trait. Then, in sdk/client/pike/reqwest would be the Reqwest-backed implementation of that client. The pike client would contain methods to access orgs, agents, roles, so pike-related objects. And then the same so on and so forth for each smart contract.
In terms of the resources that are used to deserialize the rest responses and what is available in our public API, these should be separate. For the top-level client trait definitions, these methods should return a non-(de)serializable struct. Then, in the reqwest modules for each client, we can define client-specific structs that are able to deserialize (i.e., have serde's deserialize trait) the rest responses. These structs would then be able to be converted (pretty simply, the main difference here is the publicly available resource structs shouldn't have serde traits) to the top-level resource struct once the response has been deserialized.

I like that Idea - I'd like to discuss this option with the team.

On second look, I'm curious about the fact the API layer has already abstracted out the details of which smart-contract is being used. would we be reintroducing a detail that the client should not necessarily be aware of?


Update functions-install-core-tools.md

Added documentation for WSL.
Reference: MicrosoftDocs/azure-docs#83871

@microsoft-github-policy-service agree

@ggailey777
Can you review the proposed changes?
When the changes are ready for publication, add a #sign-off comment to signal that the PR is ready for the review team to merge.
#label:"aq-pr-triaged"
@MicrosoftDocs/public-repo-pr-review-team

PR review team emailed author today


Phan/Analyze/BreadthFirstVisitor.php:851 Undefined offset: 0

When I run phan on one of my codebases I get a lot of these in the output:
/usr/local/Cellar/phan/0.1/src/Phan/Analyze/BreadthFirstVisitor.php:851 Undefined offset: 0
#0  Phan\Log::errorHandler() called at [/usr/local/Cellar/phan/0.1/src/Phan/Analyze/BreadthFirstVisitor.php:851]
#1  Phan\Analyze\BreadthFirstVisitor->visitDim() called at [/usr/local/Cellar/phan/0.1/src/Phan/Language/AST/Element.php:72]
#2  Phan\Language\AST\Element->acceptKindVisitor() called at [/usr/local/Cellar/phan/0.1/src/Phan/Phan.php:399]
#3  Phan\Phan->analyzeNodeInContext() called at [/usr/local/Cellar/phan/0.1/src/Phan/Phan.php:389]
#4  Phan\Phan->analyzeNodeInContext() called at [/usr/local/Cellar/phan/0.1/src/Phan/Phan.php:389]
#5  Phan\Phan->analyzeNodeInContext() called at [/usr/local/Cellar/phan/0.1/src/Phan/Phan.php:389]
#6  Phan\Phan->analyzeNodeInContext() called at [/usr/local/Cellar/phan/0.1/src/Phan/Phan.php:389]
#7  Phan\Phan->analyzeNodeInContext() called at [/usr/local/Cellar/phan/0.1/src/Phan/Phan.php:389]
#8  Phan\Phan->analyzeNodeInContext() called at [/usr/local/Cellar/phan/0.1/src/Phan/Phan.php:389]
#9  Phan\Phan->analyzeNodeInContext() called at [/usr/local/Cellar/phan/0.1/src/Phan/Phan.php:389]
#10 Phan\Phan->analyzeNodeInContext() called at [/usr/local/Cellar/phan/0.1/src/Phan/Phan.php:389]
#11 Phan\Phan->analyzeNodeInContext() called at [/usr/local/Cellar/phan/0.1/src/Phan/Phan.php:389]
#12 Phan\Phan->analyzeNodeInContext() called at [/usr/local/Cellar/phan/0.1/src/Phan/Phan.php:389]
#13 Phan\Phan->analyzeNodeInContext() called at [/usr/local/Cellar/phan/0.1/src/Phan/Phan.php:389]
#14 Phan\Phan->analyzeNodeInContext() called at [/usr/local/Cellar/phan/0.1/src/Phan/Analyze/Analyzable.php:89]
#15 Phan\Language\Element\Method->analyze() called at [/usr/local/Cellar/phan/0.1/src/Phan/Analyze/BreadthFirstVisitor.php:1114]
#16 Phan\Analyze\BreadthFirstVisitor->analyzeCallToMethod() called at [/usr/local/Cellar/phan/0.1/src/Phan/Analyze/BreadthFirstVisitor.php:577]
#17 Phan\Analyze\BreadthFirstVisitor->visitCall() called at [/usr/local/Cellar/phan/0.1/src/Phan/Language/AST/Element.php:44]
#18 Phan\Language\AST\Element->acceptKindVisitor() called at [/usr/local/Cellar/phan/0.1/src/Phan/Phan.php:399]
#19 Phan\Phan->analyzeNodeInContext() called at [/usr/local/Cellar/phan/0.1/src/Phan/Phan.php:389]
#20 Phan\Phan->analyzeNodeInContext() called at [/usr/local/Cellar/phan/0.1/src/Phan/Phan.php:389]
#21 Phan\Phan->analyzeNodeInContext() called at [/usr/local/Cellar/phan/0.1/src/Phan/Phan.php:389]
#22 Phan\Phan->analyzeNodeInContext() called at [/usr/local/Cellar/phan/0.1/src/Phan/Phan.php:389]
#23 Phan\Phan->analyzeNodeInContext() called at [/usr/local/Cellar/phan/0.1/src/Phan/Phan.php:389]
#24 Phan\Phan->analyzeNodeInContext() called at [/usr/local/Cellar/phan/0.1/src/Phan/Phan.php:389]
#25 Phan\Phan->analyzeNodeInContext() called at [/usr/local/Cellar/phan/0.1/src/Phan/Phan.php:389]
#26 Phan\Phan->analyzeNodeInContext() called at [/usr/local/Cellar/phan/0.1/src/Phan/Phan.php:389]
#27 Phan\Phan->analyzeNodeInContext() called at [/usr/local/Cellar/phan/0.1/src/Phan/Analyze/Analyzable.php:89]
#28 Phan\Language\Element\Method->analyze() called at [/usr/local/Cellar/phan/0.1/src/Phan/Analyze/BreadthFirstVisitor.php:1114]
#29 Phan\Analyze\BreadthFirstVisitor->analyzeCallToMethod() called at [/usr/local/Cellar/phan/0.1/src/Phan/Analyze/BreadthFirstVisitor.php:577]
#30 Phan\Analyze\BreadthFirstVisitor->visitCall() called at [/usr/local/Cellar/phan/0.1/src/Phan/Language/AST/Element.php:44]
#31 Phan\Language\AST\Element->acceptKindVisitor() called at [/usr/local/Cellar/phan/0.1/src/Phan/Phan.php:399]
#32 Phan\Phan->analyzeNodeInContext() called at [/usr/local/Cellar/phan/0.1/src/Phan/Phan.php:389]
#33 Phan\Phan->analyzeNodeInContext() called at [/usr/local/Cellar/phan/0.1/src/Phan/Phan.php:389]
#34 Phan\Phan->analyzeNodeInContext() called at [/usr/local/Cellar/phan/0.1/src/Phan/Phan.php:330]
#35 Phan\Phan->analyzeFile() called at [/usr/local/Cellar/phan/0.1/src/Phan/Phan.php:111]
#36 Phan\Phan->analyzeFileList() called at [/usr/local/Cellar/phan/0.1/phan:34]

Uhoh. Thanks for the report.
@ablyler I just pushed a patch (https://github.com/etsy/phan/commit/f0db9e90ed8893a108efe96fc97beb515119d22a) that might fix the issue for you; can you pull and try again?
If that doesn't work, can you send me some code that it might be failing on? I added an assertion to print out the file and line that its failing on if it dies.

@morria no worries! updating and re-running it now.

@morria looks good now, thanks!

Sweet. Thanks again!


Support for unicode uppercase/lowecase where length change.

There is an assumption that character of upper and lower case string are in sync.
A typical example that break this assumption is ß
'LATIN SMALL LETTER SHARP S' (U+00DF)

Sharp s is unique among the letters of the Latin alphabet in that it has no traditional upper case form.

[1]
On chrome:
"Straße".toUpperCase() === "STRASSE" // note: 6 char to 7 char
"STRASSE".toLowerCase() === "strasse"

On Firefox & Edge:
"Straße".toUpperCase() === "STRAßE"

Because
a) This looks like an exceptional case
b) only conversion from lower to upper is affected
c) the only toUpperCase in the code touch checking for core character.
We are going to band-aid this by adding sharp s to the list of optional characters.

LATIN SMALL LIGATURE FL' (U+FB02)
"ﬂ".toUpperCase() == "FL" // length 1 to length 2