Sha256: 220e7bab2551a2aaa6acfb4dee1f3a42cb1e95b038ebaaa262a0e1bc73196255

Contents?: true

Size: 913 Bytes

Versions: 16

Compression:

Stored size: 913 Bytes

Contents

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

chdirTestApp()

const getStyleRule = require('../get_style_rule')

describe('getStyleRule', () => {
  afterAll(chdirCwd)

  test('excludes modules by default', () => {
    const cssRule = getStyleRule(/\.(css)$/i)
    const expectation = {
      test: /\.(css)$/i,
      exclude: /\.module\.[a-z]+$/
    }

    expect(cssRule).toMatchObject(expectation)
  })

  test('includes modules if set to true', () => {
    const cssRule = getStyleRule(/\.(scss)$/i, true)
    const expectation = {
      test: /\.(scss)$/i,
      include: /\.module\.[a-z]+$/
    }

    expect(cssRule).toMatchObject(expectation)
  })

  test('adds extra preprocessors if supplied', () => {
    const expectation = [{ foo: 'bar' }]
    const cssRule = getStyleRule(/\.(css)$/i, true, expectation)

    expect(cssRule.use).toMatchObject(expect.arrayContaining(expectation))
  })
})

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
webpacker-3.6.0 package/utils/__tests__/get_style_rule.js
optimacms-0.4.3 spec/dummy/node_modules/@rails/webpacker/package/utils/__tests__/get_style_rule.js
optimacms-0.4.2 spec/dummy/node_modules/@rails/webpacker/package/utils/__tests__/get_style_rule.js
webpacker-4.0.0.pre.3 package/utils/__tests__/get_style_rule.js
webpacker-3.5.5 package/utils/__tests__/get_style_rule.js
webpacker-3.5.3 package/utils/__tests__/get_style_rule.js
webpacker-3.5.2 package/utils/__tests__/get_style_rule.js
webpacker-3.5.1 package/utils/__tests__/get_style_rule.js
webpacker-3.5.0 package/utils/__tests__/get_style_rule.js
webpacker-3.4.3 package/utils/__tests__/get_style_rule.js
webpacker-4.0.0.pre.pre.2 package/utils/__tests__/get_style_rule.js
webpacker-4.0.0.pre.pre.1 package/utils/__tests__/get_style_rule.js
webpacker-3.4.1 package/utils/__tests__/get_style_rule.js
webpacker-3.4.0 package/utils/__tests__/get_style_rule.js
webpacker-3.3.1 package/utils/__tests__/get_style_rule.js
webpacker-3.3.0 package/utils/__tests__/get_style_rule.js