{"action":"closed","issue":{"url":"https://api.github.com/repos/wallabyjs/public/issues/782","repository_url":"https://api.github.com/repos/wallabyjs/public","labels_url":"https://api.github.com/repos/wallabyjs/public/issues/782/labels{/name}","comments_url":"https://api.github.com/repos/wallabyjs/public/issues/782/comments","events_url":"https://api.github.com/repos/wallabyjs/public/issues/782/events","html_url":"https://github.com/wallabyjs/public/issues/782","id":176192218,"number":782,"title":"Require a startup file with webpack in typescript","user":{"login":"tjoskar","id":1525612,"avatar_url":"https://avatars.githubusercontent.com/u/1525612?v=3","gravatar_id":"","url":"https://api.github.com/users/tjoskar","html_url":"https://github.com/tjoskar","followers_url":"https://api.github.com/users/tjoskar/followers","following_url":"https://api.github.com/users/tjoskar/following{/other_user}","gists_url":"https://api.github.com/users/tjoskar/gists{/gist_id}","starred_url":"https://api.github.com/users/tjoskar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tjoskar/subscriptions","organizations_url":"https://api.github.com/users/tjoskar/orgs","repos_url":"https://api.github.com/users/tjoskar/repos","events_url":"https://api.github.com/users/tjoskar/events{/privacy}","received_events_url":"https://api.github.com/users/tjoskar/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-10T17:46:34Z","updated_at":"2016-09-11T01:38:37Z","closed_at":"2016-09-11T01:38:37Z","body":"Hi,\r\n\r\nI'm using typescript and webpack and are running the test in the browser. I need however to import a startup file to modify the global context (window) before the test runs. \r\n\r\nAs I understand it, I should only need to add the file into the `files`-list? But when I do so I get the following error:\r\n\r\n```\r\nUncaught SyntaxError: Unexpected token import\r\nat http://localhost:62166/__modules/148.js?1473526904487:1\r\nUncaught Error: Cannot find module '148'\r\nat http://localhost:62166/wallaby-webpack.js?1473526904588:1\r\n```\r\n\r\nWhich I find hard to interpret ;)\r\n\r\nThere are only two test cases that require the startup file ([test/helpers/test-helper.ts](https://github.com/tjoskar/ng2-lazyload-image/blob/8d0287d258ca21ab573f30c0ee44533a97e15d18/test/helpers/test-helper.ts)) so the other test cases works fine.\r\n\r\nFurthermore, if I use [karma](https://github.com/tjoskar/ng2-lazyload-image/blob/8d0287d258ca21ab573f30c0ee44533a97e15d18/karma.default.js) (without wallaby) the test cases works fine.\r\n\r\n### Wallaby.js configuration file\r\n\r\n```javascript\r\nconst path = require('path');\r\nconst wallabyWebpack = require('wallaby-webpack');\r\n\r\nconst webpackPostprocessor = wallabyWebpack({\r\n    entryPatterns: [\r\n        'unit-test.bundle.js',\r\n        'test/**/*.test.js'\r\n    ]\r\n});\r\n\r\nmodule.exports = () => {\r\n\r\n    return {\r\n\r\n        files: [\r\n            {pattern: 'test/helpers/test-helper.ts', load: false}, // the file I need to include before the test runs\r\n            {pattern: 'unit-test.bundle.js', load: false},\r\n            {pattern: 'src/**/*.ts', load: false},\r\n            {pattern: 'test/**/*.ts', load: false},\r\n            {pattern: 'test/**/*.test.ts', ignore: true}\r\n        ],\r\n\r\n        tests: [\r\n            {pattern: 'test/**/*test.ts', load: false}\r\n        ],\r\n\r\n        env: {\r\n            kind: 'electron'\r\n        },\r\n\r\n        testFramework: 'mocha',\r\n\r\n        postprocessor: webpackPostprocessor,\r\n\r\n        setup: function() {\r\n            window.__moduleBundler.loadTests();\r\n        },\r\n\r\n        debug: true\r\n    };\r\n};\r\n\r\n```\r\n\r\nYou can find the project here: https://github.com/tjoskar/ng2-lazyload-image/tree/feature/wallaby\r\n\r\nMy wallaby config file: https://github.com/tjoskar/ng2-lazyload-image/blob/8d0287d258ca21ab573f30c0ee44533a97e15d18/wallaby.js\r\nThe file I need to execute before the test case: https://github.com/tjoskar/ng2-lazyload-image/blob/8d0287d258ca21ab573f30c0ee44533a97e15d18/test/helpers/test-helper.ts\r\n\r\nKarma config that works: https://github.com/tjoskar/ng2-lazyload-image/blob/8d0287d258ca21ab573f30c0ee44533a97e15d18/karma.default.js (you can test it by running `npm test`)\r\n\r\nI guess my question boil down to how I can import a file that executes before the test case. Form what I understand, I can't use [setup](https://wallabyjs.com/docs/config/bootstrap.html) since I need to require a file which I can not do since the `setup` method runs in the browser context.\r\n\r\nSorry that I can't pointing out the error in more detail.\r\n\r\n### Code editor or IDE name and version\r\nAtom v1.10.2\r\n\r\n### OS name and version\r\nOSX v10.11.6\r\n\r\n"}}
{"actor":{"display_login":"ArtemGovorov"}}