Skip to content

Commit

Permalink
tests: add tests for coffeescript config (#1749)
Browse files Browse the repository at this point in the history
  • Loading branch information
anshumanv committed Aug 17, 2020
1 parent a7c9314 commit 1c52f79
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/config-format/coffee/coffee.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// eslint-disable-next-line node/no-unpublished-require
const { run } = require('../../utils/test-utils');
const { existsSync } = require('fs');
const { resolve } = require('path');

describe('webpack cli', () => {
it('should support coffeescript file as flag', () => {
const { stderr, stdout } = run(__dirname, ['-c', 'webpack.config.coffee'], false);
expect(stderr).toBeFalsy();
expect(stdout).toBeTruthy();
expect(existsSync(resolve(__dirname, 'dist/foo.bundle.js'))).toBeTruthy();
});

it('should load coffeescript file by default', () => {
const { stderr, stdout } = run(__dirname, [], false);
expect(stderr).toBeFalsy();
expect(stdout).toBeTruthy();
expect(existsSync(resolve(__dirname, 'dist/foo.bundle.js'))).toBeTruthy();
});
});
1 change: 1 addition & 0 deletions test/config-format/coffee/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('Sakusa Kiyoomi');
5 changes: 5 additions & 0 deletions test/config-format/coffee/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"coffeescript": "^2.5.1"
}
}
10 changes: 10 additions & 0 deletions test/config-format/coffee/webpack.config.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
path = require 'path'

config =
mode: 'production'
entry: './main.js'
output:
path: path.resolve(__dirname, 'dist')
filename: 'foo.bundle.js'

module.exports = config;

0 comments on commit 1c52f79

Please sign in to comment.