По команде npm запустить тест У меня проблема ниже:
{
"message": "Uncaught TypeError: Cannot read property 'amd' of undefined\nat test/ExpectedPd/test.js:168735:14\n\nTypeError: Cannot read property 'amd' of undefined\n at Object.<anonymous> (test/ExpectedPd/test.js:168735:14)\n at Object.<anonymous> (test/ExpectedPd/test.js:168858:30)\n at __webpack_require__ (test/ExpectedPd/test.js:20:30)\n at Object.<anonymous> (test/ExpectedPd/test.js:104582:88)\n at Object.<anonymous> (test/ExpectedPd/test.js:105683:30)\n at __webpack_require__ (test/ExpectedPd/test.js:20:30)\n at Object.<anonymous> (test/ExpectedPd/test.js:80516:79)\n at Object.<anonymous> (test/ExpectedPd/test.js:81379:30)\n at __webpack_require__ (test/ExpectedPd/test.js:20:30)\n at Object.<anonymous> (test/ExpectedPd/test.js:168440:81)",
"str": "Uncaught TypeError: Cannot read property 'amd' of undefined\nat test/ExpectedPd/test.js:168735:14\n\nTypeError: Cannot read property 'amd' of undefined\n at Object.<anonymous> (test/ExpectedPd/test.js:168735:14)\n at Object.<anonymous> (test/ExpectedPd/test.js:168858:30)\n at __webpack_require__ (test/ExpectedPd/test.js:20:30)\n at Object.<anonymous> (test/ExpectedPd/test.js:104582:88)\n at Object.<anonymous> (test/ExpectedPd/test.js:105683:30)\n at __webpack_require__ (test/ExpectedPd/test.js:20:30)\n at Object.<anonymous> (test/ExpectedPd/test.js:80516:79)\n at Object.<anonymous> (test/ExpectedPd/test.js:81379:30)\n at __webpack_require__ (test/ExpectedPd/test.js:20:30)\n at Object.<anonymous> (test/ExpectedPd/test.js:168440:81)"
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! XXXXXXXXXX@1.0.0 test: `node ./node_modules/karma/bin/karma start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the XXXXXXXXXX@1.0.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\mitesh_jain.CIQDEV\AppData\Roaming\npm-cache\_logs\2020-07-14T10_39_45_827Z-debug.log
Мой код конфигурации кармы:
var webpackConfig = require('./webpack-test.config.js');
var testoutputFolder = 'test/testOutput/';
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['mocha'],
reporters: ['progress', 'coverage', 'junit', 'threshold'],
coverageReporter: {
reporters: [
{ type: "html", subdir: "html" },
{ type: 'cobertura', subdir: "cobertura" }
],
dir : testoutputFolder + 'coverage/'
},
junitReporter: {
outputDir: testoutputFolder + 'junit',
useBrowserName: true
},
thresholdReporter: {
statements: 5,
branches: 5,
functions: 5,
lines: 5
},
files: [
'test/**/*.js',
'./ExpectedPDResources/main.js'
],
exclude: [
'test/testOutput/**/*.js'
],
webpack: webpackConfig,
preprocessors: {
'test/**/*.js':['webpack'],
'test/*.js':['webpack'],
'./ExpectedPDResources/main.js': ['webpack'],
'./ScoringUI/*.js': ['webpack']
},
port: 9876,
colors: true,
autoWatch: false,
browsers: ['ChromeHeadless'], //Removing the phantomJS as it is disconnecting from VSTS pipleine
singleRun: true,
concurrency: Infinity
})
}
Я обнаружил, что ошибка связана с тем, что я звоню 1 функция от main.tsx до js
Путь к main.tsx: ca-frontend \ PdfViewer \ settings \ main.tsx (getLastSelection) Я также установил функцию getLastSelection как экспорт
Путь к js выглядит как ca-frontend \ MSPDResources2 \ main. js (импорт SettingsPanel из '../PdfViewer/settings/main.tsx';)
Кто-нибудь может помочь?