Sha256: df51dc68fa380a0626062e3caf0a1f5812399236cce046c1351cc93e09f3f2d9

Contents?: true

Size: 1.47 KB

Versions: 29

Compression:

Stored size: 1.47 KB

Contents

/* global test expect, describe */

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

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',
        'app/elm'
      ]
    )
  })

  test('should return extensions as listed in app config', () => {
    expect(config.extensions).toEqual([
      '.mjs',
      '.js',
      '.sass',
      '.scss',
      '.css',
      '.module.sass',
      '.module.scss',
      '.module.css',
      '.png',
      '.svg',
      '.gif',
      '.jpeg',
      '.jpg',
      '.elm'
    ])
  })

  test('should return static assets extensions as listed in app config', () => {
    expect(config.static_assets_extensions).toEqual([
      '.jpg',
      '.jpeg',
      '.png',
      '.gif',
      '.tiff',
      '.ico',
      '.svg',
    ])
  })
})

Version data entries

29 entries across 29 versions & 7 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/webpacker-5.4.4/package/__tests__/config.js
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/webpacker-5.4.4/package/__tests__/config.js
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/webpacker-5.4.4/package/__tests__/config.js
jetpacker-0.7.0 package/__tests__/config.js
webpacker-5.4.4 package/__tests__/config.js
jetpacker-0.6.0 package/__tests__/config.js
disco_app-0.16.1 test/dummy/node_modules/@rails/webpacker/package/__tests__/config.js
disco_app-0.15.2 test/dummy/node_modules/@rails/webpacker/package/__tests__/config.js
disco_app-0.18.4 test/dummy/node_modules/@rails/webpacker/package/__tests__/config.js
disco_app-0.18.1 test/dummy/node_modules/@rails/webpacker/package/__tests__/config.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/@rails/webpacker/package/__tests__/config.js
disco_app-0.14.0 test/dummy/node_modules/@rails/webpacker/package/__tests__/config.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/@rails/webpacker/package/__tests__/config.js
webpacker-5.4.3 package/__tests__/config.js
webpacker-5.4.2 package/__tests__/config.js
webpacker-5.4.1 package/__tests__/config.js
webpacker-5.4.0 package/__tests__/config.js
webpacker-5.3.0 package/__tests__/config.js
webpacker-5.2.2 package/__tests__/config.js
tang-0.2.1 spec/tang_app/node_modules/@rails/webpacker/package/__tests__/config.js