[Pkg-javascript-devel] Bug#940704: first try with node-jest 24.9.0

Paolo Greppi paolo.greppi at libpf.com
Tue May 12 05:30:16 BST 2020


With node-jest now in the NEW queue, I have started working on this here:

  https://salsa.debian.org/js-team/node-yarnpkg/-/tree/jest

I have built jest from https://salsa.debian.org/js-team/node-jest assuming commit b9255f45c22c030b863e7d42aaf78c207db43478 will be tagged as 24.9.0+ds-2 (although that is not in NEW queue):

  git checkout b9255f45c22c030b863e7d42aaf78c207db43478
  git switch -c debian/24.9.0+ds-2
  gbp buildpackage -uc -us --git-ignore-branch

I need to side-load these packages to /usr/share/nodejs to make jest start:

  import-local realpath-native jest-snapshot-serializer-raw sane react-is natural-compare p-each-series throat

Now the test suite starts, and all 91 tests fail. I need to also side-load:

  string-length fast-json-stable-stringify source-map-support

not sure if these are jest run-time dependencies or yarnpkg test-time dependencies.

Now all the tests fail because:

  Cannot find module 'source-map-support' from 'source-map-support.js'

To fix this, I upgrade source-map-support to 0.5.19; now I get:

  Cannot find module 'chalk' from 'Env.js'

this comes from /usr/share/nodejs/jest-jasmine2/build/jasmine/Env.js which is compiled from node-jest/packages/jest-jasmine2/src/jasmine/Env.ts.
But node-chalk is installed:

  nodejs
  > chalk = require('chalk');
  { [Chalk]
    constructor: [Function: Chalk],
    supportsColor: { level: 2, hasBasic: true, has256: true, has16m: false },
    default: [Circular] }
  > ^d

Clearly the jest command is broken.
I suggest to enable the jest self-test suite in node-jest.

I tried running "jest" in node-jest source tree (after side-loading the 8 packages above), I get:

● Validation Error:

  Test environment ./packages/jest-environment-node cannot be found. Make sure the testEnvironment configuration option points to an existing node module.

  Configuration Documentation:
  https://jestjs.io/docs/configuration.html

Although ./packages/jest-environment-node exists (?)

I tried to specify the testEnvironment from the command line:

  jest --env=node

and with that I get:

● Validation Error:

  Module <rootDir>/packages/pretty-format/build/plugins/ConvertAnsi.js in the snapshotSerializers option was not found.
         <rootDir> is: /root/node-jest

  Configuration Documentation:
  https://jestjs.io/docs/configuration.html

Also note that the command:

  jest --init

requires side-loading prompts module.

For my own record, I reset all the changes to my test machine with:

  apt remove jest
  apt autoremove
  cd /usr/share/nodejs
  rm import-local realpath-native jest-snapshot-serializer-raw sane react-is natural-compare p-each-series throat string-length fast-json-stable-stringify source-map-support prompts
  mv source-map-support.old/ source-map-support

Paolo



More information about the Pkg-javascript-devel mailing list