Sha256: 64af75d8d0bda4b76bd9b0eafe038062314ab10298f7ea7f72760f4a17defe0f

Contents?: true

Size: 1.32 KB

Versions: 14

Compression:

Stored size: 1.32 KB

Contents

/* global test expect, describe */

const { chdirCwd, chdirTestApp, resetEnv } = require('../utils/helpers')
const { resolve } = require('path')

chdirTestApp()

const config = require('../config')

describe('Config', () => {
  beforeEach(() => jest.resetModules() && resetEnv())
  afterAll(chdirCwd)

  test('public path', () => {
    process.env.RAILS_ENV = 'development'
    const config = require('../config')
    expect(config.publicPath).toEqual('/packs/')
  })

  test('public path with asset host', () => {
    process.env.RAILS_ENV = 'development'
    process.env.WEBPACKER_ASSET_HOST = 'http://foo.com/'
    const config = require('../config')
    expect(config.publicPath).toEqual('http://foo.com/packs/')
  })

  test('should return additional paths as listed in app config, with resolved paths', () => {
    expect(config.additional_paths).toEqual([
      'app/assets',
      '/etc/yarn',
      'some.config.js',
      'app/elm'
    ])
  })

  test('should default manifestPath to the public dir', () => {
    expect(config.manifestPath).toEqual(resolve('public/packs/manifest.json'))
  })

  test('should allow overriding manifestPath', () => {
    process.env.WEBPACKER_CONFIG = 'config/webpacker_manifest_path.yml'
    const config = require('../config')
    expect(config.manifestPath).toEqual(resolve('app/packs/manifest.json'))
  })
})

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
shakapacker-6.6.0 package/__tests__/config.js
shakapacker-6.5.6 package/__tests__/config.js
shakapacker-6.5.5 package/__tests__/config.js
shakapacker-6.5.4 package/__tests__/config.js
shakapacker-6.5.3 package/__tests__/config.js
shakapacker-6.5.2 package/__tests__/config.js
shakapacker-6.5.1 package/__tests__/config.js
shakapacker-6.5.0 package/__tests__/config.js
shakapacker-6.4.1 package/__tests__/config.js
shakapacker-6.4.0 package/__tests__/config.js
shakapacker-6.3.0 package/__tests__/config.js
shakapacker-6.3.0.pre.rc.1 package/__tests__/config.js
shakapacker-6.2.1 package/__tests__/config.js
shakapacker-6.2.0 package/__tests__/config.js