Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subsequent tasks in multi task don't run their specs #299

Open
TristanNovo opened this issue Feb 16, 2019 · 8 comments
Open

subsequent tasks in multi task don't run their specs #299

TristanNovo opened this issue Feb 16, 2019 · 8 comments

Comments

@TristanNovo
Copy link
Contributor

I'm working on updating less.js to use 2.0.3 and have discovered some strange behavior. This happens in 2.0.2 and 2.0.3 but not 2.0.1

When calling a multi task, only the first task will actually run it's specs, and then it will either hang or continue to run the other tasks without actually running any specs.
I've written a small test case that shows the case when it doesn't run subsequent specs.

package.json

{
...
  "devDependencies": {
    "grunt-contrib-jasmine": "^2.0.3",
    "grunt": "^1.0.3"
  }
}

Gruntfile.js

'use strict';

module.exports = function (grunt) {
    grunt.loadNpmTasks('grunt-contrib-jasmine');
    grunt.initConfig({
        jasmine: {
            options: {
                keepRunner: true
            },
            main: {
                options: {
                    specs: 'test.js',
                }
            },
            second: {
                options: {
                    specs: 'test_2.js',
                }
            },
        },
    });
    grunt.registerTask('default', ['jasmine']);
};

test.js

describe('test', function() {
    it('equal test', function() {
        expect(1).toEqual(1);
    });
});

test_2.js (with failing spec)

describe('test', function() {
    it('equal test', function() {
        expect(1).toEqual(2);
    });
});

running grunt --verbose produces this output

Initializing
Command-line options: --verbose

Reading "Gruntfile.js" Gruntfile...OK

Registering Gruntfile tasks.

Registering "grunt-contrib-jasmine" local Npm module tasks.
Reading C:\_test\less_tests\node_modules\grunt-contrib-jasmine\package.json...OK
Parsing C:\_test\less_tests\node_modules\grunt-contrib-jasmine\package.json...OK
Loading "jasmine.js" tasks...OK
+ jasmine
Initializing config...OK
Loading "Gruntfile.js" tasks...OK
+ default

No tasks specified, running default tasks.
Running tasks: default

Running "default" task

Running "jasmine" task

Running "jasmine:main" (jasmine) task
Verifying property jasmine.main exists in config...OK
File: [no files]
Options: version="latest", timeout=10000, styles=[], specs="test.js", helpers=[], vendor=[], polyfills=[], customBootFile=null, tempDir=".grunt/grunt-contrib-jasmine", outfile="_SpecRunner.html", host="", template="C:\\_test\\less_tests\\node_modules\\grunt-contrib-jasmine\\tasks\\jasmine\\templates\\DefaultRunner.tmpl", templateOptions={}, junit={}, ignoreEmpty=false, display="full", summary=false, keepRunner
Reading C:\_test\less_tests\node_modules\grunt-contrib-jasmine\tasks\jasmine\reporters\PuppeteerReporter.js...OK
Writing .grunt\grunt-contrib-jasmine\reporter.js...OK
Reading C:\_test\less_tests\node_modules\grunt-contrib-jasmine\.jasmine\latest\lib\jasmine-core\jasmine.css...OK
Writing .grunt\grunt-contrib-jasmine\jasmine.css...OK
Reading C:\_test\less_tests\node_modules\grunt-contrib-jasmine\.jasmine\latest\lib\jasmine-core\jasmine.js...OK
Writing .grunt\grunt-contrib-jasmine\jasmine.js...OK
Reading C:\_test\less_tests\node_modules\grunt-contrib-jasmine\.jasmine\latest\lib\jasmine-core\jasmine-html.js...OK
Writing .grunt\grunt-contrib-jasmine\jasmine-html.js...OK
Reading C:\_test\less_tests\node_modules\grunt-contrib-jasmine\.jasmine\latest\lib\jasmine-core\json2.js...OK
Writing .grunt\grunt-contrib-jasmine\json2.js...OK
Reading C:\_test\less_tests\node_modules\grunt-contrib-jasmine\.jasmine\latest\lib\jasmine-core\boot.js...OK
Writing .grunt\grunt-contrib-jasmine\boot.js...OK
Reading C:\_test\less_tests\node_modules\grunt-contrib-jasmine\.jasmine\latest\images\jasmine_favicon.png...OK
Writing .grunt\grunt-contrib-jasmine\jasmine_favicon.png...OK
Reading C:\_test\less_tests\node_modules\grunt-contrib-jasmine\tasks\jasmine\templates\DefaultRunner.tmpl...OK
Processing source...OK
Writing _SpecRunner.html...OK

Testing specs with Jasmine/latest via HeadlessChrome/72.0.3582.0
Jasmine Runner Starting...
jasmine.suiteStarted
 test
jasmine.specStarted
   - equal test...jasmine.specDone
   √ equal test
jasmine.suiteDone
jasmine.jasmineDone
Jasmine runner finished

1 spec in 0.016s.
>> 0 failures

Running "jasmine:second" (jasmine) task
Verifying property jasmine.second exists in config...OK
File: [no files]
Options: version="latest", timeout=10000, styles=[], specs="test_2.js", helpers=[], vendor=[], polyfills=[], customBootFile=null, tempDir=".grunt/grunt-contrib-jasmine", outfile="_SpecRunner.html", host="", template="C:\\_test\\less_tests\\node_modules\\grunt-contrib-jasmine\\tasks\\jasmine\\templates\\DefaultRunner.tmpl", templateOptions={}, junit={}, ignoreEmpty=false, display="full", summary=false, keepRunner
Reading C:\_test\less_tests\node_modules\grunt-contrib-jasmine\tasks\jasmine\reporters\PuppeteerReporter.js...OK
Writing .grunt\grunt-contrib-jasmine\reporter.js...OK
Reading C:\_test\less_tests\node_modules\grunt-contrib-jasmine\.jasmine\latest\lib\jasmine-core\jasmine.css...OK
Writing .grunt\grunt-contrib-jasmine\jasmine.css...OK
Reading C:\_test\less_tests\node_modules\grunt-contrib-jasmine\.jasmine\latest\lib\jasmine-core\jasmine.js...OK
Writing .grunt\grunt-contrib-jasmine\jasmine.js...OK
Reading C:\_test\less_tests\node_modules\grunt-contrib-jasmine\.jasmine\latest\lib\jasmine-core\jasmine-html.js...OK
Writing .grunt\grunt-contrib-jasmine\jasmine-html.js...OK
Reading C:\_test\less_tests\node_modules\grunt-contrib-jasmine\.jasmine\latest\lib\jasmine-core\json2.js...OK
Writing .grunt\grunt-contrib-jasmine\json2.js...OK
Reading C:\_test\less_tests\node_modules\grunt-contrib-jasmine\.jasmine\latest\lib\jasmine-core\boot.js...OK
Writing .grunt\grunt-contrib-jasmine\boot.js...OK
Reading C:\_test\less_tests\node_modules\grunt-contrib-jasmine\.jasmine\latest\images\jasmine_favicon.png...OK
Writing .grunt\grunt-contrib-jasmine\jasmine_favicon.png...OK
Reading C:\_test\less_tests\node_modules\grunt-contrib-jasmine\tasks\jasmine\templates\DefaultRunner.tmpl...OK
Processing source...OK
Writing _SpecRunner.html...OK

Testing specs with Jasmine/latest via HeadlessChrome/72.0.3582.0
Jasmine Runner Starting...
>> 0 failures

Done.

as you can see the first task completes no problem but then the second task goes straight from Jasmine Runner Starting... to >> 0 failures even though the spec should fail.

As far as I can tell this is related to the issue I was having trying to update less.js to use the latest version,
and it might have something to do with tasks/jasmine.js:30 and how it is called on tasks/jasmine.js:372. I'm not very familiar with this project so that's as far as I've got.

@steveoh
Copy link
Contributor

steveoh commented Feb 19, 2019

Do you want to try to await the resolve call and see if that changes anything?

@steveoh
Copy link
Contributor

steveoh commented Feb 19, 2019

This project uses a large multi task and it runs all of the specs. So i'm not sure what is the difference.

@nealdeters
Copy link

nealdeters commented Sep 27, 2019

I'm running into this issue as well after upgrading from version 1.2.0 to 2.0.3. Is this still being looked at?

@steveoh
Copy link
Contributor

steveoh commented Oct 2, 2019

Not that I know of.

@steveoh
Copy link
Contributor

steveoh commented Oct 2, 2019

@nealdeters I’d you signed the cla and reimplemented pr 300 it might fix your issue?

@nealdeters
Copy link

@steveoh I ended up using that as the fix. Thanks for getting back to me.

@steveoh
Copy link
Contributor

steveoh commented Oct 5, 2019

@nealdeters do you want to contribute the fix?

ChrisBoet added a commit to ChrisBoet/grunt-contrib-jasmine that referenced this issue Oct 16, 2019
@ossdev07
Copy link

ossdev07 commented Nov 5, 2019

Hi @jabbany @steveoh as per your suggestion in #311 I have tried to incoperate the changes mentioned in PR #300, But it is not working for me.

I am using grunt-contrib-jasmine latest version in less.js and after running few test cases test cases are hanging, Please find the logs:

Running "jasmine:main" (jasmine) task

Testing specs with Jasmine/latest via HeadlessChrome/78.0.3882.0

log: Refused to apply style from 'http://localhost:8081/absolute/something.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

log: Failed to load resource: the server responded with a status of 404 ()

log: Failed to load resource: the server responded with a status of 404 (Not Found)

log: start spec

log: Refused to apply style from 'http://localhost:8081/absolute/something.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

log: Failed to load resource: the server responded with a status of 404 ()
^C

Execution Time (2019-11-05 14:38:51 UTC+5:30)
eslint:target     2.7s  ▇▇▇▇▇▇▇▇ 6%
shell:testbuild  13.6s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 28%
shell:test        5.8s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 12%
jasmine:main     24.9s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 52%
Total 48.1s

Could you please have a look and provide your feedback on the issue?
I can share detailed logs for your better understanding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants