Running specs in Smart UI

Hello Smart Viewers, I just went through grunt, jasmine, karma and other usefull tools. I think that I basically understood the principles how to write test, how to automate etc.

So I wanted to write my own one but at first I wanted to run some of the specs that are already prepared.

I use version 22.1

The question is - HOW CAN I RUN THEM?

Let´s pick up very simple test for dialog.view - lib\src\smart\controls\dialog\test\dialog.spec.js

define(
    [
        "smart/controls/dialog/dialog.view",
    ],
    function(DialogView) {
        describe("Dialog Control", function() {
            it("tests", function() {
                dump("Ahoj");
                var f = new DialogView();
                expect(f).toBeDefined();
            });
        });
    }
);

in order to make it super easy I just add => a patter to karma.debug.js in $project/test folder

files: [         
    //some other code   
            {pattern: "src/**/*.js", included: false, nocache: true},
            {pattern: "src/**/*.json", included: false, nocache: true},
            {pattern: "src/**/*.hbs", included: false, nocache: true},
            {pattern: "src/**/*.css", included: false, nocache: true},
            {pattern: "lib/src/nuc/**/!(*.spec.js)", included: false, nocache: true},
            {pattern: "lib/src/csui/**/!(*.spec.js)", included: false, nocache: true},
    =>      {pattern: "lib/src/smart/controls/dialog/*.js", included: false},
    =>      {pattern: "lib/src/smart/controls/dialog/test/**/*spec.js", included: false},
]

after launching

npx grunt test

this appeared in the terminal, it means that everything seems to be fine until dialog.view.js depedencies should load. During the loading process it seems that keywords used in define of the module cannot be correctly translated

Terminal window

 START:
20 05 2022 13:00:55.941:INFO [karma-server]: Karma v6.3.17 server started at http://localhost:9876/
20 05 2022 13:00:55.947:INFO [launcher]: Launching browsers ChromeHeadless with concurrency unlimited
20 05 2022 13:00:55.993:INFO [launcher]: Starting browser ChromeHeadless
20 05 2022 13:00:56.796:INFO [Chrome Headless 101.0.4951.54 (Windows 10)]: Connected on socket 3JA60VHggbtxChtqAAAB with id 82408273
20 05 2022 13:00:57.159:WARN [web-server]: 404: /base/lib/src/smart/mixins/layoutview.events.propagation/layoutview.events.propagation.mixin.js
20 05 2022 13:00:57.219:WARN [web-server]: 404: /base/lib/src/smart/utils/non-emptying.region/non-emptying.region.js
20 05 2022 13:00:57.233:WARN [web-server]: 404: /base/lib/src/smart/lib/binf/js/binf.js
20 05 2022 13:00:57.368:WARN [web-server]: 404: /base/lib/src/smart/controls/dialog/impl/dialog.css?
20 05 2022 13:00:57.398:WARN [web-server]: 404: /base/lib/src/smart/controls/dialog/impl/nls/lang.js
20 05 2022 13:00:57.512:WARN [web-server]: 404: /base/lib/src/smart/controls/dialog/impl/dialog.hbs?
20 05 2022 13:00:57.514:WARN [web-server]: 404: /base/lib/src/smart/controls/dialog/impl/dialog.header.hbs?
20 05 2022 13:01:56.808:WARN [Chrome Headless 101.0.4951.54 (Windows 10)]: Disconnected (0 times) , because no message in 60000 ms.

Dialog.view.js module

 define(['module', 
  'nuc/lib/underscore', 
  'nuc/lib/jquery',
  'nuc/lib/backbone', 
  'nuc/lib/marionette',
  'smart/mixins/layoutview.events.propagation/layoutview.events.propagation.mixin',
  'smart/controls/dialog/footer.view',
  'smart/controls/dialog/header.view',
  'hbs!smart/controls/dialog/impl/dialog',
  'i18n!smart/controls/dialog/impl/nls/lang',
  'smart/utils/non-emptying.region/non-emptying.region',
  'nuc/utils/log',
  'i18n',
  'css!smart/controls/dialog/impl/dialog',
  'smart/lib/binf/js/binf'
], function (module, _, $, Backbone, Marionette,
    LayoutViewEventsPropagationMixin,
    DialogFooterView, DialogHeaderView, dialogTemplate, lang,
     NonEmptyingRegion, 
    log,
    i18n) {


  log = log(module.id);


  var DialogView = Marionette.LayoutView.extend({...

There must be something with requiring the module, unfortunately I cannot figure what. So if there is a good sould in our community, please, can you just simply clarify what is happening and how can I solve it :)

Tagged: