New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests(migration): typescript #613
Merged
Changes from 19 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
ef09f3b
chore(test): add migrate test
sendilkumarn fcab1fe
chore(lint): revert change
sendilkumarn 2a86442
chore(test): moved to typescript migrate tests
ematipico 46355b8
tests(ts): moved module concatenation plugin to ts
ematipico 2c73046
tests(migrate): moved to typescript
ematipico aaa28a3
tests(webpack-scaffold): moved to typescript
hemal7735 1a80233
tests(migrate): clean js text fixtures
dhruvdutt 7e60efe
tests(migrate): update babel-loader test
dhruvdutt b4f114b
tests(migrate): update babel-loader snapshot
dhruvdutt dd238a8
tests(utils): move tests to TS (#688)
hemal7735 d6d27dc
tests(migrate): adds interface ILazyTransformObject
misterdev eb7a457
chore(commitlint): remove deprecated lang rule
misterdev 34aa982
chore(typings): fix tslint error
misterdev a98e867
tests(migration): refactor dirName in a variable
misterdev 31220a3
tests(migrate): refactor dirName in variable 2
misterdev 44da46b
tests(migrate): import path.resolve & add rootPath variable
misterdev ef8987d
tests(utils): adds type in forEach
misterdev a2e187f
tests(migrate): refactor resolve.test
misterdev 210ef72
Merge pull request #765 from misterdev/misterdev-ts-test-fixreview
evenstensberg 83a93e0
Merge branch 'master' into ts-test
sendilkumarn 55ecafa
chore(tests): enable ts in tests
sendilkumarn 67788ee
chore(tests): remove unwanted script
sendilkumarn File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense 👍