Skip to content

Commit fe62523

Browse files
authored
fix: Upgrade to Jest 19 (#71)
* fix: Upgraded to Jest 19 * Removed unnecessary Jest config * fix: temporary use absolute paths for mock requires * build: Generate coverage report
1 parent b9d22c9 commit fe62523

File tree

17 files changed

+139
-131
lines changed

17 files changed

+139
-131
lines changed

__mocks__/inquirer/initialize.mock.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const Rx = require('rx');
44
const got = require('got');
55
const questions = require('../../lib/utils/initial-questions');
66
//eslint-disable-next-line
7-
const prompt = require('prompt.mock');
7+
const prompt = require('./prompt.mock');
88
const initialConfig = jest.genMockFromModule('../../lib/utils/initial-config');
99

1010

lib/inquirer-prompt.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
describe('inquirer-prompt', () => {
55
//eslint-disable-next-line
6-
const {init} = require('initialize.mock');
6+
const {init} = require('../__mocks__/inquirer/initialize.mock');
77

88
it('should provide with basic options if no argument is supplied to init', async () => {
99
let itInits = await init(null, {

lib/parser/validate-options.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
describe('validate-options', () => {
44
//eslint-disable-next-line
5-
const {validateOptions} = require('validate-options.mock');
5+
const {validateOptions} = require('../../__mocks__/parser/validate-options.mock');
66

77
it('should throw on fake paths', () => {
88
expect(() => {

lib/transformations/__snapshots__/index.test.js.snap

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
13
exports[`transform should respect recast options 1`] = `
24
"
35
module.exports = {
4-
devtool: \'eval\',
6+
devtool: 'eval',
57
entry: [
6-
\'./src/index\'
8+
'./src/index'
79
],
810
output: {
9-
path: path.join(__dirname, \'dist\'),
10-
filename: \'index.js\'
11+
path: path.join(__dirname, 'dist'),
12+
filename: 'index.js'
1113
},
1214
module: {
1315
rules: [{
1416
test: /.js$/,
15-
use: \"babel\",
16-
include: path.join(__dirname, \'src\')
17+
use: \\"babel\\",
18+
include: path.join(__dirname, 'src')
1719
}]
1820
},
1921
resolve: {
20-
modules: [\'node_modules\', path.resolve(\'/src\')],
22+
modules: ['node_modules', path.resolve('/src')],
2123
},
2224
plugins: [
2325
new webpack.optimize.UglifyJsPlugin({
2426
sourceMap: true,
2527
}),
2628
new webpack.optimize.LoaderOptionsPlugin({
27-
\"debug\": true,
28-
\"minimize\": true,
29+
\\"debug\\": true,
30+
\\"minimize\\": true,
2931
})
3032
],
3133
debug: true
@@ -36,24 +38,24 @@ module.exports = {
3638
exports[`transform should transform only using specified transformations 1`] = `
3739
"
3840
module.exports = {
39-
devtool: \'eval\',
41+
devtool: 'eval',
4042
entry: [
41-
\'./src/index\'
43+
'./src/index'
4244
],
4345
output: {
44-
path: path.join(__dirname, \'dist\'),
45-
filename: \'index.js\'
46+
path: path.join(__dirname, 'dist'),
47+
filename: 'index.js'
4648
},
4749
module: {
4850
rules: [{
4951
test: /.js$/,
50-
use: [\'babel\'],
51-
include: path.join(__dirname, \'src\')
52+
use: ['babel'],
53+
include: path.join(__dirname, 'src')
5254
}]
5355
},
5456
resolve: {
55-
root: path.resolve(\'/src\'),
56-
modules: [\'node_modules\']
57+
root: path.resolve('/src'),
58+
modules: ['node_modules']
5759
},
5860
plugins: [
5961
new webpack.optimize.UglifyJsPlugin(),
@@ -67,31 +69,31 @@ module.exports = {
6769
exports[`transform should transform using all transformations 1`] = `
6870
"
6971
module.exports = {
70-
devtool: \'eval\',
72+
devtool: 'eval',
7173
entry: [
72-
\'./src/index\'
74+
'./src/index'
7375
],
7476
output: {
75-
path: path.join(__dirname, \'dist\'),
76-
filename: \'index.js\'
77+
path: path.join(__dirname, 'dist'),
78+
filename: 'index.js'
7779
},
7880
module: {
7981
rules: [{
8082
test: /.js$/,
81-
use: \'babel\',
82-
include: path.join(__dirname, \'src\')
83+
use: 'babel',
84+
include: path.join(__dirname, 'src')
8385
}]
8486
},
8587
resolve: {
86-
modules: [\'node_modules\', path.resolve(\'/src\')]
88+
modules: ['node_modules', path.resolve('/src')]
8789
},
8890
plugins: [
8991
new webpack.optimize.UglifyJsPlugin({
9092
sourceMap: true
9193
}),
9294
new webpack.optimize.LoaderOptionsPlugin({
93-
\'debug\': true,
94-
\'minimize\': true
95+
'debug': true,
96+
'minimize': true
9597
})
9698
],
9799
debug: true

lib/transformations/__snapshots__/utils.test.js.snap

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
13
exports[`utils createLiteral should create basic literal 1`] = `
24
Object {
35
"comments": null,
@@ -20,52 +22,52 @@ Object {
2022

2123
exports[`utils createOrUpdatePluginByName should add an object as an argument 1`] = `
2224
"[new Plugin({
23-
\"foo\": true
25+
\\"foo\\": true
2426
})]"
2527
`;
2628

2729
exports[`utils createOrUpdatePluginByName should create a new plugin with arguments 1`] = `
2830
"{ plugins: [new Plugin({
29-
\"foo\": \"bar\"
31+
\\"foo\\": \\"bar\\"
3032
})] }"
3133
`;
3234

3335
exports[`utils createOrUpdatePluginByName should create a new plugin without arguments 1`] = `"{ plugins: [new Plugin()] }"`;
3436

3537
exports[`utils createOrUpdatePluginByName should merge options objects 1`] = `
3638
"[new Plugin({
37-
\"foo\": false,
38-
\"bar\": \"baz\",
39-
\"baz-long\": true
39+
\\"foo\\": false,
40+
\\"bar\\": \\"baz\\",
41+
\\"baz-long\\": true
4042
})]"
4143
`;
4244

4345
exports[`utils createProperty should create properties for Boolean 1`] = `
4446
"{
45-
\"foo\": true
47+
\\"foo\\": true
4648
}"
4749
`;
4850

4951
exports[`utils createProperty should create properties for Number 1`] = `
5052
"{
51-
\"foo\": -1
53+
\\"foo\\": -1
5254
}"
5355
`;
5456

5557
exports[`utils createProperty should create properties for String 1`] = `
5658
"{
57-
\"foo\": \"bar\"
59+
\\"foo\\": \\"bar\\"
5860
}"
5961
`;
6062

6163
exports[`utils createProperty should create properties for complex keys 1`] = `
6264
"{
63-
\"foo-bar\": \"bar\"
65+
\\"foo-bar\\": \\"bar\\"
6466
}"
6567
`;
6668

6769
exports[`utils createProperty should create properties for non-literal keys 1`] = `
6870
"{
69-
1: \"bar\"
71+
1: \\"bar\\"
7072
}"
7173
`;

lib/transformations/bannerPlugin/__snapshots__/bannerPlugin.test.js.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
13
exports[`bannerPlugin transforms correctly using "bannerPlugin-0" data 1`] = `
24
"module.exports = {
35
plugins: [
46
new webpack.BannerPlugin({
57
raw: true,
68
entryOnly: true,
7-
\'banner\': \'Banner\'
9+
'banner': 'Banner'
810
})
911
]
1012
}

lib/transformations/extractTextPlugin/__snapshots__/extractTextPlugin.test.js.snap

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
13
exports[`extractTextPlugin transforms correctly 1`] = `
2-
"let ExtractTextPlugin = require(\'extract-text-webpack-plugin\');
3-
let HTMLWebpackPlugin = require(\'html-webpack-plugin\');
4+
"let ExtractTextPlugin = require('extract-text-webpack-plugin');
5+
let HTMLWebpackPlugin = require('html-webpack-plugin');
46
57
module.export = {
68
module: {
79
rules: [
810
{
9-
test: /\\.css$/,
11+
test: /\\\\.css$/,
1012
use: ExtractTextPlugin.extract({
11-
\'fallback\': \'style-loader\',
12-
\'use\': \'css-loader\'
13+
'fallback': 'style-loader',
14+
'use': 'css-loader'
1315
})
1416
}
1517
]
1618
},
1719
plugins: [
18-
new ExtractTextPlugin(\"styles.css\"),
20+
new ExtractTextPlugin(\\"styles.css\\"),
1921
]
2022
}
2123
"

lib/transformations/loaderOptionsPlugin/__snapshots__/loaderOptionsPlugin.test.js.snap

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
13
exports[`loaderOptionsPlugin transforms correctly using "loaderOptionsPlugin-0" data 1`] = `
24
"// Do not create LoaderOptionsPlugin is not necessary
35
module.exports = {
@@ -14,22 +16,22 @@ exports[`loaderOptionsPlugin transforms correctly using "loaderOptionsPlugin-1"
1416
plugins: [
1517
new webpack.optimize.UglifyJsPlugin(),
1618
new webpack.optimize.LoaderOptionsPlugin({
17-
foo: \'bar\',
18-
\'debug\': true,
19-
\'minimize\': true
19+
foo: 'bar',
20+
'debug': true,
21+
'minimize': true
2022
})
2123
]
2224
}
2325
"
2426
`;
2527

2628
exports[`loaderOptionsPlugin transforms correctly using "loaderOptionsPlugin-2" data 1`] = `
27-
"// Don\'t modify LoaderOptionsPlugin
29+
"// Don't modify LoaderOptionsPlugin
2830
module.exports = {
2931
plugins: [
3032
new SomePlugin(),
3133
new webpack.optimize.LoaderOptionsPlugin({
32-
foo: \'bar\'
34+
foo: 'bar'
3335
})
3436
]
3537
}

0 commit comments

Comments
 (0)