Sha256: 273b8d98262229a1d3f626486a2c782fb2cf25c471fc978efa49f3ee7641f83e

Contents?: true

Size: 1.38 KB

Versions: 14

Compression:

Stored size: 1.38 KB

Contents

/* global test expect, describe */

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

const rootPath = process.cwd()
chdirTestApp()

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

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

  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.SHAKAPACKER_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.SHAKAPACKER_CONFIG = 'config/shakapacker_manifest_path.yml'
    const config = require('../config')
    expect(config.manifestPath).toEqual(resolve('app/javascript/manifest.json'))
  })
})

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
shakapacker-7.2.3 package/__tests__/config.js
shakapacker-7.3.0.beta.1 package/__tests__/config.js
shakapacker-7.2.2 package/__tests__/config.js
shakapacker-7.2.1 package/__tests__/config.js
shakapacker-7.2.0 package/__tests__/config.js
shakapacker-7.2.0.rc.0 package/__tests__/config.js
shakapacker-7.1.0 package/__tests__/config.js
shakapacker-7.0.3 package/__tests__/config.js
shakapacker-7.0.2 package/__tests__/config.js
shakapacker-7.0.1 package/__tests__/config.js
shakapacker-7.0.0 package/__tests__/config.js
shakapacker-7.0.0.rc.2 package/__tests__/config.js
shakapacker-7.0.0.rc.1 package/__tests__/config.js
shakapacker-7.0.0.rc.0 package/__tests__/config.js