Sha256: 59fdaac07b8bac205f7020b9b7389c028bbfd89ea233fac32329bc2071a5b73d

Contents?: true

Size: 1.38 KB

Versions: 14

Compression:

Stored size: 1.38 KB

Contents

/* test expect, describe, afterAll, beforeEach */

const { resolve } = require('path')
const { chdirWebpackerTestApp } = require('../utils/helpers')

const rootPath = process.cwd()
chdirWebpackerTestApp()

describe('Backward Compatibility - Test environment', () => {
  afterAll(() => process.chdir(rootPath))

  describe('toWebpackConfig', () => {
    beforeEach(() => jest.resetModules())

    test('should use test config and production environment', () => {
      process.env.RAILS_ENV = 'test'
      process.env.NODE_ENV = 'test'

      const { generateWebpackConfig } = require('../index')

      const webpackConfig = generateWebpackConfig()

      expect(webpackConfig.output.path).toEqual(resolve('public', 'packs-test'))
      expect(webpackConfig.output.publicPath).toEqual('/packs-test/')
      expect(webpackConfig.devServer).toEqual(undefined)
    })
  })

  describe('globalMutableWebpackConfig', () => {
    beforeEach(() => jest.resetModules())

    test('should use test config and production environment', () => {
      process.env.RAILS_ENV = 'test'
      process.env.NODE_ENV = 'test'

      const { globalMutableWebpackConfig: webpackConfig } = require('../index')

      expect(webpackConfig.output.path).toEqual(resolve('public', 'packs-test'))
      expect(webpackConfig.output.publicPath).toEqual('/packs-test/')
      expect(webpackConfig.devServer).toEqual(undefined)
    })
  })
})

Version data entries

14 entries across 14 versions & 1 rubygems

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