Next.js Discord

Discord Forum

Ignoring __test__ folder during the build process

Unanswered
Pteromalid wasp posted this in #help-forum
Open in Discord
Avatar
Pteromalid waspOP
Hey guys I am trying to ignore my test files during the build process but unable to progress,

I have a github workflow set to run tests so that the build process is free of tests,

It would be great if someone can help me with this also would love to know if it's a good idea or not

5 Replies

Avatar
Pteromalid waspOP
For ref:


this is what my next.config.js looks like

  webpack: (config, { isServer }) => {
    if (!isServer) {
      // Ignore the "__test__" folder
      config.module.rules.push({
        test: /^__test__|\.test\.ts$/,
        loader: 'ignore-loader',
      });
    }

    return config;
  },
Avatar
maxswjeon
Use Typescript RootDir and use src folder? Might help
Avatar
Pteromalid waspOP
Tried excluding the test files in ts conifg but it doesn't seem to be working