Process not defined when parsing threshold config
See original GitHub issueDescribe a bug
My jest.config.js
looks like this:
const { pathsToModuleNameMapper } = require('ts-jest/utils');
const { compilerOptions } = require('./tsconfig');
require('jest-preset-angular/ngcc-jest-processor');
// Deliberately set to not UTC.
process.env.TZ = 'Europe/Kiev';
module.exports = {
preset: 'jest-preset-angular',
...
};
When I add jest-coverage-report-action
to my workflow, I get
Warning: Failed to parse jest configuration. "coverageThreshold" from config file will be ignored. evalmachine.<anonymous>:7
process.env.TZ = 'Europe/Kiev';
^
ReferenceError: process is not defined
at evalmachine.<anonymous>:7:1
at Script.runInContext (node:vm:139:12)
at evaluateCjsModule (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2/dist/index.js:23:5853)
even though I am setting up node prior to this:
- uses: actions/setup-node@v2
with:
node-version: '16'
cache: 'yarn'
and I don’t get this error in my previous test setup, so the issue is specific to parsing jest config by report action.
Details
https://github.com/truenas/webui/pull/6505 https://github.com/truenas/webui/runs/5512126744?check_suite_focus=true
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
ReferenceError: process is not defined - Stack Overflow
I got xk6-dotenv working only by building a custom k6 binary... Is building a custom k6 binary the only way to utilize the...
Read more >Parse and validate thresholds before starting the execution
Problem statement We would like to parse and validate threshold expressions at the end of the init context's evaluation, in order to have ......
Read more >Process | Node.js v19.3.0 Documentation
The message goes through serialization and parsing. The resulting message might not be the same as what is originally sent. If the serialization...
Read more >Resolve validation errors - Azure DevOps Services
Missing closing tags, missing quotes, missing open or close brackets (< or >) can cause a parsing file error. From the error message,...
Read more >Gst-nvinfer — DeepStream 6.1.1 Release documentation
Property Meaning Network Types. / Applic...
num‑detected‑classes Number of classes detected by the network Detector. Both
tensor‑meta‑pool‑size Size of the output tensor meta pool All....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @therynamo 👋,
The cfgn is a small abstraction over configuration parsing. It resolves
.js
,.mjs
,.cjs
,.ts
and.json
configurations - all of these extensions should be supported by this action, because jest supports them (link).require.actual
will not evaluate configuration correctly, for several reasons:commonjs
format, to support older node versions. Thees module
could not be “required” from commonjs -import
should be used instead.json
files from es modules in node, it is still experimental. This means that if this action will be moved to es-modules, this might cause some issues.Plus, all logic with resolving these configurations and other stuff. So, I decided to put all this logic in a separate package to make it easier to maintain.
Also, I can’t use the
jest-config
package because it couldn’t be bundled. This means, that withjest-config
package, action would need to run separate installation step before each run, what will decrease performance.I agree that cfgn should inject node globals, and that the current behavior is a bug. I don’t have much time to maintain this action, but I will try to fix this issue as soon as possible.
Hello @undsoft 👋,
To parse jest configuration, action evaluates your configuration in environment, with no node globals. You can easily avoid this issue by simply importing “process” module: