You can install all of these as dev dependencies using the npm install -save-dev command, or you can copy them straight out of the demo repo’s package.json.Ĭompiles Svelte components into ES6 Rollup to roll up multiple source files into out output file. Here’s a list of required packages, together with an explanation of why that package is necessary. Instead, Babel transpile each file as it is loaded by the Node module loader. It’s worth repeating how this differs from something like React:Ĭalling npm test on the command line will cause test files to be bundled with Rollup into a single file, transpiled to CommonJS, and then that single file is passed to the test runner.įor React unit testing, it's more normal to avoid any bundler: the test runner is passed each specific spec file. Scripty, which makes our package.json clearer when we come to define our test build & execute script.This is where Svelte testing differs from React testing, and we’ll look at this in detail later. Rollup, for bundling all our test files into a single CommonJS file that Node can run. JSDOM, which provides a DOM for Svelte to operate against in the Node environment.(If you find this a poor choice for yourself then feel free to replace it with Mocha, Jest, or anything else.) Jasmine, which executes our test scripts.Node, because we’ll run our tests on the command line, outside of a browser.A demo repository for Svelte testing techniquesĪ Svelte unit testing set up makes use of the following:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |