profile
viewpoint
Simen Bekkhus SimenB @folio-as Oslo, Norway

facebook/jest 32950

Delightful JavaScript Testing.

siimon/prom-client 1519

Prometheus client for node.js

istanbuljs/istanbuljs 600

monorepo containing the various nuts and bolts that facilitate istanbul.js test instrumentation

af/envalid 523

Environment variable validation for Node.js

istanbuljs/babel-plugin-istanbul 475

A babel plugin that adds istanbul instrumentation to ES6 code

SimenB/add-asset-html-webpack-plugin 303

Add a JavaScript or CSS asset to the HTML generated by html-webpack-plugin

microsoft/playwright-test 149

Build a cross-browser end-to-end test suite with Playwright.

istanbuljs/v8-to-istanbul 56

convert from v8 coverage format to istanbul's format

danielhusar/gulp-stylint 29

Gulp plugin for stylus stylint linter

jest-community/jest-dev-platform 4

Learn how to use Jest as a platform to power your development flow

PR opened facebook/jest

chore: link to ESM docs on syntax error

<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. The two fields below are mandatory. -->

<!-- Please remember to update CHANGELOG.md at the root of the project if you have not done so. -->

Summary

It's getting to the point where it's usable enough that we can point people to it. The docs are pretty explicit about its experimental nature, so I think this is fine.

<!-- Explain the motivation for making this change. What existing problem does the pull request solve? -->

Test plan

image

<!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI. -->

+3 -0

0 comment

1 changed file

pr created time in a minute

create barnchSimenB/jest

branch : link-esm-docs-syntaxerror

created branch time in 3 minutes

PR opened facebook/jest

chore: update node babel syntax preset

<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. The two fields below are mandatory. -->

<!-- Please remember to update CHANGELOG.md at the root of the project if you have not done so. -->

Summary

This enables TLA and our test for native ESM passes with babel-jest enabled

<!-- Explain the motivation for making this change. What existing problem does the pull request solve? -->

Test plan

Green CI

<!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI. -->

+8 -7

0 comment

2 changed files

pr created time in 8 minutes

create barnchSimenB/jest

branch : bump-babel-syntax-preset

created branch time in 11 minutes

pull request commentnicolo-ribaudo/babel-preset-current-node-syntax

feat: add support for TLA on node 14.3 and newer

wonderful, thanks!

SimenB

comment created time in 18 minutes

pull request commentnicolo-ribaudo/babel-preset-current-node-syntax

feat: add support for TLA on node 14.3 and newer

Ah, I missed the resolutions entry! Unlocking @babel/core dev dep and @babel/parser resolution and then regenerating the lockfile makes the test pass. Thoughts on how to deal with it?

SimenB

comment created time in 33 minutes

pull request commentfacebook/jest

Show warning in cli in case of multiple configs

I completely forgot about this, sorry about that @Mansehej! Should have created a reminder for myself 😬

What I would do is create some temporary directories and write config into them, sorta like https://github.com/facebook/jest/blob/a94730c685a40055fe1694d7e4833061d0055f79/e2e/tests/dependencyClash.test.ts#L40-L45

So something like

/**
 * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

import * as path from 'path';
import {tmpdir} from 'os';
import {cleanup, createEmptyPackage, writeFiles} from '../Utils';
import runJest from '../runJest';

const tempDir = path.resolve(tmpdir(), 'multiple-jest-configs');

beforeEach(() => {
  cleanup(tempDir);
});

test('throws when jest.config.js and package.json config exist', () => {
  createEmptyPackage(tempDir);
  writeFiles(tempDir, {
    '__tests__/test.js': `
      test('dummy test', () => expect(1).toBe(1));
    `,
    'jest.config.js': `module.exports = {
    };`,
  });
  const {stderr, exitCode} = runJest(tempDir);

  expect(exitCode).toBe(1);
  expect(stderr); // something - probably a `toContain` on the error text
});

test('does not throw when jest.config.js exist, but no config in package.json', () => {
  createEmptyPackage(tempDir, {
    description: 'THIS IS AN AUTOGENERATED FILE AND SHOULD NOT BE ADDED TO GIT',
  });
  writeFiles(tempDir, {
    '__tests__/test.js': `
      test('dummy test', () => expect(1).toBe(1));
    `,
    'jest.config.js': `module.exports = {
    };`,
  });
  const {stderr, exitCode} = runJest(tempDir);

  expect(exitCode).toBe(0);
});

Then I would write tests for all the different config files we have.

Mansehej

comment created time in 36 minutes

issue commentfacebook/jest

Add debug output for transformers

Yeah, since Jest intercepts console inside the tests a way for plugins to hook into it would be nice. That part is not a huge issue for transformers as they run outside the tests and thus have access to the "real" console, although there's always a risk Jest will erase the output. Sorta related: #7910

alexkreidler

comment created time in an hour

issue closedfacebook/jest

Setup test suite for type definitions

Jest is written in TypeScript, but that doesn't mean that the different APIs Jest injects into a test are particularly well typed. Having good type tests for expect and the different methods available on the jest object (jest.spyOn, jest.mock etc) would be great to assert that they provide the DX they should. Especially since we hope to include global typings with Jest 25, we should ensure we are safe to move quickly if they are painful for people coming from the DefinitelyTyped types. Especially assertions that invalid things are reported as type errors would be great.

Current test suite in DT: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/jest/jest-tests.ts

I'm not sure what tool would be best for this, but something like https://github.com/microsoft/dtslint or https://github.com/SamVerschueren/tsd maybe? It should run as part of Jest's test suite, so we need a custom runner for them (or some other tool that does the same job).

This runner could then of course be used by other people who want to test their type defs, and run those tests with Jest.

/cc @orta if you have any thoughts you wanna share on this

closed time in an hour

SimenB

issue commentfacebook/jest

Setup test suite for type definitions

This landed in #10407. While we don't test that much yet, the infrastructure is now in place 🎉

SimenB

comment created time in an hour

push eventSimenB/jest

Simen Bekkhus

commit sha a94730c685a40055fe1694d7e4833061d0055f79

chore(docs): link to `watchman` docs

view details

push time in an hour

push eventfacebook/jest

Simen Bekkhus

commit sha a94730c685a40055fe1694d7e4833061d0055f79

chore(docs): link to `watchman` docs

view details

push time in an hour

Pull request review commentfacebook/jest

feat(jest-haste-map): Enable crawling for symlink test files

 class HasteMap extends EventEmitter {     const crawlerOptions: CrawlerOptions = {       computeSha1: options.computeSha1,       data: hasteMap,+      enableSymlinks: options.enableSymlinks,       extensions: options.extensions,       forceNodeFilesystemAPI: options.forceNodeFilesystemAPI,       ignore,       rootDir: options.rootDir,       roots: options.roots,     }; +    if (options.enableSymlinks) {+      const watchmanConfigPath = path.join(options.rootDir, '.watchmanconfig');++      if (existsSync(watchmanConfigPath)) {

I noticed the watchman config option was not documented, so I just did so: 6601e921a9b2668aa70841eb09efb097f3c9d508

mrmeku

comment created time in an hour

PullRequestReviewEvent

push eventfacebook/jest

Simen Bekkhus

commit sha 6601e921a9b2668aa70841eb09efb097f3c9d508

chore: document `watchman` configuration option

view details

push time in an hour

push eventSimenB/jest

Simen Bekkhus

commit sha 6601e921a9b2668aa70841eb09efb097f3c9d508

chore: document `watchman` configuration option

view details

push time in an hour

Pull request review commentfacebook/jest

feat(jest-haste-map): Enable crawling for symlink test files

 _Note: A global teardown module configured in a project (using multi-project run  _Note: The same caveat concerning transformation of `node_modules` as for `globalSetup` applies to `globalTeardown`._ +### `haste` [object]++Default: `undefined`++This will be used to configure the behavior of `jest-haste-map`, Jest's internal file crawler/cache system. The following options are supported:++```ts+type HasteConfig = {+  /** Whether to hash files using SHA-1. */+  computeSha1?: boolean;+  /** The platform to use as the default, e.g. 'ios'. */+  defaultPlatform?: string | null;+  /** 
  /**

to appease the linter

mrmeku

comment created time in 2 hours

Pull request review commentfacebook/jest

feat(jest-haste-map): Enable crawling for symlink test files

 class HasteMap extends EventEmitter {     const crawlerOptions: CrawlerOptions = {       computeSha1: options.computeSha1,       data: hasteMap,+      enableSymlinks: options.enableSymlinks,       extensions: options.extensions,       forceNodeFilesystemAPI: options.forceNodeFilesystemAPI,       ignore,       rootDir: options.rootDir,       roots: options.roots,     }; +    if (options.enableSymlinks) {+      const watchmanConfigPath = path.join(options.rootDir, '.watchmanconfig');++      if (existsSync(watchmanConfigPath)) {

Instead of checking for the existence of a watchman config file, we should just check if Jest is configured to use it (options.useWatchman).

We might also consider throwing in normalize in jest-config if both options are true as they are incompatible and it would give us an even earlier error. We should still check in here though so e.g. Metro can still have the same checks.

mrmeku

comment created time in 2 hours

Pull request review commentfacebook/jest

feat(jest-haste-map): Enable crawling for symlink test files

 export const testIfHg = (...args: Parameters<typeof test>) => {     test.skip(...args);   } };++// Certain environments (like CITGM and GH Actions) do not come with watchman installed+let watchmanIsInstalled: boolean | null = null;++export const testIfWatchman = (...args: Parameters<typeof test>) => {

this is unused now, right?

mrmeku

comment created time in 2 hours

PullRequestReviewEvent
PullRequestReviewEvent

pull request commentnicolo-ribaudo/babel-preset-current-node-syntax

feat: add support for TLA on node 14.3 and newer

There's something else different between the Jest repo and this repo. If I don't have the syntax plugin in the preset in the Jest repo, I get this error

SyntaxError: /Users/simen/repos/jest/e2e/native-esm/__tests__/native-esm-tla.test.js: Can not use keyword 'await' outside an async function (8:14)

But the error I get in this repo - with or without the syntax plugin - is

SyntaxError: unknown: await is a reserved word (1:0)

I would have thought just using a newer version of @babel/core would fix that as it seems that error was improved, but this is using "@babel/core": "^7.0.0" in devDeps and refreshing the lockfile so everything should be at the latest version

SimenB

comment created time in 2 hours

pull request commentnicolo-ribaudo/babel-preset-current-node-syntax

feat: add support for TLA on node 14.3 and newer

sourceType: "module" makes no difference

SimenB

comment created time in 2 hours

Pull request review commentnicolo-ribaudo/babel-preset-current-node-syntax

feat: add support for TLA on node 14.3 and newer

 jobs:      strategy:       matrix:-        node-version: [10.19, 12.4, 12.8, 13.11, 14]+        node-version: [10.19, 12.4, 12.8, 13.11, 14.3, 14, 15]

I guess 15 doesn't matter, but anyways

SimenB

comment created time in 2 hours

PullRequestReviewEvent

Pull request review commentnicolo-ribaudo/babel-preset-current-node-syntax

feat: add support for TLA on node 14.3 and newer

 for (const [name, cases] of Object.entries(tests)) { // runtime. It is supported starting from 10.4, so we can check the version. const major = parseInt(process.versions.node, 10); const minor = parseInt(process.versions.node.match(/^\d+\.(\d+)/)[1], 10);-if (major > 10 || (major === 10 && minor > 4)) {+if (major > 10 || (major === 10 && minor >= 4)) {

bug fix looking at the comment above

SimenB

comment created time in 2 hours

PullRequestReviewEvent

PR opened nicolo-ribaudo/babel-preset-current-node-syntax

Reviewers
feat: add support for TLA on node 14.3 and newer

See https://github.com/babel/babel/issues/12292

I'm unable to make this pass the tests, tho :( Weirdly, copying in the code here makes TLA work in a test in Jest repo, but I keep getting parser errors here. I tried updating @babel/core to latest just in case, but that didn't make a difference

+27 -8

0 comment

5 changed files

pr created time in 2 hours

create barnchnicolo-ribaudo/babel-preset-current-node-syntax

branch : tla

created branch time in 2 hours

issue closedbabel/babel

Add `caller` option for enabling top level await parsing

Feature Request

<!-- Check this if you would like to implement a PR, we are more than happy to help you go through the process !-->

  • [ ] I would like to work on this feature!

I'm working on native ESM support in Jest, and we currently tell people to disable Babel in order to use it (as it's somewhat clunky to configure babel for ESM unless you're familiar with it). I'd really like for babel-jest to work as seemingly as possible so people don't know it's there.

Is your feature request related to a problem? <!-- A concise description of what the problem is. Ex. I have an issue when [...] -->

Jest already sends in supportsDynamicImport and supportsStaticESM in the caller object, so we're very close to have @babel/preset-env automatically do the correct thing when used with default config. TLA seems like a thing a "runtime" can tell Babel it supports similar to import() and import from. In Jest's case TLA will work if Node supports it (i.e. node@>=14.3.0) and the ESM vm APIs are available (--experimental-vm-modules) is passed. Both of these things are trivial for us to check and pass in via the caller option.

Describe the solution you'd like

Ergh, see above 😅

Describe alternatives you've considered.

Telling people to enable the syntax plugin if they want to use TLA. Which is probably fine as well, but automagic support would be even nicer 🙂

Documentation, Adoption, Migration Strategy <!-- If you can, explain how users will be able to use this and how it might be documented. Maybe a mock-up? -->

This is something Jest would pass in, so the user wouldn't have to do anything. I suppose webpack (if they support it) etc could do that via babel-loader as well.

closed time in 3 hours

SimenB

issue commentbabel/babel

Add `caller` option for enabling top level await parsing

Yeah, makes sense. I think we can add it to https://github.com/nicolo-ribaudo/babel-preset-current-node-syntax/, but Babel core makes sense to stick to stage 4. Thanks!

SimenB

comment created time in 3 hours

issue commentfacebook/jest

`toHaveBeenCalledWith` `objectContaining` issue after patch update 26.6.1

Yeah, I'm leaning towards reverting and perhaps updating the docs to be explicit about depth

scagood

comment created time in 3 hours

pull request commentfacebook/jest

chore: handle file URLs in dynamic imports

Node doesn't support any other protocol than file for now, but we probably should be more future proof yeah - I just don't know a good way to separate between relative paths, absolute paths (both unix style and windows) and URLs

SimenB

comment created time in 3 hours

push eventSimenB/jest

David Stensland

commit sha 83c08284444d41f4a034da4802bf26b9264d28fa

fix(jest-config): throw correct error for missing preset modules (#10737)

view details

push time in 13 hours

push eventfacebook/jest

David Stensland

commit sha 83c08284444d41f4a034da4802bf26b9264d28fa

fix(jest-config): throw correct error for missing preset modules (#10737)

view details

push time in 13 hours

PR merged facebook/jest

fix(jest-config): throw correct error for missing preset modules cla signed

When loading a preset module that cannot be resolved (e.g. is not npm installed), the following error is shown to users:

● Validation Error:

  Preset foobar is invalid:

  The "id" argument must be of type string. Received null

Instead, the following error should be shown

● Validation Error:

  Preset foobar not found.

This PR changes the error message by handling when Resolver.findNodeModule returns null, indicating that the module cannot be successfully imported.

<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. The two fields below are mandatory. -->

<!-- Please remember to update CHANGELOG.md at the root of the project if you have not done so. -->

Summary

The error currently presented when the preset module is missing is confusing, but also not the error intended to be shown.

For an example of confusion, see https://github.com/facebook/jest/issues/10035

<!-- Explain the motivation for making this change. What existing problem does the pull request solve? -->

Test plan

  1. Updated jest-config tests pass
  2. Correct error is shown in local testing

To test yourself, add something like the following to your jest.config.js and observe the error message when running jest

  preset: 'foobar',

<!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI. -->

+7 -5

0 comment

3 changed files

terite

pr closed time in 13 hours

push eventterite/jest

Simen Bekkhus

commit sha 2012e7edd3b57843ceeea50065b779f216057ed4

Update CHANGELOG.md

view details

push time in 13 hours

push eventterite/jest

Chris Shepherd

commit sha 1b8f70ae50628106c4712aafed4f36ae45c2180c

Update TypeScript example to show use of newer Jest types (#10399)

view details

Simen Bekkhus

commit sha 93f48fe1c975daf7364ead942c54d3b8b19a9f74

chore: delete `eslint-config-fb-strict` package from repo (#10739)

view details

Simen Bekkhus

commit sha ec89e858395f24d37ae1ca281e28487d6a4fc894

chore: bump `@babel/core` types (#10388)

view details

Gopal Venkatesan

commit sha d554eb1ae9ae7118e2691e1fa43b8e9fc7c37e7d

Add a note to the Exceptions section (#10742)

view details

Simen Bekkhus

commit sha f798a65132e2733371f80bce6d4aaef39b03b08b

chore: handle file URLs in dynamic imports (#10744)

view details

Simen Bekkhus

commit sha 8acfd38e0d1f8244c3fdeeaa59970aa010f4b6af

fix: tell transformers Jest supports dynamic imports (#10745)

view details

Simen Bekkhus

commit sha 7b0d40d9d5a804f9e35eb329c1992a7f6b63c2ae

Merge branch 'master' into jest-config-preset

view details

push time in 13 hours

push eventterite/jest

Simen Bekkhus

commit sha ca8c88b663e12ffb0c338820ab2d89bcf5053ece

Update packages/jest-config/src/__tests__/normalize.test.js

view details

push time in 13 hours

PullRequestReviewEvent

Pull request review commentfacebook/jest

fix(jest-config): throw correct error for missing preset modules

 describe('preset', () => {         return '/node_modules/react-native-js-preset/jest-preset.js';       } -      if (name === 'doesnt-exist') {+      if (/doesnt-exist/.test(name)) {

ah, this inside a mock thing 👍

      if (name.includes('doesnt-exist')) {
terite

comment created time in 13 hours

PullRequestReviewEvent

push eventSimenB/DefinitelyTyped

Simen Bekkhus

commit sha 2be23e532b29922e7618c091f46fa8f30a749d76

test

view details

push time in 13 hours

issue commentbabel/babel

Add `caller` option for enabling top level await parsing

An alternative is of course that @babel/jest adds the syntax plugin ourselves if the option is passed.

SimenB

comment created time in 14 hours

PR opened DefinitelyTyped/DefinitelyTyped

Reviewers
fix(@babel/core): add more `TransformCaller` types

Please fill in this template.

  • [x] Use a meaningful title for the pull request. Include the name of the package modified.
  • [x] Test the change in your own code. (Compile and run.)
  • [ ] Add or edit tests to reflect the change. (Run with npm test YOUR_PACKAGE_NAME.)
  • [x] Follow the advice from the readme.
  • [x] Avoid common mistakes.
  • [ ] Run npm run lint package-name (or tsc if no tslint.json is present).

Select one of these and delete the others:

If changing an existing definition:

  • [x] Provide a URL to documentation or source code which provides context for the suggested changes: https://github.com/babel/babel/blob/b649f8d192dd1c62e2a31d856a7c39ff21d70dd5/packages/babel-preset-env/src/index.js#L209-L223
  • [ ] If this PR brings the type definitions up to date with a new version of the JS library, update the version number in the header.
  • [ ] Include tests for your changes
  • [ ] If you are making substantial changes, consider adding a tslint.json containing { "extends": "dtslint/dt.json" }. If for reason the any rule need to be disabled, disable it for that line using // tslint:disable-next-line [ruleName] and not for whole package so that the need for disabling can be reviewed.

While one can extend it to more keys in our own code, supporting the ones that @babel/preset-env looks at by default makes sense to me

+2 -0

0 comment

1 changed file

pr created time in 14 hours

push eventSimenB/DefinitelyTyped

Simen Bekkhus

commit sha 1d28e37fe3bd7f599a9ebaaba49b60d5c777879a

fix(@babel/core): add more `TransformCaller` types

view details

push time in 14 hours

IssuesEvent

issue commentbabel/babel

Add `caller` option for enabling top level await parsing

I'm unable to get it to work, tho...

image

Logging what is passed to @babel/core's transformSync at the bottom - from what I can understand that should be enough? Or maybe it only works for preset-env and not core in general? If yes - can that be changed? Or is that dependent on it becoming stage 4?

SimenB

comment created time in 14 hours

issue closedbabel/babel

Add `caller` option for enabling top level await parsing

Feature Request

<!-- Check this if you would like to implement a PR, we are more than happy to help you go through the process !-->

  • [ ] I would like to work on this feature!

I'm working on native ESM support in Jest, and we currently tell people to disable Babel in order to use it (as it's somewhat clunky to configure babel for ESM unless you're familiar with it). I'd really like for babel-jest to work as seemingly as possible so people don't know it's there.

Is your feature request related to a problem? <!-- A concise description of what the problem is. Ex. I have an issue when [...] -->

Jest already sends in supportsDynamicImport and supportsStaticESM in the caller object, so we're very close to have @babel/preset-env automatically do the correct thing when used with default config. TLA seems like a thing a "runtime" can tell Babel it supports similar to import() and import from. In Jest's case TLA will work if Node supports it (i.e. node@>=14.3.0) and the ESM vm APIs are available (--experimental-vm-modules) is passed. Both of these things are trivial for us to check and pass in via the caller option.

Describe the solution you'd like

Ergh, see above 😅

Describe alternatives you've considered.

Telling people to enable the syntax plugin if they want to use TLA. Which is probably fine as well, but automagic support would be even nicer 🙂

Documentation, Adoption, Migration Strategy <!-- If you can, explain how users will be able to use this and how it might be documented. Maybe a mock-up? -->

This is something Jest would pass in, so the user wouldn't have to do anything. I suppose webpack (if they support it) etc could do that via babel-loader as well.

closed time in 14 hours

SimenB

issue commentbabel/babel

Add `caller` option for enabling top level await parsing

Well, then...

https://github.com/babel/babel/blob/95fcb3e16c8d08bc4ff2980c4b53fa2506948774/packages/babel-preset-env/src/index.js#L221-L223

😅

SimenB

comment created time in 14 hours

delete branch SimenB/jest

delete branch : transformer-dynamic-import

delete time in 14 hours

push eventfacebook/jest

Simen Bekkhus

commit sha 8acfd38e0d1f8244c3fdeeaa59970aa010f4b6af

fix: tell transformers Jest supports dynamic imports (#10745)

view details

push time in 14 hours

PR merged facebook/jest

fix: tell transformers Jest supports dynamic imports cla signed

<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. The two fields below are mandatory. -->

<!-- Please remember to update CHANGELOG.md at the root of the project if you have not done so. -->

Summary

This should have been part of #10620.

<!-- Explain the motivation for making this change. What existing problem does the pull request solve? -->

Test plan

Green CI

<!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI. -->

+4 -2

0 comment

1 changed file

SimenB

pr closed time in 14 hours

issue openedbabel/babel

Add `caller` option for enabling top level await parsing

Feature Request

<!-- Check this if you would like to implement a PR, we are more than happy to help you go through the process !-->

  • [ ] I would like to work on this feature!

I'm working on native ESM support in Jest, and we currently tell people to disable Babel in order to use it (as it's somewhat clunky to configure babel for ESM unless you're familiar with it). I'd really like for babel-jest to work as seemingly as possible so people don't know it's there.

Is your feature request related to a problem? <!-- A concise description of what the problem is. Ex. I have an issue when [...] -->

Jest already sends in supportsDynamicImport and supportsStaticESM in the caller object, so we're very close to have @babel/preset-env automatically do the correct thing when used with default config. TLA seems like a thing a "runtime" can tell Babel it supports similar to import() and import from. In Jest's case TLA will work if Node supports it (i.e. node@>=14.3.0) and the ESM vm APIs are available (--experimental-vm-modules) is passed. Both of these things are trivial for us to check and pass in via the caller option.

Describe the solution you'd like

Ergh, see above 😅

Describe alternatives you've considered.

Telling people to enable the syntax plugin if they want to use TLA. Which is probably fine as well, but automagic support would be even nicer 🙂

Documentation, Adoption, Migration Strategy <!-- If you can, explain how users will be able to use this and how it might be documented. Maybe a mock-up? -->

This is something Jest would pass in, so the user wouldn't have to do anything. I suppose webpack (if they support it) etc could do that via babel-loader as well.

created time in 14 hours

issue commentfacebook/jest

jest-worker crashes when library code logs errors

process.send should only be used by child processes, no? And jest-worker should probably just ignore any unknown ones

KyleAMathews

comment created time in 15 hours

push eventSimenB/jest

Simen Bekkhus

commit sha f798a65132e2733371f80bce6d4aaef39b03b08b

chore: handle file URLs in dynamic imports (#10744)

view details

push time in 15 hours

push eventfacebook/jest

Simen Bekkhus

commit sha f798a65132e2733371f80bce6d4aaef39b03b08b

chore: handle file URLs in dynamic imports (#10744)

view details

push time in 15 hours

delete branch SimenB/jest

delete branch : handle-dynamic-url-imports

delete time in 15 hours

PR merged facebook/jest

chore: handle file URLs in dynamic imports cla signed

<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. The two fields below are mandatory. -->

<!-- Please remember to update CHANGELOG.md at the root of the project if you have not done so. -->

Summary

Not sure if a startsWith is the best, but it works 🤷

<!-- Explain the motivation for making this change. What existing problem does the pull request solve? -->

Test plan

Test added

<!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI. -->

+13 -2

0 comment

4 changed files

SimenB

pr closed time in 15 hours

PR opened facebook/jest

fix: tell transformers Jest supports dynamic imports

<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. The two fields below are mandatory. -->

<!-- Please remember to update CHANGELOG.md at the root of the project if you have not done so. -->

Summary

This should have been part of #10620.

<!-- Explain the motivation for making this change. What existing problem does the pull request solve? -->

Test plan

Green CI

<!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI. -->

+4 -2

0 comment

1 changed file

pr created time in 15 hours

create barnchSimenB/jest

branch : transformer-dynamic-import

created branch time in 15 hours

issue closedfacebook/jest

Tesing onBlur attribute in old html file, undefined handler function message

Question: I have the following html file from a Javascript book:

<!DOCTYPE html>
<html>
  <head>
    <title>JavaScript &amp; jQuery - Chapter 6: Events - Event Listener</title>
    <link rel="stylesheet" href="css/c06.css" />
  </head>
  <body>
    <div id="page">
      <h1>List King</h1>
      <h2>New Account</h2>
      <form method="post" action="http://www.example.org/register">

        <label for="username">Create a username: </label>
        <input type="text" id="username" onblur="checkUsername()"/>
        <div id="feedback"></div>

        <label for="password">Create a password: </label>
        <input type="password" id="password" />

        <input type="submit" value="sign up" />

      </form>
    </div>
    <script src="js/event-listener.js"></script>
  </body>
</html>

and the javascript file:

function checkUsername() {                             // Declare function
  var elMsg = document.getElementById('feedback');     // Get feedback element
  var elUsername = document.getElementById('username');// Get username input
  if (elUsername.value.length < 5) {                   // If username too short
    elMsg.textContent = 'Username must be 5 characters or more'; // Set msg
  } else {                                              // Otherwise
    elMsg.textContent = '';                             // Clear message
  }
}

and the jest test:

const fs3 = require('fs');
const path3 = require('path');
const html3 = fs3.readFileSync(path3.resolve(__dirname, '../event-attributes-post.html'), 'utf8');

describe('checkEventAttributes', function () {
    beforeEach(async() => {
        document.documentElement.innerHTML = html3.toString();
    });

    it('testOnBlurHandlerAttribute', () => {
	console.log('start of onblur test');
	var inputit = document.getElementById('username');
	
	expect(inputit.value).toBe('');

	const checkUsername = require('../js/event-attributes-post.js');

	inputit.focus();
	inputit.value = "123";
	inputit.blur();
	
	expect(inputit.value).toBe('123');
	
	var feedback = document.getElementById('feedback');
	expect(feedback.textContent).toBe('Username must be 5 characters or more');
    });
});

when I run the test I get

Error: Uncaught [ReferenceError: checkUsername is not defined]

I get the not defined message when I call blur() on the element so it looks like jest is trying to call the function but it is not visible or defined for some reason.

Things work when I use DOM event handlers and Event listeners instead of the HTML even handler attribute. Is it just that the HTML event handler attribute is deprecated and JEST does not work well with that anymore?

Regards, Bruce

closed time in 15 hours

brucetrask

issue commentfacebook/jest

Tesing onBlur attribute in old html file, undefined handler function message

Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

brucetrask

comment created time in 15 hours

issue commentfacebook/jest

jest-worker crashes when library code logs errors

Interesting! If you can put together a non-minimal that would help as well 🙂 Is it a specific site or the Gatsby repo itself? Something I can poke at to reproduce the issue would be great - this is the first I've heard of this issue

KyleAMathews

comment created time in 15 hours

push eventSimenB/jest

Simen Bekkhus

commit sha e648f28aa093cba0e9f7abc708b447f2e3590cce

changelog

view details

push time in 15 hours

PR opened facebook/jest

chore: handle file URLs in dynamic imports

<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. The two fields below are mandatory. -->

<!-- Please remember to update CHANGELOG.md at the root of the project if you have not done so. -->

Summary

Not sure if a startsWith is the best, but it works 🤷

<!-- Explain the motivation for making this change. What existing problem does the pull request solve? -->

Test plan

Test added

<!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI. -->

+12 -1

0 comment

4 changed files

pr created time in 15 hours

create barnchSimenB/jest

branch : handle-dynamic-url-imports

created branch time in 15 hours

issue commentnodejs/node

Segmentation fault with `import()` instead of calling `importModuleDynamically`

  • When the test doesn't crash, it throws that file:///home/nicolo/Documenti/dev/babel/babel/packages/babel-core/test/fixtures/example.mjs doesn't exist even if it does. However, this might be caused by Jest?

Yes, Jest doesn't deal with file URLs, that's a bug that should be simple to fix

nicolo-ribaudo

comment created time in 15 hours

pull request commentfacebook/jest

feat(jest-haste-map): Enable crawling for symlink test files

I think just writing a .watchmanconfig file should work for testing with watchman?

mrmeku

comment created time in 16 hours

push eventfacebook/jest

Gopal Venkatesan

commit sha d554eb1ae9ae7118e2691e1fa43b8e9fc7c37e7d

Add a note to the Exceptions section (#10742)

view details

push time in 19 hours

PR merged facebook/jest

Add a note to the Exceptions section cla signed

It looks like the documentation no longer mentions that the function needs to be wrapped otherwise the assertion will fail.

<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. The two fields below are mandatory. -->

<!-- Please remember to update CHANGELOG.md at the root of the project if you have not done so. -->

Summary

<!-- Explain the motivation for making this change. What existing problem does the pull request solve? -->

Test plan

<!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI. -->

+4 -0

4 comments

2 changed files

g13n

pr closed time in 19 hours

PullRequestReviewEvent

issue commentfastify/fastify

Automatically handle `HEAD` requests in `GET` handler unless explicit `HEAD` handler exists

@MetCoder95 please keep this issue updated with your progress with the plugin 🙂

SimenB

comment created time in 19 hours

push eventUnleash/unleash.github.io

ivarconr

commit sha e61f9ef2e64f974317c0ac7550674673fc79f540

Deploy website Deploy website version based on 3c860d7bcee9dd10f4f3d52b1cfcf1a838aac325

view details

push time in 20 hours

pull request commentfacebook/jest

Add a note to the Exceptions section

Thanks @g13n! Can you update the versioned docs as well? https://github.com/facebook/jest/blob/ec89e858395f24d37ae1ca281e28487d6a4fc894/website/versioned_docs/version-22.x/UsingMatchers.md

g13n

comment created time in 21 hours

issue closednodejs/docker-node

node:lts-slim missing python

We use the node:lts-slim image for months in multiple gitlab pipelines and it worked on 27th October 6PM, that was the last time a successful pipeline ran. The next pipeline on 28th October 11AM was broken and all pipelines afterwards. We triggered the pipeline, which ran successfully on 27th October 6PM, again to verify that the image is broken. The pipeline broke without changing a single line of code.

Verified that behaviour 2 min ago, still broken.

We use the image node:15 right now, that is working as expected as long the node:lts-slim is broken.

gyp ERR! find Python 
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - "python" is not in PATH or produced an error
gyp ERR! find Python checking if "python2" can be used
gyp ERR! find Python - "python2" is not in PATH or produced an error
gyp ERR! find Python checking if "python3" can be used
gyp ERR! find Python - "python3" is not in PATH or produced an error
gyp ERR! find Python 
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
gyp ERR! find Python   (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python 
gyp ERR! configure error 
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack     at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:307:47)
gyp ERR! stack     at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:136:21)
gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:179:16)
gyp ERR! stack     at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:271:16)
gyp ERR! stack     at exithandler (child_process.js:315:5)
gyp ERR! stack     at ChildProcess.errorhandler (child_process.js:327:5)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! stack     at onErrorNT (internal/child_process.js:465:16)
gyp ERR! stack     at processTicksAndRejections (internal/process/task_queues.js:80:21)```

closed time in 21 hours

Cr4mble

issue commentnodejs/docker-node

node:lts-slim missing python

My guess is some module had precompiled binaries for node 12, but does not at this time have that for node 14. So something is building from source instead of just downloading something. As @nschonni says, the slim image haven't been bundling python before, and we're not gonna do so now.

$ docker run node:12-slim sh -c 'python --version'
sh: 1: python: not found
$ docker run node:12 sh -c 'python --version'
Python 2.7.13
$ docker run node:14-slim sh -c 'python --version'
sh: 1: python: not found
$ docker run node:14 sh -c 'python --version'
Python 2.7.13

So this is not a regression in the slim image. @Cr4mble node:lts-slim swapped from v12 to v14 when v14 was made LTS Tuesday this week, which is why you're hitting this now. But it is not a bug, or something we're gonna change, so I'll close this.

Cr4mble

comment created time in 21 hours

pull request commentfacebook/jest

feat(jest-haste-map): Enable crawling for symlink test files

The tests still fail for me

image

I like the setup though, we just need to fix the test when watchman is installed 🙂

mrmeku

comment created time in 21 hours

Pull request review commentfacebook/jest

feat(jest-haste-map): Enable crawling for symlink test files

+/**+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.+ *+ * This source code is licensed under the MIT license found in the+ * LICENSE file in the root directory of this source tree.+ */+import {tmpdir} from 'os';+import * as path from 'path';++import runJest from '../runJest';+import {cleanup, testIfWatchman, writeFiles, writeSymlinks} from '../Utils';++const DIR = path.resolve(tmpdir(), 'crawl-symlinks-test');++beforeEach(() => {+  cleanup(DIR);+});++afterEach(() => {+  cleanup(DIR);+});++function init(+  extraFiles: {+    [filename: string]: string;+  } = {},+) {+  writeFiles(DIR, {+    'package.json': JSON.stringify({+      jest: {+        testMatch: ['<rootDir>/test-files/test.js'],+      },+    }),+    'symlinked-files/test.js': `+            test('1+1', () => {+              expect(1).toBe(1);+            });+          `,+    ...extraFiles,+  });++  writeSymlinks(DIR, {+    'symlinked-files/test.js': 'test-files/test.js',+  });+}++[+  {watchmanFlag: '--no-watchman', runner: test},+  {watchmanFlag: '--watchman', runner: testIfWatchman},+].forEach(({watchmanFlag, runner}) => {+  describe(`crawling symlinks with ${watchmanFlag}`, () => {
describe.each`
  watchmanFlag       | runner
  ${'--no-watchman'} | ${test}
  ${'--watchman'}    | ${testIfWatchman}
`('crawling symlinks with $watchmanFlag', ({watchmanFlag, runner}) => {
mrmeku

comment created time in 21 hours

PullRequestReviewEvent

Pull request review commentbabel/babel

Don't compile `import()` in development

 function loadOptions(opts) {   return babel.loadOptions({ cwd: __dirname, ...opts }); } -function loadOptionsAsync(opts) {-  return babel.loadOptionsAsync({ cwd: __dirname, ...opts });+function loadOptionsAsync({ filename, cwd = __dirname }, mjs) {+  if (mjs) {+    // import() crashes with jest+    return loadOptionsAsyncInSpawedProcess({ filename, cwd });

From debugging - putting a breakpoint on the import() expression shows it is called with an URL with the following href: file:///var/folders/gj/0mygpdfn6598xh34njlyrqzc0000gn/T/babel-test-load-config-async-babel.config.mjsYKe5KD/babel.config.mjs. This file exists in disk and is valid ESM. Then doing "Step over next function call" crashes with a segfault without stopping the debugger

nicolo-ribaudo

comment created time in a day

PullRequestReviewEvent

Pull request review commentbabel/babel

Don't compile `import()` in development

 function loadOptions(opts) {   return babel.loadOptions({ cwd: __dirname, ...opts }); } -function loadOptionsAsync(opts) {-  return babel.loadOptionsAsync({ cwd: __dirname, ...opts });+function loadOptionsAsync({ filename, cwd = __dirname }, mjs) {+  if (mjs) {+    // import() crashes with jest+    return loadOptionsAsyncInSpawedProcess({ filename, cwd });

yeah, this is weird. The importModuleDynamically callback isn't invoked at all - I'm guessing this is some edge case in Node's implementation

nicolo-ribaudo

comment created time in a day

PullRequestReviewEvent

created tagSimenB/babel

tagv7.10.3

Babel is a compiler for writing next generation JavaScript.

created time in a day

push eventSimenB/babel

Nicolò Ribaudo

commit sha eea156b2cb8deecfcf82d52aa1b71ba4995c7d68

Migrate from "master" branch to "main" (#11715) * Remove dead link * Use consistent "homepage" url in package.json * Update md links * Update comment link in parser d.ts * Add comment in gitpod config * Update circleci config * Update PULL_REQUEST_TEMPLATE * Update badges * Trigger CI * Update 404 link

view details

Huáng Jùnliàng

commit sha 7cc8f8db8aeaf9c62d5d60c1d1bab9d94a4b16f7

Revert "chore: pin windows node.js version (#11522)" (#11730)

view details

Huáng Jùnliàng

commit sha 2787ee2f967b6d8e1121fca00a8d578d75449a53

v7.10.3

view details

push time in a day

create barnchSimenB/babel

branch : main

created branch time in a day

issue commentfacebook/jest

babel-jest does not transpile import/export in node_modules when Babel 7 is used

Feel free to send a PR improving the error

dantman

comment created time in a day

issue closedyarnpkg/berry

[Bug] merge conflict resolver removes leading comment in lockfile

  • [ ] I'd be willing to implement a fix

Describe the bug

During a rebase I had a conflict in yarn.lock - I then ran yarn and got

➤ YN0048: Automatically fixed merge conflicts 👍

However, the leading comment in the file was removed

diff --git a/yarn.lock b/yarn.lock
index 73b84ede42..e25f20f54a 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1,6 +1,3 @@
-# This file is generated by running "yarn install" inside your project.
-# Manual changes might be lost - proceed with caution!
-
 __metadata:
   version: 4
   cacheKey: 7

Running yarn again reinstates the comment.

To Reproduce

Have a merge conflict in yarn.lock and run yarn for the automerging.

Screenshots

N/A

Environment if relevant (please complete the following information):

  • OS: macOS
  • Node version 14.15.0
  • Yarn version 2.3.3-git.20201026.e34bf6c6

Additional context

N/A

closed time in a day

SimenB

issue commentyarnpkg/berry

[Bug] merge conflict resolver removes leading comment in lockfile

I'm unable to reproduce now, so I must have quit it early or something... Sorry about the false alarm

SimenB

comment created time in a day

issue commentyarnpkg/berry

[Bug] merge conflict resolver removes leading comment in lockfile

No, I let it run to completion. I've deleted the branches, but I can attempt to restore them

SimenB

comment created time in a day

issue commentfacebook/jest

expect.objectContaining(...) mutates properties of the argument

Hoping to have a fix for #10690 this weekend, but if not I'll cut a release without it

floyd-may

comment created time in a day

issue commentfacebook/jest

Code Coverage report stating last closing brace as uncovered

This is an issue either with the transformer not providing correct source maps or with istanbul.

At the very least we'll need a full minimal reproduction we can pull down to run and test. Regardless I highly doubt it's a bug in Jest itself, but I've been surprised before 🙂

VIMGAS

comment created time in a day

issue commentfacebook/jest

CONTRIBUTING mentions `yarn link`, which doesn't even exist anymore

yarn link sorta painful though as the yarn version is checked into this repo, so you need to launch the yarn from here but in the other CWD. Ditching the link instructions altogether seems easier?

FauxFaux

comment created time in a day

issue commentfacebook/jest

jest-worker crashes when library code logs errors

Even without ignoring anything internal or not, we should not crash while we're still running I think. Can you put together a reproduction?

KyleAMathews

comment created time in a day

pull request commentfacebook/jest

feat: add support for dynamic imports in CJS

Should this work on Node.js 14.15.0 with Jest?

Definitely, as can be seen from the test here, this runs successfully on node@^12.16.0 || >=13.7.0

EDIT: It's a segmentation fault (core dumped), I'll try creating a smaller example and open a new issue.

That doesn't sound good 🙈 Ping me when/if you're able to put together a repository. If it's in Babel I'm happy to take a look at some branch

SimenB

comment created time in a day

PullRequestReviewEvent

push eventSimenB/jest

Simen Bekkhus

commit sha 93f48fe1c975daf7364ead942c54d3b8b19a9f74

chore: delete `eslint-config-fb-strict` package from repo (#10739)

view details

Simen Bekkhus

commit sha ec89e858395f24d37ae1ca281e28487d6a4fc894

chore: bump `@babel/core` types (#10388)

view details

push time in a day

delete branch SimenB/jest

delete branch : babel-types

delete time in a day

more