Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 21 20:55
    chasenlehara commented #1510
  • Oct 21 20:07
    matthewp commented #1510
  • Oct 21 20:06

    matthewp on master

    2.2.4 (compare)

  • Oct 21 20:06

    matthewp on v2.2.4

    (compare)

  • Oct 21 18:35

    greenkeeper[bot] on glob-7.1.5

    chore(package): update glob to … (compare)

  • Oct 21 18:10

    matthewp on comment-es

    (compare)

  • Oct 21 18:10

    matthewp on master

    ES module detection, remove str… Merge pull request #1511 from s… (compare)

  • Oct 21 18:10
    matthewp closed #1511
  • Oct 21 18:10
    matthewp closed #1510
  • Oct 21 17:44
    matthewp opened #1511
  • Oct 21 17:44

    matthewp on comment-es

    ES module detection, remove str… (compare)

  • Oct 21 17:41
    matthewp commented #1510
  • Oct 21 17:30
    chasenlehara commented #1510
  • Oct 21 17:11
    matthewp commented #1510
  • Oct 21 15:03
    matthewp commented #1510
  • Oct 21 12:27
    matthewp assigned #1510
  • Oct 21 12:25
    matthewp commented #1510
  • Oct 21 12:12
    chasenlehara labeled #1510
  • Oct 21 12:12
    chasenlehara opened #1510
  • Oct 21 12:12
    chasenlehara labeled #1510
Sunil George
@georgesunil81
And here is my karma.bootstrap.js
window.__karma__.loaded = function() {
  var s = document.createElement('script');
  s.setAttribute('src', 'base/node_modules/steal/steal.js');
  s.setAttribute('data-main', 'test/');
  document.head.appendChild(s);

  s.onload = function () {
    steal.done().then(function(){
        console.log('----- StealJS is loaded -----');
      if(window.__karma__) {
        window.__karma__.start();
      }
    });
  };
};
The errors are coming from karma.bootstrap.js. It is not able to find stealconfig.js and dev.js.
Kevin Phillips
@phillipskevin
you probably need a pattern for your stealconfig
Sunil George
@georgesunil81
But, I already have the following pattern in the karma.conf.js
{ pattern: 'node_modules/steal/**/*.js', included: false },
Would it not include stealconfig.js and dev.js too?
Kevin Phillips
@phillipskevin
where is stealconfig?
Sunil George
@georgesunil81
stealconfig is in "node_modules/steal" directory.
Kevin Phillips
@phillipskevin
also, why do you need to use document.head.appendChild to inject steal?
isn’t karma doing that already?
Sunil George
@georgesunil81
Oh! Earlier I did not have the following line in my karma.config.js
Kevin Phillips
@phillipskevin
try setting it up how it is in the forum post
Sunil George
@georgesunil81
'node_modules/steal/steal.js',
Sure, I will try that now.
Made the changes. Now running it again...
Hmmm @phillipskevin . Making it mirror what you have in the forum resolved the 404/stealconfig.js and 404/dev.js errors.
I am getting bunch of different errors now.
Thanks @phillipskevin for your help resolving the 404s. I will troubleshoot the new errors further. Will let you know if I need help.
Sunil George
@georgesunil81
Thanks @phillipskevin . It now executed a very simple test as below which I added within my CanJS-StealJS application project directory structure -
```
describe('Sample Test', function () {
  it('test', function () {
    expect(true).toBeTruthy();
  });
});
Now, I will be going into testing the actual application logic. Since StealJS is now succesfully loaded, I believe I should be able to just import my app modules into my tests and run specific functions from in there.
Will try it out.
Sunil George
@georgesunil81
@phillipskevin , are there any examples of testing CanJS Controllers with Karma-Jasmine. My application pages are rendered using Can.Control.
Sunil George
@georgesunil81
From my unit tests, I am trying to invoke specific functions from within my controller.
If you have any examples of it or have a link to, let me know once you get a chance. Thanks in advance for all your help.
Kevin Phillips
@phillipskevin
I’m not sure what you mean
I don’t think there is anything Karma or Jasmine specific about it
probably need some more info on what you’re trying to test, but basically you just need to create an instance of the Control and call the function
var c = new MyControl(el, data);
c.myFunction();
expect(data.whatever).toBe(something);
obviously that assertion totally depends on what it is you’re trying to test
Sunil George
@georgesunil81
Thanks @phillipskevin . That gives me a good hint on how to proceed. What will be el? I suppose it will be the DOM element that the application controller would render into. I think I will need to use jasmine-fixture to add the element in memory/DOM first and then instantiate the controller in my test on that element.
Kevin Phillips
@phillipskevin
if you’re not going to check what is happening in the dom it can be anything
document.createElement(‘div’);
or even if you are
Sunil George
@georgesunil81
Hmmm...yes, thats true. Thanks @phillipskevin . This gives me enough directions for the day. I will let you know if I run into any issues.
Thanks again for all your help.
Kevin Phillips
@phillipskevin
:thumbsup:
Matthew Phillips
@matthewp
Kevin Phillips
@phillipskevin
@matthewp should it be
"steal": {
  "plugins": [
instead of "system"
xedos
@xedoken

Hi guys! Does anyone know what the issue is with can-route in donejs:

Cannot define property:page, object is not extensible ( in can-define).

"can-define": "^1.0.4",
"can-route": "^3.0.5",
"can-route-pushstate": "^3.0.1",
"steal": "^0.16.43",
"steal-tools": "^0.16.8"

Matthew Phillips
@matthewp
sounds like a canjs issue. That problem is caused by not defining a property, most likely your main ViewModel needs a page: "string" to be defined on it.
xedos
@xedoken
Yeap, already fixed. B/c new can3 need the page property in app.js :)
Paul Tichonczuk
@tracer99
So In my main app, I have node-modules loading from just the name (like in DoneJS). So I can import moment and it will find it in node-modules/moment
However, in my unit tests, this doesn't work. Doesn't steal look into package.json in the root of the project like it does for the main app? Do I have to specify it somehow?
Kevin Phillips
@phillipskevin
how are you loading steal in your unit tests?
if you’re loading steal from node_modules, then it should read the package.json
Paul Tichonczuk
@tracer99
<script src="../../../node_modules/steal/steal.js" main="ucp2/dashboard/pin/pin_test" data-mocha="bdd"></script>
Kevin Phillips
@phillipskevin
what happens when you try to import moment in your tests?