How to use the minimist.webpack function in minimist

To help you get started, we’ve selected a few minimist examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GProst / webpack-clean-obsolete-chunks / test / integration / code-splitting.spec.js View on Github external
'use strict'

const expect = require('chai').expect
const fs = require('fs')
const del = require('del')

const {resultingFileAmount} = require('./test-config').codeSplitting
const {getWebpackConfig, startWebpack} = require('./helper-functions')

const webpackVersion = require('minimist')(process.argv.slice(2)).webpack
if (!webpackVersion)
  throw Error('No webpack version provided!')

describe(`webpack-clean-obsolete-chunks plugin in webpack${webpackVersion} watch mode (code splitting)`, () => {
  const config = getWebpackConfig({webpackVersion, codeSplitting: true})
  const outputFilesDir = config.output.path

  afterEach(() => {
    //removing created directory after tests
    del.sync(outputFilesDir + '/**', {force: true})
  })

  it('SHOULD not delete dynamic chunks after first compilation', (done) => {
    const testFunction = () => {
      const files = fs.readdirSync(outputFilesDir)
      expect(files.length).to.be.equal(resultingFileAmount) //that's not very neat checking
github GProst / webpack-clean-obsolete-chunks / test / integration / generic.spec.js View on Github external
'use strict'

const fs = require('fs')
const del = require('del')
const {
  JSFileToChange, CSSFileToChange, outsideOutputDirectory, JSObsoleteFileMatch, CSSObsoleteFileMatch, JSFileInitialContent,
  JSFileNewContent, CSSFileInitialContent, CSSFileNewContent
} = require('./test-config').common

const webpackVersion = require('minimist')(process.argv.slice(2)).webpack
if (!webpackVersion)
  throw Error('No webpack version provided!')

const {checkDeletedFilesByMatch, getWebpackConfig, startWebpackWatch} = require('./helper-functions')

describe(`webpack-clean-obsolete-chunks plugin in webpack${webpackVersion} watch mode`, () => {
  let fileToChange //the file we are going to change
  let changedFileInitialContent //initial content of the file we are going to change

  let newContent //new content in file we are going to change
  let obsoleteFilesMatch //RegExp that SHOULD match obsolete file names

  let config

  afterEach(() => {
    //restore initial file content
github GProst / webpack-clean-obsolete-chunks / test / integration / child-compilation.spec.js View on Github external
'use strict'

const fs = require('fs')
const del = require('del')
const {
  JSFileToChange, outsideOutputDirectory, JSFileInitialContent, JSFileNewContent
} = require('./test-config').common

const webpackVersion = require('minimist')(process.argv.slice(2)).webpack
if (!webpackVersion)
  throw Error('No webpack version provided!')

const {testFunctions: {checkFilesLength}, getWebpackConfig, startWebpackWatch} = require('./helper-functions')

if (webpackVersion > 2) {
  describe(`webpack-clean-obsolete-chunks plugin in webpack${webpackVersion} watch mode (child compilation)`, () => {
    let fileToChange //the file we are going to change
    let changedFileInitialContent //initial content of the file we are going to change
    let newContent //new content in file we are going to change

    let config

    afterEach(() => {
      //restore initial file content
      fs.writeFileSync(fileToChange, changedFileInitialContent)