Skip to content

Commit

Permalink
fix: don't run test/*.spec.js files automatically in Browsers
Browse files Browse the repository at this point in the history
For Browsers we use webpack. Karma will create a bundle for every file
that is specified as entry point. This may take lots of resources (see
ipfs-inactive/js-ipfs-http-client#683 for more information).

The solution is to have only a single entry point, `test/browser.js`,
which will then be responsible to create the bundle with all the tests.

BREAKING CHANGE: Without bundling all tests in `test/browser.js` the
tests might not run. The bundling can be done like this:

    // This is webpack specific. It will create a single bundle
    // out of all files ending in ".spec.js" within the "test"
    // directory and all its subdirectories.
    'use strict'
    const testsContext = require.context('.', true, /\.spec\.js/)
    testsContext.keys().forEach(testsContext)
  • Loading branch information
vmx committed Mar 1, 2018
1 parent 57c9554 commit 0fe34b5
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/test/browser-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ function getPatterns (ctx) {
}

return [
'test/browser.js',
'test/**/*.spec.js'
'test/browser.js'
]
}

Expand Down

0 comments on commit 0fe34b5

Please sign in to comment.