20 lines
872 B
Python
20 lines
872 B
Python
import json
|
|
import shutil
|
|
import subprocess
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
|
|
class FrontendBuildIsolationTests(unittest.TestCase):
|
|
def test_development_and_production_assets_do_not_collide(self):
|
|
root = Path(__file__).resolve().parents[1]
|
|
script = "import config from './next.config.mjs'; import c from 'next/constants.js'; console.log(JSON.stringify([config(c.PHASE_DEVELOPMENT_SERVER),config(c.PHASE_PRODUCTION_BUILD),config(c.PHASE_PRODUCTION_SERVER)]));"
|
|
result = subprocess.run([shutil.which("node") or "node", "--input-type=module", "-e", script], cwd=root, capture_output=True, text=True, check=True)
|
|
dev, build, start = json.loads(result.stdout)
|
|
self.assertNotEqual(dev["distDir"], build["distDir"])
|
|
self.assertEqual(build["distDir"], start["distDir"])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|