Sha256: e4ce8f4cbe9b2f35a90f675b5ad5176b5b9eac6dc43e6baadb806881387e1aae

Contents?: true

Size: 1.16 KB

Versions: 87

Compression:

Stored size: 1.16 KB

Contents

/* global test expect, describe */

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

chdirTestApp()

describe('Env', () => {
  beforeEach(() => jest.resetModules())
  afterAll(chdirCwd)

  test('with NODE_ENV and RAILS_ENV set to development', () => {
    process.env.RAILS_ENV = 'development'
    process.env.NODE_ENV = 'development'
    expect(require('../env')).toEqual({
      railsEnv: 'development',
      nodeEnv: 'development'
    })
  })

  test('with undefined NODE_ENV and RAILS_ENV set to development', () => {
    process.env.RAILS_ENV = 'development'
    delete process.env.NODE_ENV
    expect(require('../env')).toEqual({
      railsEnv: 'development',
      nodeEnv: 'production'
    })
  })

  test('with undefined NODE_ENV and RAILS_ENV', () => {
    delete process.env.NODE_ENV
    delete process.env.RAILS_ENV
    expect(require('../env')).toEqual({
      railsEnv: 'production',
      nodeEnv: 'production'
    })
  })

  test('with a non-standard environment', () => {
    process.env.RAILS_ENV = 'staging'
    process.env.NODE_ENV = 'staging'
    expect(require('../env')).toEqual({
      railsEnv: 'staging',
      nodeEnv: 'production'
    })
  })
})

Version data entries

87 entries across 86 versions & 12 rubygems

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