[beta] Is it possible to use the test suite with webpack?

[beta] Is it possible to use the test suite with webpack?
0.0 0

#1

or How can you add the test suite in your webpack configuration?

I tried the following:

  • require() the test suite in my entry JS file. The test dialog is there but it doesn’t work.
  • Add two <script>s (one for the test suite and another for the webpack output) in the HTML. The test dialog is nowhere to be seen.

Is there any way to do this? I’m thinking it might work if the test suite is a package that can be imported, but I’m not sure…


#2

In package.json:

"scripts": {
    "test": "mocha",
    "dev": "node index.js"
  },

mocha runs the tests.
another example:

 "scripts": {
    "start": "node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js",
    "test": "mocha --compilers js:babel-core/register --require ./test/test_helper.js --recursive ./test",
    "test:watch": "npm run test -- --watch"
  },

and that is all I know!!


#3

Just wanted to point out that you can simplify start:

"start": "webpack-dev-server"

even if webpack-dev-server is only installed locally to the project as is recommended. npm is smart enough to find it for you without the path.


#4

I should mention that the test suite itself is already a bundle, and I wanted to somehow use it in my own JS code using require or whatever.

I decided to do this instead: I’ll make the projects locally (for fun), following the tests/user stories for each project, then port them to codepen (which I’ll submit).