Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: TypeScript compilation failed. /tests/commonFunctions.ts (2, 26): Cannot find module 'process'. /tests/commonFunctions.ts (4, 14): Cannot find name 'require' #4437

Closed
Muthuvenaktesh opened this issue Nov 1, 2019 · 5 comments · Fixed by #4438
Assignees
Labels
FREQUENCY: level 2 STATE: Auto-locked An issue has been automatically locked by the Lock bot. TYPE: bug The described behavior is considered as wrong (bug).
Milestone

Comments

@Muthuvenaktesh
Copy link

Muthuvenaktesh commented Nov 1, 2019

Are you requesting a feature or reporting a bug?

What is your Test Scenario?

  • Simple test to open webpage and login

  • The IP where the page is located should be provided through environment variables.which retrived in the script using "process" and "require".

  • The tests should run inside a Docker container

  • The tests are written with typescript

What is the Current behavior?

ERROR Cannot prepare tests due to an error.

Error: TypeScript compilation failed.
/tests/commonFunctions.ts (2, 26): Cannot find module 'process'.
/tests/commonFunctions.ts (4, 14): Cannot find name 'require'. Do you need to install type definitions for node? Try npm i @types/node.
/tests/commonFunctions.ts (91, 22): Cannot find name 'require'. Do you need to install type definitions for node? Try npm i @types/node.
/tests/login.ts (3, 14): Cannot find name 'require'. Do you need to install type definitions for node? Try npm i @types/node.
/tests/test.ts (6, 17): Cannot find name 'process'. Do you need to install type definitions for node? Try npm i @types/node.

What is the Expected behavior?

Typescript should execute,
The same script was running fine with testcafe@1.4.3 docker image

How would you reproduce the current behavior (if this is a bug)?

Create a simple test that uses environment variables and is written in typescript
Run: docker run -v /home/.../src/main/client/:/tests -it testcafe/testcafe firefox /tests/**/*testcafe.ts
See the error...

Provide the test code and the tested page URL (if applicable)

import { Selector } from "testcafe";
var config = require('./loginDetails.json');

fixture("Getting Started");

test('test', async t => {
console.log(${process.env.HOSTNAME});
});

loginDetails.json file:

{
"URL": {
"qaUrl": "http://127.0.0.1:3001"
}
}
Your website URL (or attach your complete example):

Your complete test code (or attach your test files)

import { Selector } from "testcafe";
var config = require('./loginDetails.json');

fixture("Getting Started");

test('test', async t => {
console.log(${process.env.HOSTNAME});
});

### Your Environment details:
 
* testcafe version:                   1.6.0
* node.js version:                    10.14.1
* platform and version:        docker testcafe/testcafe@latest ("Created": "2019-10-16T15:40:26.058658176Z",)

Related to :  #3477 
@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Nov 1, 2019
@miherlosev miherlosev self-assigned this Nov 1, 2019
@miherlosev
Copy link
Collaborator

#3477

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Nov 1, 2019
@miherlosev
Copy link
Collaborator

Hi @Muthuvenaktesh

Thank you for the provided information. I've reproduced the problem.

@Muthuvenaktesh
Copy link
Author

Still getting the above isuue with latest docker image (ID: 3ee5563f19df)

Error: TypeScript compilation failed.
/tests/commonFunctions.ts (3, 14): Cannot find name 'require'. Do you need to install type definitions for node? Try npm i @types/node.
/tests/commonFunctions.ts (53, 25): Cannot find name 'process'. Do you need to install type definitions for node? Try npm i @types/node.

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Nov 6, 2019
@AndreyBelym
Copy link
Contributor

The fix for this issue is not included in v1.6.1. It will we available in the next release, which will be versioned v1.7.0.

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Nov 7, 2019
@lock
Copy link

lock bot commented Nov 17, 2019

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow.

@lock lock bot added the STATE: Auto-locked An issue has been automatically locked by the Lock bot. label Nov 17, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Nov 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FREQUENCY: level 2 STATE: Auto-locked An issue has been automatically locked by the Lock bot. TYPE: bug The described behavior is considered as wrong (bug).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants