'How do I exclude files from svelte-kit build?

If I run npm run build with SvelteKit it seems to include all files from the src folder. Is it possible to exclude a certain file type (eg. *test.js)?

Example

  1. Select demo app with npm init svelte@next my-app

  2. Add the following code to src/routes/todos/foo.test.js

    describe('foo', () => {
      it('temp', () => {
        expect(true).toBe(false)
      })
    })
    
  3. npm run build

  4. npm run preview

Result: describe is not defined

Workaround

Move tests outside of src



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source