tabulator (^5.2.2)我正在尝试为使用using的 javascript 项目编写测试jest (v27)。制表符正在 JS 文件中导入和使用,如下所示
import {TabulatorFull as Tabulator} from "tabulator-tables";\n...\nvar table = new Tabulator("#example-table", config)\n...\nRun Code Online (Sandbox Code Playgroud)\n当我使用 webpack 运行项目并在浏览器中加载时,一切正常,但是当我尝试在玩笑中运行同一文件的测试时,出现此错误
\n FAIL tests/integration/__tests__/tabulator.js\n \xe2\x97\x8f Test suite failed to run\n\n TypeError: _tabulatorTables.TabulatorFull is not a constructor\n\n 15 |\n 16 |\n > 17 | var table = new Tabulator("#example-table", {\n | ^\n 18 | data:tabledata, //load row data from array\n 19 | layout:"fitColumns", //fit columns to width of table\n 20 | responsiveLayout:"hide", //hide columns that dont …Run Code Online (Sandbox Code Playgroud) 我无法使用@testing-library/vuejest在我的 vue3 项目中运行简单的测试和jest-environment-jsdom. 当我运行时npm run test出现以下错误
> vue-testing-library-test@0.0.0 test\n > jest\n\n FAIL src/__tests__/HelloWorld.test.js\n \xe2\x97\x8f Test suite failed to run\n\n ReferenceError: Vue is not defined\n\n 1 | // import library of unit testing library\n > 2 | import { render } from "@testing-library/vue";\n | ^\n 3 | import HelloWorld from "../components/HelloWorld.vue";\n 4 |\n 5 | // The case of unit testing for check render msg\n\n at Object.<anonymous> (node_modules/@vue/test-utils/dist/vue-test-utils.browser.js:8318:8)\n at Object.<anonymous> (node_modules/@testing-library/vue/dist/render.js:9:18)\n at …Run Code Online (Sandbox Code Playgroud)