def test_missing_stats_file(self):
     os.remove(settings.WEBPACK_LOADER['STATS_FILE'])
     try:
         get_assets()
     except IOError as e:
         expected = 'Error reading {}. Are you sure webpack has generated the file and the path is correct?'.format(settings.WEBPACK_LOADER['STATS_FILE'])
         self.assertIn(expected, str(e))
Exemplo n.º 2
0
 def test_missing_stats_file(self):
     os.remove(settings.WEBPACK_LOADER['STATS_FILE'])
     try:
         get_assets()
     except IOError as e:
         expected = 'Error reading {}. Are you sure webpack has generated the file and the path is correct?'.format(
             settings.WEBPACK_LOADER['STATS_FILE'])
         self.assertIn(expected, str(e))
Exemplo n.º 3
0
 def test_missing_stats_file(self):
     os.remove(settings.WEBPACK_LOADER[DEFAULT_CONFIG]["STATS_FILE"])
     try:
         get_assets(get_config(DEFAULT_CONFIG))
     except IOError as e:
         expected = "Error reading {}. Are you sure webpack has generated the file and the path is correct?".format(
             settings.WEBPACK_LOADER[DEFAULT_CONFIG]["STATS_FILE"]
         )
         self.assertIn(expected, str(e))
Exemplo n.º 4
0
    def test_simple_and_css_extract(self):
        self.compile_bundles("webpack.config.simple.js")
        assets = get_assets(get_config(DEFAULT_CONFIG))
        self.assertEqual(assets["status"], "done")
        self.assertIn("chunks", assets)

        chunks = assets["chunks"]
        self.assertIn("main", chunks)
        self.assertEqual(len(chunks), 1)

        main = chunks["main"]
        self.assertEqual(main[0]["path"], os.path.join(settings.BASE_DIR, "assets/bundles/main.js"))
        self.assertEqual(main[1]["path"], os.path.join(settings.BASE_DIR, "assets/bundles/styles.css"))
    def test_simple_and_css_extract(self):
        self.compile_bundles('webpack.config.simple.js')
        assets = get_assets()
        self.assertEqual(assets['status'], 'done')
        self.assertIn('chunks', assets)

        chunks = assets['chunks']
        self.assertIn('main', chunks)
        self.assertEquals(len(chunks), 1)

        main = chunks['main']
        self.assertEqual(main[0]['path'], os.path.join(settings.BASE_DIR, 'assets/bundles/main.js'))
        self.assertEqual(main[1]['path'], os.path.join(settings.BASE_DIR, 'assets/bundles/styles.css'))
Exemplo n.º 6
0
    def test_code_spliting(self):
        self.compile_bundles("webpack.config.split.js")
        assets = get_assets(get_config(DEFAULT_CONFIG))
        self.assertEqual(assets["status"], "done")
        self.assertIn("chunks", assets)

        chunks = assets["chunks"]
        self.assertIn("main", chunks)
        self.assertEquals(len(chunks), 2)

        main = chunks["main"]
        self.assertEqual(main[0]["path"], os.path.join(settings.BASE_DIR, "assets/bundles/main.js"))

        vendor = chunks["vendor"]
        self.assertEqual(vendor[0]["path"], os.path.join(settings.BASE_DIR, "assets/bundles/vendor.js"))
    def test_code_spliting(self):
        self.compile_bundles('webpack.config.split.js')
        assets = get_assets()
        self.assertEqual(assets['status'], 'done')
        self.assertIn('chunks', assets)

        chunks = assets['chunks']
        self.assertIn('main', chunks)
        self.assertEquals(len(chunks), 2)

        main = chunks['main']
        self.assertEqual(main[0]['path'], os.path.join(settings.BASE_DIR, 'assets/bundles/main.js'))

        vendor = chunks['vendor']
        self.assertEqual(vendor[0]['path'], os.path.join(settings.BASE_DIR, 'assets/bundles/vendor.js'))
Exemplo n.º 8
0
    def test_simple_and_css_extract(self):
        self.compile_bundles('webpack.config.simple.js')
        assets = get_assets()
        self.assertEqual(assets['status'], 'done')
        self.assertIn('chunks', assets)

        chunks = assets['chunks']
        self.assertIn('main', chunks)
        self.assertEquals(len(chunks), 1)

        main = chunks['main']
        self.assertEqual(
            main[0]['path'],
            os.path.join(settings.BASE_DIR, 'assets/bundles/main.js'))
        self.assertEqual(
            main[1]['path'],
            os.path.join(settings.BASE_DIR, 'assets/bundles/styles.css'))
Exemplo n.º 9
0
    def test_code_spliting(self):
        self.compile_bundles('webpack.config.split.js')
        assets = get_assets()
        self.assertEqual(assets['status'], 'done')
        self.assertIn('chunks', assets)

        chunks = assets['chunks']
        self.assertIn('main', chunks)
        self.assertEquals(len(chunks), 2)

        main = chunks['main']
        self.assertEqual(
            main[0]['path'],
            os.path.join(settings.BASE_DIR, 'assets/bundles/main.js'))

        vendor = chunks['vendor']
        self.assertEqual(
            vendor[0]['path'],
            os.path.join(settings.BASE_DIR, 'assets/bundles/vendor.js'))
Exemplo n.º 10
0
 def test_static_url(self):
     self.compile_bundles('webpack.config.publicPath.js')
     assets = get_assets()
     self.assertEqual(assets['status'], 'done')
     self.assertEqual(assets['publicPath'],
                      'http://custom-static-host.com/')
Exemplo n.º 11
0
 def test_static_url(self):
     self.compile_bundles("webpack.config.publicPath.js")
     assets = get_assets(get_config(DEFAULT_CONFIG))
     self.assertEqual(assets["status"], "done")
     self.assertEqual(assets["publicPath"], "http://custom-static-host.com/")
Exemplo n.º 12
0
 def test_static_url(self):
     self.compile_bundles('webpack.config.publicPath.js')
     assets = get_assets(get_config(DEFAULT_CONFIG))
     self.assertEqual(assets['status'], 'done')
     self.assertEqual(assets['publicPath'], 'http://custom-static-host.com/')