-
-
Notifications
You must be signed in to change notification settings - Fork 601
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore(test): add migrate test * chore(lint): revert change * chore(test): moved to typescript migrate tests * tests(ts): moved module concatenation plugin to ts * tests(migrate): moved to typescript * tests(webpack-scaffold): moved to typescript * tests(migrate): clean js text fixtures * tests(migrate): update babel-loader test * tests(migrate): update babel-loader snapshot * tests(utils): move tests to TS (#688) * chore(test): add migrate test * chore(lint): revert change * chore(test): moved to typescript migrate tests * tests(ts): moved module concatenation plugin to ts * tests(migrate): moved to typescript * tests(webpack-scaffold): moved to typescript * tests(utils): copy fixtures to __tests_ * tests(utils): move package-manager.test.js to TS * tests(utils): move validate-identifier.test.js to TS * tests(utils): move resolve-packages.test.js to TS * tests(utils): is-local-path.test.js to TS * tests(utils): move npm-exists.test.js to TS * tests(utils): move ast-utils.test.js to TS * tests(utils): WIP-test-cases * tests(utils): move recursive-parser.test.js to TS * tests(utils): move npm-package-exists.test.js to TS * tests(utils): cleanup .js , __fixtures__ and __snapshots__ files * chore(utils): clean console recursive-parser.test.ts * chore(utils): make options param optional * chore: use INode in ast-utils.test.ts * tests(migrate): adds interface ILazyTransformObject * chore(commitlint): remove deprecated lang rule * chore(typings): fix tslint error * tests(migration): refactor dirName in a variable * tests(migrate): refactor dirName in variable 2 * tests(migrate): import path.resolve & add rootPath variable * tests(utils): adds type in forEach * tests(migrate): refactor resolve.test * chore(tests): enable ts in tests * chore(tests): remove unwanted script
- Loading branch information
Showing
168 changed files
with
1,502 additions
and
1,335 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { transform, transformations } from "../migrate"; | ||
|
||
const input = ` | ||
module.exports = { | ||
devtool: 'eval', | ||
entry: [ | ||
'./src/index' | ||
], | ||
output: { | ||
path: path.join(__dirname, 'dist'), | ||
filename: 'index.js' | ||
}, | ||
module: { | ||
loaders: [{ | ||
test: /.js$/, | ||
loaders: ['babel'], | ||
include: path.join(__dirname, 'src') | ||
}] | ||
}, | ||
resolve: { | ||
root: path.resolve('/src'), | ||
modules: ['node_modules'] | ||
}, | ||
plugins: [ | ||
new webpack.optimize.UglifyJsPlugin(), | ||
new webpack.optimize.OccurrenceOrderPlugin() | ||
], | ||
debug: true | ||
}; | ||
`; | ||
|
||
describe("transform", () => { | ||
it("should not transform if no transformations defined", (done) => { | ||
transform(input, []).then((output) => { | ||
expect(output).toMatchSnapshot(input); | ||
done(); | ||
}); | ||
}); | ||
|
||
it("should transform using all transformations", (done) => { | ||
transform(input).then((output) => { | ||
expect(output).toMatchSnapshot(); | ||
done(); | ||
}); | ||
}); | ||
|
||
it("should transform only using specified transformations", (done) => { | ||
transform(input, [transformations.loadersTransform]).then((output) => { | ||
expect(output).toMatchSnapshot(); | ||
done(); | ||
}); | ||
}); | ||
|
||
it("should respect recast options", (done) => { | ||
transform(input, undefined, { | ||
quote: "double", | ||
trailingComma: true, | ||
}).then((output) => { | ||
expect(output).toMatchSnapshot(); | ||
done(); | ||
}); | ||
}); | ||
}); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import defineTest from "@webpack-cli/utils/defineTest"; | ||
import { join } from "path"; | ||
|
||
const dirName: string = join(__dirname, ".."); | ||
|
||
defineTest(dirName, "bannerPlugin", "bannerPlugin-0"); | ||
defineTest(dirName, "bannerPlugin", "bannerPlugin-1"); | ||
defineTest(dirName, "bannerPlugin", "bannerPlugin-2"); |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
32 changes: 32 additions & 0 deletions
32
packages/migrate/commonsChunkPlugin/__tests__/commonsChunkPlugin.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import defineTest from "@webpack-cli/utils/defineTest"; | ||
import { join } from "path"; | ||
|
||
const dirName: string = join(__dirname, ".."); | ||
|
||
defineTest(dirName, "commonsChunkPlugin", "commonsChunkPlugin-0"); | ||
defineTest(dirName, "commonsChunkPlugin", "commonsChunkPlugin-1"); | ||
defineTest(dirName, "commonsChunkPlugin", "commonsChunkPlugin-2"); | ||
defineTest(dirName, "commonsChunkPlugin", "commonsChunkPlugin-3"); | ||
defineTest(dirName, "commonsChunkPlugin", "commonsChunkPlugin-4"); | ||
defineTest(dirName, "commonsChunkPlugin", "commonsChunkPlugin-5"); | ||
defineTest( | ||
dirName, | ||
"commonsChunkPlugin", | ||
"commonsChunkPlugin-6a", | ||
); | ||
defineTest( | ||
dirName, | ||
"commonsChunkPlugin", | ||
"commonsChunkPlugin-6b", | ||
); | ||
defineTest( | ||
dirName, | ||
"commonsChunkPlugin", | ||
"commonsChunkPlugin-6c", | ||
); | ||
defineTest( | ||
dirName, | ||
"commonsChunkPlugin", | ||
"commonsChunkPlugin-6d", | ||
); | ||
defineTest(dirName, "commonsChunkPlugin", "commonsChunkPlugin-7"); |
15 changes: 0 additions & 15 deletions
15
packages/migrate/commonsChunkPlugin/commonsChunkPlugin.test.js
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
packages/migrate/extractTextPlugin/__snapshots__/extractTextPlugin.test.js.snap
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
packages/migrate/extractTextPlugin/__testfixtures__/extractTextPlugin.input.js
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
packages/migrate/extractTextPlugin/__tests__/__snapshots__/extractTextPlugin.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`extractTextPlugin transforms correctly 1`] = ` | ||
"const ExtractTextPlugin = require(\\"extract-text-webpack-plugin\\"); | ||
module.exports = { | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\\\\.css$/, | ||
use: ExtractTextPlugin.extract({ | ||
fallback: 'style-loader', | ||
use: 'css-loader' | ||
}) | ||
} | ||
] | ||
}, | ||
plugins: [new ExtractTextPlugin(\\"styles.css\\")] | ||
}; | ||
" | ||
`; |
13 changes: 13 additions & 0 deletions
13
packages/migrate/extractTextPlugin/__tests__/__testfixtures__/extractTextPlugin.input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const ExtractTextPlugin = require("extract-text-webpack-plugin"); | ||
|
||
module.exports = { | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: ExtractTextPlugin.extract("style-loader", "css-loader") | ||
} | ||
] | ||
}, | ||
plugins: [new ExtractTextPlugin("styles.css")] | ||
}; |
5 changes: 5 additions & 0 deletions
5
packages/migrate/extractTextPlugin/__tests__/extractTextPlugin.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import defineTest from "@webpack-cli/utils/defineTest"; | ||
import { join } from "path"; | ||
|
||
const dirName: string = join(__dirname, ".."); | ||
defineTest(dirName, "extractTextPlugin"); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions
25
packages/migrate/loaderOptionsPlugin/__tests__/loaderOptionsPlugin.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import defineTest from "@webpack-cli/utils/defineTest"; | ||
import { join } from "path"; | ||
|
||
const dirName: string = join(__dirname, ".."); | ||
|
||
defineTest( | ||
dirName, | ||
"loaderOptionsPlugin", | ||
"loaderOptionsPlugin-0", | ||
); | ||
defineTest( | ||
dirName, | ||
"loaderOptionsPlugin", | ||
"loaderOptionsPlugin-1", | ||
); | ||
defineTest( | ||
dirName, | ||
"loaderOptionsPlugin", | ||
"loaderOptionsPlugin-2", | ||
); | ||
defineTest( | ||
dirName, | ||
"loaderOptionsPlugin", | ||
"loaderOptionsPlugin-3", | ||
); |
8 changes: 0 additions & 8 deletions
8
packages/migrate/loaderOptionsPlugin/loaderOptionsPlugin.test.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.