Repository: netlify/zip-it-and-ship-it
Pull request #269 (2020-12-17 14:24:58)

Move test files
There is some merit to putting source files and test files alongside each other.
However, in this specific repository, I have always found it somewhat confusing, especially with the `helpers` and `fixtures` directories.
Our ESLint configuration is mostly geared towards a structure where source files and test files are in separate directories at the moment. We might want to improve this in the future, but at the moment, splitting those helps with fixing some linting rules (`node/no-unpublished-require`).

This PR moves the test files to a `tests` directory.

Note: currently looking at failing CI tests.


Patch:
diff --git a/.eslintrc.js b/.eslintrc.js
index 6f4bbde..d220a02 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -16,7 +16,6 @@ module.exports = {
     'fp/no-mutating-methods': 0,
     'import/no-dynamic-require': 0,
     'node/global-require': 0,
-    'node/no-unpublished-require': 0,
     'node/prefer-global/buffer': 0,
     'promise/param-names': 0,
   },
diff --git a/.gitignore b/.gitignore
index b99cfc0..dd72e5f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,4 @@ node_modules
 /coverage
 /build
 .vscode
+!tests/fixtures/**/node_modules
diff --git a/package.json b/package.json
index 397ae18..4168050 100644
--- a/package.json
+++ b/package.json
@@ -7,10 +7,7 @@
     "zip-it-and-ship-it": "src/bin.js"
   },
   "files": [
-    "src/**/*.js",
-    "!src/fixtures",
-    "!src/helpers",
-    "!src/**/**.test.js"
+    "src/**/*.js"
   ],
   "scripts": {
     "test": "run-s format test:dev",
@@ -90,7 +87,7 @@
   },
   "ava": {
     "files": [
-      "src/**/*.test.js"
+      "tests/*.js"
     ],
     "compileEnhancements": false,
     "babel": false,
diff --git a/src/fixtures/node-module-excluded/function.js b/src/fixtures/node-module-excluded/function.js
deleted file mode 100644
index c1a5d9d..0000000
--- a/src/fixtures/node-module-excluded/function.js
+++ /dev/null
@@ -1,6 +0,0 @@
-try {
-  // eslint-disable-next-line node/no-missing-require, import/no-unassigned-import, import/no-unresolved
-  require('aws-sdk')
-} catch (error) {}
-
-module.exports = true
diff --git a/src/fixtures/node-module-missing-conditional/function.js b/src/fixtures/node-module-missing-conditional/function.js
deleted file mode 100644
index 98f175d..0000000
--- a/src/fixtures/node-module-missing-conditional/function.js
+++ /dev/null
@@ -1,6 +0,0 @@
-try {
-  // eslint-disable-next-line node/no-missing-require, import/no-unassigned-import, import/no-unresolved
-  require('encoding')
-} catch (error) {}
-
-module.exports = true
diff --git a/src/fixtures/node-module-missing-deep/function.js b/src/fixtures/node-module-missing-deep/function.js
deleted file mode 100644
index 28b1bd4..0000000
--- a/src/fixtures/node-module-missing-deep/function.js
+++ /dev/null
@@ -1,1 +0,0 @@
-module.exports = require('test')
diff --git a/src/fixtures/node-module-missing-optional/function.js b/src/fixtures/node-module-missing-optional/function.js
deleted file mode 100644
index d05fd1a..0000000
--- a/src/fixtures/node-module-missing-optional/function.js
+++ /dev/null
@@ -1,6 +0,0 @@
-try {
-  // eslint-disable-next-line node/no-missing-require, import/no-unresolved, import/no-unassigned-import
-  require('consistent-ids')
-} catch (error) {}
-
-module.exports = true
diff --git a/src/fixtures/node-module-missing-package/function.js b/src/fixtures/node-module-missing-package/function.js
deleted file mode 100644
index 8261760..0000000
--- a/src/fixtures/node-module-missing-package/function.js
+++ /dev/null
@@ -1,2 +0,0 @@
-// eslint-disable-next-line node/no-missing-require, import/no-unresolved
-module.exports = require('does-not-exist')
diff --git a/src/fixtures/node-module-missing/function.js b/src/fixtures/node-module-missing/function.js
deleted file mode 100644
index 8261760..0000000
--- a/src/fixtures/node-module-missing/function.js
+++ /dev/null
@@ -1,2 +0,0 @@
-// eslint-disable-next-line node/no-missing-require, import/no-unresolved
-module.exports = require('does-not-exist')
diff --git a/src/fixtures/node-module-next/function.js b/src/fixtures/node-module-next/function.js
deleted file mode 100644
index 3126069..0000000
--- a/src/fixtures/node-module-next/function.js
+++ /dev/null
@@ -1,4 +0,0 @@
-// eslint-disable-next-line node/no-extraneous-require, import/no-unassigned-import, import/no-extraneous-dependencies
-require('next/dist/next-server/lib/constants')
-
-module.exports = true
diff --git a/src/fixtures/node-module-peer-not-optional/function.js b/src/fixtures/node-module-peer-not-optional/function.js
deleted file mode 100644
index 53be264..0000000
--- a/src/fixtures/node-module-peer-not-optional/function.js
+++ /dev/null
@@ -1,6 +0,0 @@
-try {
-  // eslint-disable-next-line node/no-missing-require, import/no-unassigned-import, import/no-unresolved
-  require('consistent-ids')
-} catch (error) {}
-
-module.exports = true
diff --git a/src/fixtures/node-module-peer-optional-none/function.js b/src/fixtures/node-module-peer-optional-none/function.js
deleted file mode 100644
index 53be264..0000000
--- a/src/fixtures/node-module-peer-optional-none/function.js
+++ /dev/null
@@ -1,6 +0,0 @@
-try {
-  // eslint-disable-next-line node/no-missing-require, import/no-unassigned-import, import/no-unresolved
-  require('consistent-ids')
-} catch (error) {}
-
-module.exports = true
diff --git a/src/fixtures/node-module-peer-optional/function.js b/src/fixtures/node-module-peer-optional/function.js
deleted file mode 100644
index 53be264..0000000
--- a/src/fixtures/node-module-peer-optional/function.js
+++ /dev/null
@@ -1,6 +0,0 @@
-try {
-  // eslint-disable-next-line node/no-missing-require, import/no-unassigned-import, import/no-unresolved
-  require('consistent-ids')
-} catch (error) {}
-
-module.exports = true
diff --git a/src/fixtures/node-module-typescript-types/function.js b/src/fixtures/node-module-typescript-types/function.js
deleted file mode 100644
index d5bb220..0000000
--- a/src/fixtures/node-module-typescript-types/function.js
+++ /dev/null
@@ -1,6 +0,0 @@
-try {
-  // eslint-disable-next-line node/no-missing-require, import/no-unresolved, import/no-unassigned-import
-  require('@types/node')
-} catch (error) {}
-
-module.exports = true
diff --git a/src/fixtures/side-module/function.js b/src/fixtures/side-module/function.js
deleted file mode 100644
index b03ea0b..0000000
--- a/src/fixtures/side-module/function.js
+++ /dev/null
@@ -1,1 +0,0 @@
-module.exports = require('@prisma/client') && require('.prisma/client')
diff --git a/src/fixtures/symlinks/function/function.js b/src/fixtures/symlinks/function/function.js
deleted file mode 100644
index f552ec2..0000000
--- a/src/fixtures/symlinks/function/function.js
+++ /dev/null
@@ -1,2 +0,0 @@
-// eslint-disable-next-line node/no-missing-require, import/no-unresolved
-module.exports = require('./file')
diff --git a/src/fixtures/directory-handler/function/function.js b/tests/fixtures/directory-handler/function/function.js
similarity index 100%
rename from src/fixtures/directory-handler/function/function.js
rename to tests/fixtures/directory-handler/function/function.js
diff --git a/src/fixtures/empty/.keep b/tests/fixtures/empty/.keep
similarity index 100%
rename from src/fixtures/empty/.keep
rename to tests/fixtures/empty/.keep
diff --git a/src/fixtures/go-simple/test b/tests/fixtures/go-simple/test
similarity index 100%
rename from src/fixtures/go-simple/test
rename to tests/fixtures/go-simple/test
diff --git a/src/fixtures/go-simple/test.go b/tests/fixtures/go-simple/test.go
similarity index 100%
rename from src/fixtures/go-simple/test.go
rename to tests/fixtures/go-simple/test.go
diff --git a/src/fixtures/ignore-dir-node-modules/node_modules/.gitkeep b/tests/fixtures/ignore-deep-dir-node-modules/deep/node_modules/.gitkeep
similarity index 100%
rename from src/fixtures/ignore-dir-node-modules/node_modules/.gitkeep
rename to tests/fixtures/ignore-deep-dir-node-modules/deep/node_modules/.gitkeep
diff --git a/src/fixtures/ignore-deep-dir-node-modules/function/function.js b/tests/fixtures/ignore-deep-dir-node-modules/function/function.js
similarity index 100%
rename from src/fixtures/ignore-deep-dir-node-modules/function/function.js
rename to tests/fixtures/ignore-deep-dir-node-modules/function/function.js
diff --git a/src/fixtures/ignore-dir-node-modules/function/function.js b/tests/fixtures/ignore-dir-node-modules/function/function.js
similarity index 100%
rename from src/fixtures/ignore-dir-node-modules/function/function.js
rename to tests/fixtures/ignore-dir-node-modules/function/function.js
diff --git a/src/fixtures/list/empty/.gitkeep b/tests/fixtures/ignore-dir-node-modules/node_modules/.gitkeep
similarity index 100%
rename from src/fixtures/list/empty/.gitkeep
rename to tests/fixtures/ignore-dir-node-modules/node_modules/.gitkeep
diff --git a/src/fixtures/ignore-directories/dir/.keep b/tests/fixtures/ignore-directories/dir/.keep
similarity index 100%
rename from src/fixtures/ignore-directories/dir/.keep
rename to tests/fixtures/ignore-directories/dir/.keep
diff --git a/src/fixtures/ignore-directories/function.js b/tests/fixtures/ignore-directories/function.js
similarity index 100%
rename from src/fixtures/ignore-directories/function.js
rename to tests/fixtures/ignore-directories/function.js
diff --git a/src/fixtures/ignore-node-modules/function.js b/tests/fixtures/ignore-node-modules/function.js
similarity index 100%
rename from src/fixtures/ignore-node-modules/function.js
rename to tests/fixtures/ignore-node-modules/function.js
diff --git a/src/fixtures/ignore-node-modules/node_modules/.keep b/tests/fixtures/ignore-node-modules/node_modules/.keep
similarity index 100%
rename from src/fixtures/ignore-node-modules/node_modules/.keep
rename to tests/fixtures/ignore-node-modules/node_modules/.keep
diff --git a/src/fixtures/index-handler/function/file.js b/tests/fixtures/index-handler/function/file.js
similarity index 100%
rename from src/fixtures/index-handler/function/file.js
rename to tests/fixtures/index-handler/function/file.js
diff --git a/src/fixtures/index-handler/function/index.js b/tests/fixtures/index-handler/function/index.js
similarity index 100%
rename from src/fixtures/index-handler/function/index.js
rename to tests/fixtures/index-handler/function/index.js
diff --git a/src/fixtures/invalid-package-json/function.js b/tests/fixtures/invalid-package-json/function.js
similarity index 100%
rename from src/fixtures/invalid-package-json/function.js
rename to tests/fixtures/invalid-package-json/function.js
diff --git a/src/fixtures/invalid-package-json/package.json.txt b/tests/fixtures/invalid-package-json/package.json.txt
similarity index 100%
rename from src/fixtures/invalid-package-json/package.json.txt
rename to tests/fixtures/invalid-package-json/package.json.txt
diff --git a/src/fixtures/invalid-require/function.js b/tests/fixtures/invalid-require/function.js
similarity index 50%
rename from src/fixtures/invalid-require/function.js
rename to tests/fixtures/invalid-require/function.js
index 996249d..dae21bb 100644
--- a/src/fixtures/invalid-require/function.js
+++ b/tests/fixtures/invalid-require/function.js
@@ -1,6 +1,6 @@
 // eslint-disable-next-line no-constant-condition
 if (false) {
-  // eslint-disable-next-line node/no-missing-require, import/no-unresolved, import/no-unassigned-import
+  // eslint-disable-next-line import/no-unresolved, import/no-unassigned-import
   require('@scope')
 }
 
diff --git a/src/fixtures/node-module-next-on-netlify/function/function.js b/tests/fixtures/node-module-next-on-netlify/function/function.js
similarity index 100%
rename from src/fixtures/node-module-next-on-netlify/function/function.js
rename to tests/fixtures/node-module-next-on-netlify/function/function.js
diff --git a/src/fixtures/node-module-next-on-netlify/function/renderNextPage.js b/tests/fixtures/node-module-next-on-netlify/function/renderNextPage.js
similarity index 56%
rename from src/fixtures/node-module-next-on-netlify/function/renderNextPage.js
rename to tests/fixtures/node-module-next-on-netlify/function/renderNextPage.js
index 0135bdb..1bb73bc 100644
--- a/src/fixtures/node-module-next-on-netlify/function/renderNextPage.js
+++ b/tests/fixtures/node-module-next-on-netlify/function/renderNextPage.js
@@ -1,5 +1,5 @@
 /* eslint-disable unicorn/filename-case */
-// eslint-disable-next-line node/no-extraneous-require, import/no-unassigned-import, import/no-extraneous-dependencies
+// eslint-disable-next-line import/no-unassigned-import, import/no-extraneous-dependencies, node/no-extraneous-require
 require('next/dist/next-server/lib/constants')
 
 module.exports = true
diff --git a/src/fixtures/symlinks/function/target.js b/tests/fixtures/symlinks/function/target.js
similarity index 100%
rename from src/fixtures/symlinks/function/target.js
rename to tests/fixtures/symlinks/function/target.js
diff --git a/src/fixtures/unsupported/function.sh b/tests/fixtures/unsupported/function.sh
similarity index 100%
rename from src/fixtures/unsupported/function.sh
rename to tests/fixtures/unsupported/function.sh
diff --git a/src/fixtures/useless/function/Desktop.ini b/tests/fixtures/useless/function/Desktop.ini
similarity index 100%
rename from src/fixtures/useless/function/Desktop.ini
rename to tests/fixtures/useless/function/Desktop.ini
diff --git a/src/fixtures/useless/function/file.js b/tests/fixtures/useless/function/file.js
similarity index 100%
rename from src/fixtures/useless/function/file.js
rename to tests/fixtures/useless/function/file.js
diff --git a/src/fixtures/useless/function/function.js b/tests/fixtures/useless/function/function.js
similarity index 100%
rename from src/fixtures/useless/function/function.js
rename to tests/fixtures/useless/function/function.js
diff --git a/src/helpers/main.js b/tests/helpers/main.js
similarity index 97%
rename from src/helpers/main.js
rename to tests/helpers/main.js
index ef019ac..841da0b 100644
--- a/src/helpers/main.js
+++ b/tests/helpers/main.js
@@ -4,7 +4,7 @@ const { promisify } = require('util')
 const AdmZip = require('adm-zip')
 const { dir: getTmpDir } = require('tmp-promise')
 
-const { zipFunctions } = require('../main')
+const { zipFunctions } = require('../..')
 
 const FIXTURES_DIR = join(__dirname, '..', 'fixtures')
 


Test patch:
diff --git a/src/bin.test.js b/tests/bin.js
similarity index 96%
rename from src/bin.test.js
rename to tests/bin.js
index 8c9ab3d..43efaae 100644
--- a/src/bin.test.js
+++ b/tests/bin.js
@@ -8,7 +8,7 @@ const { version } = require('../package.json')
 
 const { FIXTURES_DIR } = require('./helpers/main.js')
 
-const BINARY_PATH = `${__dirname}/bin.js`
+const BINARY_PATH = `${__dirname}/../src/bin.js`
 
 test('CLI | --version', async (t) => {
   const { stdout } = await execa(BINARY_PATH, ['--version'])
diff --git a/src/fixtures/keep-dir-files/function/file.js b/tests/fixtures/keep-dir-files/function/file.js
similarity index 100%
rename from src/fixtures/keep-dir-files/function/file.js
rename to tests/fixtures/keep-dir-files/function/file.js
diff --git a/src/fixtures/keep-dir-files/function/function.js b/tests/fixtures/keep-dir-files/function/function.js
similarity index 100%
rename from src/fixtures/keep-dir-files/function/function.js
rename to tests/fixtures/keep-dir-files/function/function.js
diff --git a/src/fixtures/keep-zip/test.zip b/tests/fixtures/keep-zip/test.zip
similarity index 100%
rename from src/fixtures/keep-zip/test.zip
rename to tests/fixtures/keep-zip/test.zip
diff --git a/src/fixtures/node-module-included/node_modules/test/test.html b/tests/fixtures/list/empty/.gitkeep
similarity index 100%
rename from src/fixtures/node-module-included/node_modules/test/test.html
rename to tests/fixtures/list/empty/.gitkeep
diff --git a/src/fixtures/list/four.js/four.js.js b/tests/fixtures/list/four.js/four.js.js
similarity index 100%
rename from src/fixtures/list/four.js/four.js.js
rename to tests/fixtures/list/four.js/four.js.js
diff --git a/src/fixtures/list/one/index.js b/tests/fixtures/list/one/index.js
similarity index 100%
rename from src/fixtures/list/one/index.js
rename to tests/fixtures/list/one/index.js
diff --git a/src/fixtures/list/test b/tests/fixtures/list/test
similarity index 100%
rename from src/fixtures/list/test
rename to tests/fixtures/list/test
diff --git a/src/fixtures/list/test.go b/tests/fixtures/list/test.go
similarity index 100%
rename from src/fixtures/list/test.go
rename to tests/fixtures/list/test.go
diff --git a/src/fixtures/list/test.js b/tests/fixtures/list/test.js
similarity index 100%
rename from src/fixtures/list/test.js
rename to tests/fixtures/list/test.js
diff --git a/src/fixtures/list/test.zip b/tests/fixtures/list/test.zip
similarity index 100%
rename from src/fixtures/list/test.zip
rename to tests/fixtures/list/test.zip
diff --git a/src/fixtures/list/two/three.json b/tests/fixtures/list/two/three.json
similarity index 100%
rename from src/fixtures/list/two/three.json
rename to tests/fixtures/list/two/three.json
diff --git a/src/fixtures/list/two/two.js b/tests/fixtures/list/two/two.js
similarity index 100%
rename from src/fixtures/list/two/two.js
rename to tests/fixtures/list/two/two.js
diff --git a/src/fixtures/local-deep-require/function/deep/dir/file.js b/tests/fixtures/local-deep-require/function/deep/dir/file.js
similarity index 100%
rename from src/fixtures/local-deep-require/function/deep/dir/file.js
rename to tests/fixtures/local-deep-require/function/deep/dir/file.js
diff --git a/src/fixtures/local-deep-require/function/deep/file.js b/tests/fixtures/local-deep-require/function/deep/file.js
similarity index 100%
rename from src/fixtures/local-deep-require/function/deep/file.js
rename to tests/fixtures/local-deep-require/function/deep/file.js
diff --git a/src/fixtures/local-deep-require/function/function.js b/tests/fixtures/local-deep-require/function/function.js
similarity index 100%
rename from src/fixtures/local-deep-require/function/function.js
rename to tests/fixtures/local-deep-require/function/function.js
diff --git a/src/fixtures/node-module-deep-conditional/function.js b/tests/fixtures/local-node-module/function.js
similarity index 100%
rename from src/fixtures/node-module-deep-conditional/function.js
rename to tests/fixtures/local-node-module/function.js
diff --git a/src/fixtures/local-node-module/node_modules/test/index.js b/tests/fixtures/local-node-module/node_modules/test/index.js
similarity index 100%
rename from src/fixtures/local-node-module/node_modules/test/index.js
rename to tests/fixtures/local-node-module/node_modules/test/index.js
diff --git a/src/fixtures/local-node-module/node_modules/test/package.json b/tests/fixtures/local-node-module/node_modules/test/package.json
similarity index 100%
rename from src/fixtures/local-node-module/node_modules/test/package.json
rename to tests/fixtures/local-node-module/node_modules/test/package.json
diff --git a/src/fixtures/local-node-module/package.json b/tests/fixtures/local-node-module/package.json
similarity index 100%
rename from src/fixtures/local-node-module/package.json
rename to tests/fixtures/local-node-module/package.json
diff --git a/src/fixtures/local-parent-require/file/test.js b/tests/fixtures/local-parent-require/file/test.js
similarity index 100%
rename from src/fixtures/local-parent-require/file/test.js
rename to tests/fixtures/local-parent-require/file/test.js
diff --git a/src/fixtures/local-parent-require/function/function.js b/tests/fixtures/local-parent-require/function/function.js
similarity index 100%
rename from src/fixtures/local-parent-require/function/function.js
rename to tests/fixtures/local-parent-require/function/function.js
diff --git a/src/fixtures/local-parent-require/package.json b/tests/fixtures/local-parent-require/package.json
similarity index 100%
rename from src/fixtures/local-parent-require/package.json
rename to tests/fixtures/local-parent-require/package.json
diff --git a/src/fixtures/local-require/function/file.js b/tests/fixtures/local-require/function/file.js
similarity index 100%
rename from src/fixtures/local-require/function/file.js
rename to tests/fixtures/local-require/function/file.js
diff --git a/src/fixtures/local-require/function/function.js b/tests/fixtures/local-require/function/function.js
similarity index 100%
rename from src/fixtures/local-require/function/function.js
rename to tests/fixtures/local-require/function/function.js
diff --git a/src/fixtures/many-dependencies/function.js b/tests/fixtures/many-dependencies/function.js
similarity index 100%
rename from src/fixtures/many-dependencies/function.js
rename to tests/fixtures/many-dependencies/function.js
diff --git a/src/fixtures/many-functions/five.js b/tests/fixtures/many-functions/five.js
similarity index 100%
rename from src/fixtures/many-functions/five.js
rename to tests/fixtures/many-functions/five.js
diff --git a/src/fixtures/many-functions/four.js b/tests/fixtures/many-functions/four.js
similarity index 100%
rename from src/fixtures/many-functions/four.js
rename to tests/fixtures/many-functions/four.js
diff --git a/src/fixtures/many-functions/one.js b/tests/fixtures/many-functions/one.js
similarity index 100%
rename from src/fixtures/many-functions/one.js
rename to tests/fixtures/many-functions/one.js
diff --git a/src/fixtures/many-functions/six.js b/tests/fixtures/many-functions/six.js
similarity index 100%
rename from src/fixtures/many-functions/six.js
rename to tests/fixtures/many-functions/six.js
diff --git a/src/fixtures/many-functions/three.js b/tests/fixtures/many-functions/three.js
similarity index 100%
rename from src/fixtures/many-functions/three.js
rename to tests/fixtures/many-functions/three.js
diff --git a/src/fixtures/many-functions/two.js b/tests/fixtures/many-functions/two.js
similarity index 100%
rename from src/fixtures/many-functions/two.js
rename to tests/fixtures/many-functions/two.js
diff --git a/src/fixtures/no-package-json/function.js b/tests/fixtures/no-package-json/function.js
similarity index 100%
rename from src/fixtures/no-package-json/function.js
rename to tests/fixtures/no-package-json/function.js
diff --git a/src/fixtures/no-package-json/node_modules/test/index.js b/tests/fixtures/no-package-json/node_modules/test/index.js
similarity index 100%
rename from src/fixtures/no-package-json/node_modules/test/index.js
rename to tests/fixtures/no-package-json/node_modules/test/index.js
diff --git a/src/fixtures/no-package-json/node_modules/test/package.json b/tests/fixtures/no-package-json/node_modules/test/package.json
similarity index 100%
rename from src/fixtures/no-package-json/node_modules/test/package.json
rename to tests/fixtures/no-package-json/node_modules/test/package.json
diff --git a/tests/fixtures/node-module-deep-conditional/function.js b/tests/fixtures/node-module-deep-conditional/function.js
new file mode 100644
index 0000000..af93727
--- /dev/null
+++ b/tests/fixtures/node-module-deep-conditional/function.js
@@ -0,0 +1,4 @@
+// eslint-disable-next-line import/no-unassigned-import
+require('test')
+
+module.exports = true
diff --git a/src/fixtures/node-module-deep-conditional/node_modules/test/index.js b/tests/fixtures/node-module-deep-conditional/node_modules/test/index.js
similarity index 100%
rename from src/fixtures/node-module-deep-conditional/node_modules/test/index.js
rename to tests/fixtures/node-module-deep-conditional/node_modules/test/index.js
diff --git a/src/fixtures/node-module-deep-conditional/node_modules/test/package.json b/tests/fixtures/node-module-deep-conditional/node_modules/test/package.json
similarity index 100%
rename from src/fixtures/node-module-deep-conditional/node_modules/test/package.json
rename to tests/fixtures/node-module-deep-conditional/node_modules/test/package.json
diff --git a/src/fixtures/node-module-deep-conditional/package.json b/tests/fixtures/node-module-deep-conditional/package.json
similarity index 100%
rename from src/fixtures/node-module-deep-conditional/package.json
rename to tests/fixtures/node-module-deep-conditional/package.json
diff --git a/src/fixtures/node-module-error/function.js b/tests/fixtures/node-module-error/function.js
similarity index 100%
rename from src/fixtures/node-module-error/function.js
rename to tests/fixtures/node-module-error/function.js
diff --git a/src/fixtures/node-module-error/node_modules/test/index.js b/tests/fixtures/node-module-error/node_modules/test/index.js
similarity index 100%
rename from src/fixtures/node-module-error/node_modules/test/index.js
rename to tests/fixtures/node-module-error/node_modules/test/index.js
diff --git a/tests/fixtures/node-module-excluded/function.js b/tests/fixtures/node-module-excluded/function.js
new file mode 100644
index 0000000..c19546c
--- /dev/null
+++ b/tests/fixtures/node-module-excluded/function.js
@@ -0,0 +1,6 @@
+try {
+  // eslint-disable-next-line import/no-unassigned-import, import/no-unresolved
+  require('aws-sdk')
+} catch (error) {}
+
+module.exports = true
diff --git a/src/fixtures/local-node-module/function.js b/tests/fixtures/node-module-included/function.js
similarity index 100%
rename from src/fixtures/local-node-module/function.js
rename to tests/fixtures/node-module-included/function.js
diff --git a/src/fixtures/node-module-included/node_modules/test/index.js b/tests/fixtures/node-module-included/node_modules/test/index.js
similarity index 100%
rename from src/fixtures/node-module-included/node_modules/test/index.js
rename to tests/fixtures/node-module-included/node_modules/test/index.js
diff --git a/src/fixtures/node-module-included/node_modules/test/package.json b/tests/fixtures/node-module-included/node_modules/test/package.json
similarity index 100%
rename from src/fixtures/node-module-included/node_modules/test/package.json
rename to tests/fixtures/node-module-included/node_modules/test/package.json
diff --git a/src/fixtures/node-module-included/node_modules/test/test.map b/tests/fixtures/node-module-included/node_modules/test/test.html
similarity index 100%
rename from src/fixtures/node-module-included/node_modules/test/test.map
rename to tests/fixtures/node-module-included/node_modules/test/test.html
diff --git a/tests/fixtures/node-module-included/node_modules/test/test.map b/tests/fixtures/node-module-included/node_modules/test/test.map
new file mode 100644
index 0000000..e69de29
diff --git a/src/fixtures/node-module-included/package.json b/tests/fixtures/node-module-included/package.json
similarity index 100%
rename from src/fixtures/node-module-included/package.json
rename to tests/fixtures/node-module-included/package.json
diff --git a/tests/fixtures/node-module-missing-conditional/function.js b/tests/fixtures/node-module-missing-conditional/function.js
new file mode 100644
index 0000000..3a1a3b8
--- /dev/null
+++ b/tests/fixtures/node-module-missing-conditional/function.js
@@ -0,0 +1,6 @@
+try {
+  // eslint-disable-next-line import/no-unassigned-import, import/no-unresolved
+  require('encoding')
+} catch (error) {}
+
+module.exports = true
diff --git a/src/fixtures/node-module-included/function.js b/tests/fixtures/node-module-missing-deep/function.js
similarity index 100%
rename from src/fixtures/node-module-included/function.js
rename to tests/fixtures/node-module-missing-deep/function.js
diff --git a/src/fixtures/node-module-missing-deep/node_modules/test/index.js b/tests/fixtures/node-module-missing-deep/node_modules/test/index.js
similarity index 100%
rename from src/fixtures/node-module-missing-deep/node_modules/test/index.js
rename to tests/fixtures/node-module-missing-deep/node_modules/test/index.js
diff --git a/src/fixtures/node-module-missing-deep/node_modules/test/package.json b/tests/fixtures/node-module-missing-deep/node_modules/test/package.json
similarity index 100%
rename from src/fixtures/node-module-missing-deep/node_modules/test/package.json
rename to tests/fixtures/node-module-missing-deep/node_modules/test/package.json
diff --git a/src/fixtures/node-module-missing-deep/package.json b/tests/fixtures/node-module-missing-deep/package.json
similarity index 100%
rename from src/fixtures/node-module-missing-deep/package.json
rename to tests/fixtures/node-module-missing-deep/package.json
diff --git a/tests/fixtures/node-module-missing-optional/function.js b/tests/fixtures/node-module-missing-optional/function.js
new file mode 100644
index 0000000..c5e76b2
--- /dev/null
+++ b/tests/fixtures/node-module-missing-optional/function.js
@@ -0,0 +1,6 @@
+try {
+  // eslint-disable-next-line import/no-unresolved, import/no-unassigned-import
+  require('consistent-ids')
+} catch (error) {}
+
+module.exports = true
diff --git a/src/fixtures/node-module-missing-optional/package.json b/tests/fixtures/node-module-missing-optional/package.json
similarity index 100%
rename from src/fixtures/node-module-missing-optional/package.json
rename to tests/fixtures/node-module-missing-optional/package.json
diff --git a/tests/fixtures/node-module-missing-package/function.js b/tests/fixtures/node-module-missing-package/function.js
new file mode 100644
index 0000000..0726a57
--- /dev/null
+++ b/tests/fixtures/node-module-missing-package/function.js
@@ -0,0 +1,2 @@
+// eslint-disable-next-line import/no-unresolved
+module.exports = require('does-not-exist')
diff --git a/src/fixtures/node-module-missing-package/package.json b/tests/fixtures/node-module-missing-package/package.json
similarity index 100%
rename from src/fixtures/node-module-missing-package/package.json
rename to tests/fixtures/node-module-missing-package/package.json
diff --git a/tests/fixtures/node-module-missing/function.js b/tests/fixtures/node-module-missing/function.js
new file mode 100644
index 0000000..0726a57
--- /dev/null
+++ b/tests/fixtures/node-module-missing/function.js
@@ -0,0 +1,2 @@
+// eslint-disable-next-line import/no-unresolved
+module.exports = require('does-not-exist')
diff --git a/src/fixtures/node-module-next-on-netlify/node_modules/next/dist/compiled/semver.js b/tests/fixtures/node-module-next-on-netlify/node_modules/next/dist/compiled/semver.js
similarity index 100%
rename from src/fixtures/node-module-next-on-netlify/node_modules/next/dist/compiled/semver.js
rename to tests/fixtures/node-module-next-on-netlify/node_modules/next/dist/compiled/semver.js
diff --git a/src/fixtures/node-module-next-on-netlify/node_modules/next/dist/next-server/lib/constants.js b/tests/fixtures/node-module-next-on-netlify/node_modules/next/dist/next-server/lib/constants.js
similarity index 100%
rename from src/fixtures/node-module-next-on-netlify/node_modules/next/dist/next-server/lib/constants.js
rename to tests/fixtures/node-module-next-on-netlify/node_modules/next/dist/next-server/lib/constants.js
diff --git a/src/fixtures/node-module-next-on-netlify/node_modules/next/dist/other.js b/tests/fixtures/node-module-next-on-netlify/node_modules/next/dist/other.js
similarity index 100%
rename from src/fixtures/node-module-next-on-netlify/node_modules/next/dist/other.js
rename to tests/fixtures/node-module-next-on-netlify/node_modules/next/dist/other.js
diff --git a/src/fixtures/node-module-next-on-netlify/node_modules/next/index.js b/tests/fixtures/node-module-next-on-netlify/node_modules/next/index.js
similarity index 100%
rename from src/fixtures/node-module-next-on-netlify/node_modules/next/index.js
rename to tests/fixtures/node-module-next-on-netlify/node_modules/next/index.js
diff --git a/src/fixtures/node-module-next-on-netlify/node_modules/next/package.json b/tests/fixtures/node-module-next-on-netlify/node_modules/next/package.json
similarity index 100%
rename from src/fixtures/node-module-next-on-netlify/node_modules/next/package.json
rename to tests/fixtures/node-module-next-on-netlify/node_modules/next/package.json
diff --git a/tests/fixtures/node-module-next/function.js b/tests/fixtures/node-module-next/function.js
new file mode 100644
index 0000000..f8bd52f
--- /dev/null
+++ b/tests/fixtures/node-module-next/function.js
@@ -0,0 +1,4 @@
+// eslint-disable-next-line import/no-unassigned-import, import/no-extraneous-dependencies, node/no-extraneous-require
+require('next/dist/next-server/lib/constants')
+
+module.exports = true
diff --git a/src/fixtures/node-module-next/node_modules/next/dist/compiled/semver.js b/tests/fixtures/node-module-next/node_modules/next/dist/compiled/semver.js
similarity index 100%
rename from src/fixtures/node-module-next/node_modules/next/dist/compiled/semver.js
rename to tests/fixtures/node-module-next/node_modules/next/dist/compiled/semver.js
diff --git a/src/fixtures/node-module-next/node_modules/next/dist/next-server/lib/constants.js b/tests/fixtures/node-module-next/node_modules/next/dist/next-server/lib/constants.js
similarity index 100%
rename from src/fixtures/node-module-next/node_modules/next/dist/next-server/lib/constants.js
rename to tests/fixtures/node-module-next/node_modules/next/dist/next-server/lib/constants.js
diff --git a/src/fixtures/node-module-next/node_modules/next/dist/other.js b/tests/fixtures/node-module-next/node_modules/next/dist/other.js
similarity index 100%
rename from src/fixtures/node-module-next/node_modules/next/dist/other.js
rename to tests/fixtures/node-module-next/node_modules/next/dist/other.js
diff --git a/src/fixtures/node-module-next/node_modules/next/index.js b/tests/fixtures/node-module-next/node_modules/next/index.js
similarity index 100%
rename from src/fixtures/node-module-next/node_modules/next/index.js
rename to tests/fixtures/node-module-next/node_modules/next/index.js
diff --git a/src/fixtures/node-module-next/node_modules/next/package.json b/tests/fixtures/node-module-next/node_modules/next/package.json
similarity index 100%
rename from src/fixtures/node-module-next/node_modules/next/package.json
rename to tests/fixtures/node-module-next/node_modules/next/package.json
diff --git a/src/fixtures/node-module-path/function.js b/tests/fixtures/node-module-path/function.js
similarity index 100%
rename from src/fixtures/node-module-path/function.js
rename to tests/fixtures/node-module-path/function.js
diff --git a/tests/fixtures/node-module-peer-not-optional/function.js b/tests/fixtures/node-module-peer-not-optional/function.js
new file mode 100644
index 0000000..0e69a10
--- /dev/null
+++ b/tests/fixtures/node-module-peer-not-optional/function.js
@@ -0,0 +1,6 @@
+try {
+  // eslint-disable-next-line import/no-unassigned-import, import/no-unresolved
+  require('consistent-ids')
+} catch (error) {}
+
+module.exports = true
diff --git a/src/fixtures/node-module-peer-not-optional/package.json b/tests/fixtures/node-module-peer-not-optional/package.json
similarity index 100%
rename from src/fixtures/node-module-peer-not-optional/package.json
rename to tests/fixtures/node-module-peer-not-optional/package.json
diff --git a/tests/fixtures/node-module-peer-optional-none/function.js b/tests/fixtures/node-module-peer-optional-none/function.js
new file mode 100644
index 0000000..0e69a10
--- /dev/null
+++ b/tests/fixtures/node-module-peer-optional-none/function.js
@@ -0,0 +1,6 @@
+try {
+  // eslint-disable-next-line import/no-unassigned-import, import/no-unresolved
+  require('consistent-ids')
+} catch (error) {}
+
+module.exports = true
diff --git a/src/fixtures/node-module-peer-optional-none/package.json b/tests/fixtures/node-module-peer-optional-none/package.json
similarity index 100%
rename from src/fixtures/node-module-peer-optional-none/package.json
rename to tests/fixtures/node-module-peer-optional-none/package.json
diff --git a/tests/fixtures/node-module-peer-optional/function.js b/tests/fixtures/node-module-peer-optional/function.js
new file mode 100644
index 0000000..0e69a10
--- /dev/null
+++ b/tests/fixtures/node-module-peer-optional/function.js
@@ -0,0 +1,6 @@
+try {
+  // eslint-disable-next-line import/no-unassigned-import, import/no-unresolved
+  require('consistent-ids')
+} catch (error) {}
+
+module.exports = true
diff --git a/src/fixtures/node-module-peer-optional/package.json b/tests/fixtures/node-module-peer-optional/package.json
similarity index 100%
rename from src/fixtures/node-module-peer-optional/package.json
rename to tests/fixtures/node-module-peer-optional/package.json
diff --git a/src/fixtures/node-module-scope/function.js b/tests/fixtures/node-module-scope/function.js
similarity index 100%
rename from src/fixtures/node-module-scope/function.js
rename to tests/fixtures/node-module-scope/function.js
diff --git a/tests/fixtures/node-module-typescript-types/function.js b/tests/fixtures/node-module-typescript-types/function.js
new file mode 100644
index 0000000..d0cabd6
--- /dev/null
+++ b/tests/fixtures/node-module-typescript-types/function.js
@@ -0,0 +1,6 @@
+try {
+  // eslint-disable-next-line import/no-unresolved, import/no-unassigned-import
+  require('@types/node')
+} catch (error) {}
+
+module.exports = true
diff --git a/src/fixtures/node-module/function.js b/tests/fixtures/node-module/function.js
similarity index 100%
rename from src/fixtures/node-module/function.js
rename to tests/fixtures/node-module/function.js
diff --git a/src/fixtures/rust-simple/hello-world b/tests/fixtures/rust-simple/hello-world
similarity index 100%
rename from src/fixtures/rust-simple/hello-world
rename to tests/fixtures/rust-simple/hello-world
diff --git a/tests/fixtures/side-module/function.js b/tests/fixtures/side-module/function.js
new file mode 100644
index 0000000..ef5b06a
--- /dev/null
+++ b/tests/fixtures/side-module/function.js
@@ -0,0 +1,3 @@
+require('@prisma/client') && require('.prisma/client')
+
+module.exports = true
diff --git a/src/fixtures/side-module/node_modules/.prisma/client/index.js b/tests/fixtures/side-module/node_modules/.prisma/client/index.js
similarity index 100%
rename from src/fixtures/side-module/node_modules/.prisma/client/index.js
rename to tests/fixtures/side-module/node_modules/.prisma/client/index.js
diff --git a/src/fixtures/side-module/node_modules/@prisma/client/index.js b/tests/fixtures/side-module/node_modules/@prisma/client/index.js
similarity index 100%
rename from src/fixtures/side-module/node_modules/@prisma/client/index.js
rename to tests/fixtures/side-module/node_modules/@prisma/client/index.js
diff --git a/src/fixtures/side-module/node_modules/@prisma/client/package.json b/tests/fixtures/side-module/node_modules/@prisma/client/package.json
similarity index 100%
rename from src/fixtures/side-module/node_modules/@prisma/client/package.json
rename to tests/fixtures/side-module/node_modules/@prisma/client/package.json
diff --git a/src/fixtures/side-module/package.json b/tests/fixtures/side-module/package.json
similarity index 100%
rename from src/fixtures/side-module/package.json
rename to tests/fixtures/side-module/package.json
diff --git a/src/fixtures/simple/function.js b/tests/fixtures/simple/function.js
similarity index 100%
rename from src/fixtures/simple/function.js
rename to tests/fixtures/simple/function.js
diff --git a/tests/fixtures/symlinks/function/function.js b/tests/fixtures/symlinks/function/function.js
new file mode 100644
index 0000000..35eb3d0
--- /dev/null
+++ b/tests/fixtures/symlinks/function/function.js
@@ -0,0 +1,2 @@
+// eslint-disable-next-line import/no-unresolved
+module.exports = require('./file')
diff --git a/src/helpers/sha.js b/tests/helpers/sha.js
similarity index 100%
rename from src/helpers/sha.js
rename to tests/helpers/sha.js
diff --git a/src/main.test.js b/tests/main.js
similarity index 99%
rename from src/main.test.js
rename to tests/main.js
index ad4a27d..3499b9b 100644
--- a/src/main.test.js
+++ b/tests/main.js
@@ -11,9 +11,10 @@ const execa = require('execa')
 const pathExists = require('path-exists')
 const { dir: getTmpDir, tmpName } = require('tmp-promise')
 
+const { zipFunction, listFunctions, listFunctionsFiles } = require('..')
+
 const { zipNode, zipFixture, unzipFiles, zipCheckFunctions, FIXTURES_DIR } = require('./helpers/main')
 const { computeSha1 } = require('./helpers/sha')
-const { zipFunction, listFunctions, listFunctionsFiles } = require('./main')
 
 const pReadFile = promisify(readFile)
 const pChmod = promisify(chmod)