예제 #1
0
def test_project(simpleprj):
    """Test extension initialization."""
    project = WebpackProject(simpleprj)
    assert exists(project.project_path)

    node_modules = join(project.project_path, 'node_modules')
    bundlejs = join(project.project_path, 'dist/bundle.js')

    assert not exists(node_modules)
    project.install()
    assert exists(node_modules)

    assert not exists(bundlejs)
    project.build()
    assert exists(bundlejs)
예제 #2
0
def test_project_no_scripts(brokenprj):
    project = WebpackProject(brokenprj)
    with pytest.raises(RuntimeError):
        project.buildall()
예제 #3
0
def test_project_buildall(simpleprj):
    """Test build all."""
    project = WebpackProject(simpleprj)
    project.buildall()
    assert exists(join(project.project_path, 'node_modules'))
    assert exists(join(project.project_path, 'dist/bundle.js'))
예제 #4
0
def test_project_failed_build(simpleprj):
    # Remove a file necessary for the build
    os.unlink(os.path.join(os.path.dirname(simpleprj), 'index.js'))
    project = WebpackProject(simpleprj)
    with pytest.raises(RuntimeError):
        project.buildall()
예제 #5
0
def watch():
    logger.debug("Watch stuff")
    project_path = './frontend'
    project = WebpackProject(project_path)

    project.run('watch')
예제 #6
0
def build():
    logger.debug("Build stuff")
    project_path = './frontend'
    project = WebpackProject(project_path)

    project.build()