TestyTs icon indicating copy to clipboard operation
TestyTs copied to clipboard

Error: "jQuery is not defined"

Open BorderCloud opened this issue 4 years ago • 3 comments

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 ?

BorderCloud avatar Jun 09 '20 10:06 BorderCloud

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

Aboisier avatar Jun 10 '20 02:06 Aboisier

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!

Aboisier avatar Apr 20 '21 02:04 Aboisier

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

BorderCloud avatar Apr 30 '21 07:04 BorderCloud