{"action":"created","issue":{"url":"https://api.github.com/repos/pghalliday/grunt-mocha-test/issues/134","repository_url":"https://api.github.com/repos/pghalliday/grunt-mocha-test","labels_url":"https://api.github.com/repos/pghalliday/grunt-mocha-test/issues/134/labels{/name}","comments_url":"https://api.github.com/repos/pghalliday/grunt-mocha-test/issues/134/comments","events_url":"https://api.github.com/repos/pghalliday/grunt-mocha-test/issues/134/events","html_url":"https://github.com/pghalliday/grunt-mocha-test/issues/134","id":305622124,"number":134,"title":"Running multiple configurations in one command causes tests not to run","user":{"login":"michaellperry","id":68170,"avatar_url":"https://avatars1.githubusercontent.com/u/68170?v=4","gravatar_id":"","url":"https://api.github.com/users/michaellperry","html_url":"https://github.com/michaellperry","followers_url":"https://api.github.com/users/michaellperry/followers","following_url":"https://api.github.com/users/michaellperry/following{/other_user}","gists_url":"https://api.github.com/users/michaellperry/gists{/gist_id}","starred_url":"https://api.github.com/users/michaellperry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaellperry/subscriptions","organizations_url":"https://api.github.com/users/michaellperry/orgs","repos_url":"https://api.github.com/users/michaellperry/repos","events_url":"https://api.github.com/users/michaellperry/events{/privacy}","received_events_url":"https://api.github.com/users/michaellperry/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-15T16:17:50Z","updated_at":"2018-03-21T21:36:54Z","closed_at":null,"author_association":"NONE","body":"I've configured two separate sets of options: one for unit tests the other for integration tests. When I run them individually, each runs all of its configured tests. But when I run them together, the second one does not run any tests.\r\n\r\nConfiguration:\r\n\r\n```\r\n  grunt.initConfig({\r\n    mochaTest : {\r\n      integration: {\r\n        options: {\r\n          reporter: 'spec',\r\n          grep: 'Integration'\r\n        },\r\n        src: ['test/**/*.js']\r\n      },\r\n      unit: {\r\n        options: {\r\n          reporter: 'spec',\r\n          grep: 'Integration',\r\n          invert: true\r\n        },\r\n        src: ['test/**/*.js']\r\n      }\r\n    }\r\n  });\r\n```\r\n\r\nRunning just unit tests:\r\n\r\n```\r\n$ grunt mochaTest:unit\r\nRunning \"mochaTest:unit\" (mochaTest) task\r\n  103 passing\r\n```\r\n\r\nRunning just integration tests:\r\n\r\n```\r\n$ grunt mochaTest:integration\r\nRunning \"mochaTest:integration\" (mochaTest) task\r\n  28 passing\r\n```\r\n\r\nRunning all tests:\r\n\r\n```\r\n$ grunt mochaTest\r\nRunning \"mochaTest:integration\" (mochaTest) task\r\n  28 passing\r\nRunning \"mochaTest:unit\" (mochaTest) task\r\n  0 passing\r\n```\r\n\r\nReversing the order:\r\n\r\n```\r\n$ grunt mochaTest:unit mochaTest:integration\r\nRunning \"mochaTest:unit\" (mochaTest) task\r\n  103 passing\r\nRunning \"mochaTest:integration\" (mochaTest) task\r\n  0 passing\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/pghalliday/grunt-mocha-test/issues/comments/375104250","html_url":"https://github.com/pghalliday/grunt-mocha-test/issues/134#issuecomment-375104250","issue_url":"https://api.github.com/repos/pghalliday/grunt-mocha-test/issues/134","id":375104250,"user":{"login":"pghalliday","id":934514,"avatar_url":"https://avatars0.githubusercontent.com/u/934514?v=4","gravatar_id":"","url":"https://api.github.com/users/pghalliday","html_url":"https://github.com/pghalliday","followers_url":"https://api.github.com/users/pghalliday/followers","following_url":"https://api.github.com/users/pghalliday/following{/other_user}","gists_url":"https://api.github.com/users/pghalliday/gists{/gist_id}","starred_url":"https://api.github.com/users/pghalliday/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pghalliday/subscriptions","organizations_url":"https://api.github.com/users/pghalliday/orgs","repos_url":"https://api.github.com/users/pghalliday/repos","events_url":"https://api.github.com/users/pghalliday/events{/privacy}","received_events_url":"https://api.github.com/users/pghalliday/received_events","type":"User","site_admin":false},"created_at":"2018-03-21T21:36:54Z","updated_at":"2018-03-21T21:36:54Z","author_association":"OWNER","body":"This is because mocha loads all the tests with `require` and as such they get added to the require cache. The result is that the second time around no tests are added. It may help to use the `clearRequireCache` option, but be careful as this may have undesirable side effects (may work fine though :)"}}
{"actor":{"display_login":"pghalliday"}}