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: "jQuery is not defined" #49

Open
BorderCloud opened this issue Jun 9, 2020 · 3 comments
Open

Error: "jQuery is not defined" #49

BorderCloud opened this issue Jun 9, 2020 · 3 comments

Comments

@BorderCloud
Copy link

BorderCloud commented Jun 9, 2020

In the project sgvizler2, I try to use TestyTs but my project use also JQuery.

I have the error:

ERROR An error occured while executing the following command: /usr/bin/node /home/karima/git/sgvizler2/node_modules/.bin/testyts. Error: "jQuery is not defined"

You can reproduce the error:

  1. clone https://github.com/BorderCloud/sgvizler2.git
  2. remove the comments in the test "doParseOptionsRawWithoutOption" (file Chart.spec.ts)
  3. testyts

May be, I forgot an option in testy.json ?

@Aboisier
Copy link
Collaborator

Thanks for reporting this, I'll take a look at it as soon as possible! :)

@Aboisier
Copy link
Collaborator

Aboisier commented Apr 20, 2021

Hi @BorderCloud ! Thanks for your patience. I believe your issue could be solved by importing and defining jQuery in a test setup (new feature available in v1.3.0).

From the readme:

If you need to setup global stuff, you may do so by specifying a setup file in your testy.json.

testy.json

{
  "setupFile": "test-setup.ts"
}

test-setup.ts

// Import modules here, setup global variables, the whole nine yards
global['foo'] = 'I can be used in test 😎';

Let ,me know if this works for you,
Cheers!

@BorderCloud
Copy link
Author

With your example, I have the error : "error Command failed with exit code 1."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants