CodeceptJS
CodeceptJS copied to clipboard
Problems when using npm config
What are you trying to achieve?
Get configurations from config file while using npm config. My default file contains: { "whoAmI": "default", "url": "https://localhost" }
What do you get instead?
Browser opens Does not fetch URL display the correct config.get on WhoAmI no clue on why it is not working. I use similar setups on different projects and it works fine.
Provide console output if related. Use
--verbosemode for more details.
Action Plan --
Create Tasks
default
I am on page "/"
<--- Last few GCs --->
0.[23069:0x104796000] 54038 ms: Mark-sweep (reduce) 4096.1 (4105.0) -> 4096.0 (4105.7) MB, 6320.2 / 0.0 ms (+ 0.0 ms in 16 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 6323 ms) (average mu = 0.113, current mu = 0.00[23069:0x104796000] 59541 ms: Mark-sweep (reduce) 4096.7 (4102.7) -> 4096.6 (4104.5) MB, 5465.9 / 0.0 ms (+ 34.3 ms in 9 steps since start of marking, biggest step 12.2 ms, walltime since start of marking 5502 ms) (average mu = 0.059, current mu = 0.0
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0x1012ac995 node::Abort() (.cold.1) [/usr/local/bin/node]
2: 0x1000a4379 node::Abort() [/usr/local/bin/node]
3: 0x1000a44df node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
4: 0x1001e58e7 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
5: 0x1001e5883 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
6: 0x1003817d5 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/bin/node]
7: 0x10038327a v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/usr/local/bin/node]
8: 0x10037e9a5 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/bin/node]
9: 0x10037c2d0 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
10: 0x10037b238 v8::internal::Heap::HandleGCRequest() [/usr/local/bin/node]
11: 0x100337911 v8::internal::StackGuard::HandleInterrupts() [/usr/local/bin/node]
12: 0x1006d5fd9 v8::internal::Runtime_StackGuard(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
13: 0x100a47299 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/usr/local/bin/node]
zsh: abort npm run codeceptjs --steps
Provide test source code if related
const { pause } = require("codeceptjs");
const config = require('config');
Feature('Action Plan');
Scenario('Create Tasks', async ({ I }) => {
console.log(config.get(`whoAmI`));
I.amOnPage(`/`)
I.wait(1);
});```
### Details
* CodeceptJS version:3.3.4
* NodeJS Version:v14.7.0
* Operating System:MacOS Monterey 12.5.1
* puppeteer || webdriverio || testcafe version (if related)
* Configuration file:
```js
const config = require('config');
exports.config = {
tests: './*_test.js',
output: './output',
helpers: {
Playwright: {
url: config.get('url'),
show: true,
browser: 'chromium'
}
},
include: {
I: './steps_file.js'
},
bootstrap: null,
mocha: {},
name: 'testAutomation'
}
Cannot reproduce, tested with Ubuntu 22.04 (x86_64), NodeJS 14.20, CodeceptJS 3.3.5, [email protected] (with default.json with your data), I used your test and the CodeceptJS config.
I run the test using codeceptjs run --steps
Maybe a "MacOS + NodeJS" specific issue?
Just in case, you can run npx codeceptjs info to gather the information.
Sorry, i didn't get what is a default file and why do you prefer to use npm config instead of codeceptjs conf
It was a problem that was related to a JSON file loaded in order to create additional data within the test. Sorry for the confusion guys.