{"action":"created","issue":{"url":"https://api.github.com/repos/unexpectedjs/unexpected/issues/369","repository_url":"https://api.github.com/repos/unexpectedjs/unexpected","labels_url":"https://api.github.com/repos/unexpectedjs/unexpected/issues/369/labels{/name}","comments_url":"https://api.github.com/repos/unexpectedjs/unexpected/issues/369/comments","events_url":"https://api.github.com/repos/unexpectedjs/unexpected/issues/369/events","html_url":"https://github.com/unexpectedjs/unexpected/issues/369","id":204834490,"number":369,"title":"Use Unexpected with Rollup","user":{"login":"ariacorrente","id":101845,"avatar_url":"https://avatars2.githubusercontent.com/u/101845?v=4","gravatar_id":"","url":"https://api.github.com/users/ariacorrente","html_url":"https://github.com/ariacorrente","followers_url":"https://api.github.com/users/ariacorrente/followers","following_url":"https://api.github.com/users/ariacorrente/following{/other_user}","gists_url":"https://api.github.com/users/ariacorrente/gists{/gist_id}","starred_url":"https://api.github.com/users/ariacorrente/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ariacorrente/subscriptions","organizations_url":"https://api.github.com/users/ariacorrente/orgs","repos_url":"https://api.github.com/users/ariacorrente/repos","events_url":"https://api.github.com/users/ariacorrente/events{/privacy}","received_events_url":"https://api.github.com/users/ariacorrente/received_events","type":"User","site_admin":false},"labels":[{"id":36320619,"url":"https://api.github.com/repos/unexpectedjs/unexpected/labels/question","name":"question","color":"cc317c","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2017-02-02T10:29:04Z","updated_at":"2017-09-03T14:06:02Z","closed_at":"2017-09-03T14:06:02Z","author_association":"NONE","body":"I'm trying to use Unexpected with Rollup but with partial success. I'm using Mocha as test framework, and the tests run successfully on the browser. When i try to run the tests with nodejs I fail to import the Unexpected module. I'm not sure if to report here or on the Rollup project, i decided to start here. This is more an help request than a bug report, at most its a report for missing documentation.\r\n\r\nRollup configuration:\r\n```javascript\r\nimport nodeResolve from 'rollup-plugin-node-resolve';\r\nimport commonjs from 'rollup-plugin-commonjs';\r\n\r\nexport default {\r\n  entry: 'test/src/test-node.js',\r\n  format: 'cjs',\r\n  dest: 'test/build/test-node.js',\r\n  plugins: [\r\n    nodeResolve({\r\n      jsnext: true,\r\n      main: true\r\n    }),\r\n    commonjs()\r\n  ],\r\n};\r\n```\r\nThis is the source of `test-node.js` using three different assertion modules:\r\n```javascript\r\nimport assert from 'assert';\r\nimport should from 'should';\r\nimport expect from 'unexpected';\r\n\r\ndescribe('Test rollup with mocha', function() {\r\n  it(\"-Assert- should work\", function() {\r\n    // Testing built-in assertion\r\n    assert.equal(true, true);\r\n  });\r\n  it(\"-Should- should work\", function() {\r\n    // Testing Should assertion module\r\n    (false).should.be.false();\r\n  });\r\n  it(\"-Unexpected- should work\", function() {\r\n    //Testing Unexpected assertion module\r\n    expect(true, \"to be\", true);\r\n  });\r\n});`\r\n```\r\n\r\nThe tests run as expected using the built-in assertion ad the Should module but not if the code using the Unexpected module is present. this is the error:\r\n```bash\r\n~/dev/test-module-blundler $ npm run rollup-node\r\n⚠️   Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification\r\nhttps://github.com/rollup/rollup/wiki/Troubleshooting#avoiding-eval\r\nnode_modules/unexpected-bluebird/js/main/util.js (213:4)\r\n211:     while (l--) new f();\r\n212:     return obj;\r\n213:     eval(obj);\r\n         ^\r\n214: }\r\n```\r\n\r\nWhen I run the test with mocha it throws this error:\r\n```bash\r\n~/dev/test-module-blundler $ npm test\r\n\r\n> test-module-blundler@1.0.0 test /home/nicola/dev/test-module-blundler\r\n> mocha test/build/test-node.js\r\n\r\n/home/nicola/dev/test-module-blundler/test/build/test-node.js:16046\r\n                Constructor = this[constructorName];\r\n                                  ^\r\n\r\nTypeError: Cannot read property 'Int8Array' of undefined\r\n    at /home/nicola/dev/test-module-blundler/test/build/test-node.js:16046:35\r\n    at Array.forEach (native)\r\n    at /home/nicola/dev/test-module-blundler/test/build/test-node.js:16044:25\r\n    at Array.forEach (native)\r\n    at types$1 (/home/nicola/dev/test-module-blundler/test/build/test-node.js:16043:17)\r\n    at Unexpected.use (/home/nicola/dev/test-module-blundler/test/build/test-node.js:13003:9)\r\n    at /home/nicola/dev/test-module-blundler/test/build/test-node.js:18396:6\r\n    at createCommonjsModule (/home/nicola/dev/test-module-blundler/test/build/test-node.js:4271:35)\r\n    at Object.<anonymous> (/home/nicola/dev/test-module-blundler/test/build/test-node.js:18393:15)\r\n    at Module._compile (module.js:570:32)\r\n    at Object.Module._extensions..js (module.js:579:10)\r\n    at Module.load (module.js:487:32)\r\n    at tryModuleLoad (module.js:446:12)\r\n    at Function.Module._load (module.js:438:3)\r\n    at Module.require (module.js:497:17)\r\n    at require (internal/module.js:20:19)\r\n    at /home/nicola/dev/test-module-blundler/node_modules/mocha/lib/mocha.js:222:27\r\n    at Array.forEach (native)\r\n    at Mocha.loadFiles (/home/nicola/dev/test-module-blundler/node_modules/mocha/lib/mocha.js:219:14)\r\n    at Mocha.run (/home/nicola/dev/test-module-blundler/node_modules/mocha/lib/mocha.js:487:10)\r\n    at Object.<anonymous> (/home/nicola/dev/test-module-blundler/node_modules/mocha/bin/_mocha:459:18)\r\n    at Module._compile (module.js:570:32)\r\n    at Object.Module._extensions..js (module.js:579:10)\r\n    at Module.load (module.js:487:32)\r\n    at tryModuleLoad (module.js:446:12)\r\n    at Function.Module._load (module.js:438:3)\r\n    at Module.runMain (module.js:604:10)\r\n    at run (bootstrap_node.js:394:7)\r\n    at startup (bootstrap_node.js:149:9)\r\n    at bootstrap_node.js:509:3\r\nnpm ERR! Test failed.  See above for more details.\r\n```\r\nIs Unexpected... expected do work with Rollup?"},"comment":{"url":"https://api.github.com/repos/unexpectedjs/unexpected/issues/comments/326807055","html_url":"https://github.com/unexpectedjs/unexpected/issues/369#issuecomment-326807055","issue_url":"https://api.github.com/repos/unexpectedjs/unexpected/issues/369","id":326807055,"user":{"login":"ariacorrente","id":101845,"avatar_url":"https://avatars2.githubusercontent.com/u/101845?v=4","gravatar_id":"","url":"https://api.github.com/users/ariacorrente","html_url":"https://github.com/ariacorrente","followers_url":"https://api.github.com/users/ariacorrente/followers","following_url":"https://api.github.com/users/ariacorrente/following{/other_user}","gists_url":"https://api.github.com/users/ariacorrente/gists{/gist_id}","starred_url":"https://api.github.com/users/ariacorrente/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ariacorrente/subscriptions","organizations_url":"https://api.github.com/users/ariacorrente/orgs","repos_url":"https://api.github.com/users/ariacorrente/repos","events_url":"https://api.github.com/users/ariacorrente/events{/privacy}","received_events_url":"https://api.github.com/users/ariacorrente/received_events","type":"User","site_admin":false},"created_at":"2017-09-03T14:06:02Z","updated_at":"2017-09-03T14:06:02Z","author_association":"NONE","body":"@vitalets thanks for the solution. I apologize for the delay of my response but I suspended this project for a while and forgot to reply earlier. I tested your solution when you posted and it solved the problem.\r\n\r\nNow I started to work again on this project and discovered something changed in the meantime. Now Unexpected and Rollup are working together even without the \"useStrict: false\" configuration. I recovered the test i wrote when vitalets posted the solution and in that version the problem was still present. I think some library upgrade may have solved this problem? I don't know, anyway, thanks to anyone who helped solve this."}}
{"actor":{"display_login":"ariacorrente"}}