microsoft / PowerBI-visuals-sampleBarChart-react

power bi sample bar chart custom visual based on reactJS
MIT License
15 stars 15 forks source link

Unable to run tests #17

Open zafaralam opened 3 years ago

zafaralam commented 3 years ago

Hi Team,

I was trying to use this repository to create tests in my own custom visual that uses react. I tried to running the test command within this repo and it failed with the following error.

Can someone please assist?

 FAIL  tests/Visual.test.tsx
  ● Test suite failed to run

    <local project path>\PowerBI-visuals-sampleBarChart-react\node_modules\powerbi-visuals-utils-colorutils\lib\index.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import { ColorHelper } from "./colorHelper";
                                                                                             ^^^^^^

    SyntaxError: Cannot use import statement outside a module

      47 | import VisualObjectInstanceEnumerationObject = powerbi.VisualObjectInstanceEnumerationObject;
      48 |
    > 49 | import { ColorHelper } from "powerbi-visuals-utils-colorutils";
         | ^
      50 |
      51 | import { VisualState, DataEntry } from "./dataInterfaces";
      52 | import { LEGEND_HEIGHT } from "./constants";

      at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:471:17)
      at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:513:25)
      at Object.<anonymous> (src/visual.tsx:49:1)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        181.102s
Ran all test suites.
helen508light commented 3 years ago

@blackleaden please ask about current status