Skip to content

Commit

Permalink
remove test assertions webpack2,3
Browse files Browse the repository at this point in the history
  • Loading branch information
bholloway committed May 20, 2021
1 parent 0c50d7f commit 5ff7a18
Show file tree
Hide file tree
Showing 14 changed files with 109 additions and 1,131 deletions.
35 changes: 11 additions & 24 deletions test/cases/absolute-asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module.exports = test(
// absolute urls are processed
testRoot('')(
all(buildDevNormal, buildProdNormal)(
onlyMeta('meta.version.webpack < 5')(
onlyMeta('meta.version.webpack == 4')(
assertWebpackNotOk,
assertAssetError
),
Expand Down Expand Up @@ -115,7 +115,7 @@ module.exports = test(
assertNoErrors,
assertDebugMessages,
assertCssSourceMapComment(true),
compose(onlyMeta('meta.engine == "postcss" && meta.version.webpack < 5'), assertCssContent, outdent)`
compose(onlyMeta('meta.version.webpack == 4'), assertCssContent, outdent)`
.some-class-name {
single-quoted: url(d68e763c825dc0e388929ae1b375ce18.jpg);
double-quoted: url(d68e763c825dc0e388929ae1b375ce18.jpg);
Expand All @@ -126,7 +126,7 @@ module.exports = test(
.another-class-name {
display: block; }
`,
compose(onlyMeta('meta.engine == "postcss" && meta.version.webpack >= 5'), assertCssContent, outdent)`
compose(onlyMeta('meta.version.webpack >= 5'), assertCssContent, outdent)`
.some-class-name {
single-quoted: url(9eb57a84abbf8abc636d0faa71f9a800.jpg);
double-quoted: url(9eb57a84abbf8abc636d0faa71f9a800.jpg);
Expand All @@ -143,7 +143,7 @@ module.exports = test(
assertNoErrors,
assertDebugMessages,
assertCssSourceMapComment(true),
compose(onlyMeta('meta.engine == "postcss"'), assertCssContent, outdent)`
compose(assertCssContent, outdent)`
.some-class-name {
single-quoted: url("../images/img.jpg");
double-quoted: url("../images/img.jpg");
Expand All @@ -159,13 +159,10 @@ module.exports = test(
assertWebpackOk,
assertNoErrors,
assertDebugMessages,
onlyMeta('meta.version.webpack < 4')(
assertCssSourceMapComment(true)
),
onlyMeta('meta.version.webpack >= 4')(
assertCssSourceMapComment(false)
),
compose(onlyMeta('meta.version.webpack < 5'), assertCssContent, trim)`
compose(onlyMeta('meta.version.webpack == 4'), assertCssContent, trim)`
.some-class-name{single-quoted:url(d68e763c825dc0e388929ae1b375ce18.jpg);double-quoted:
url(d68e763c825dc0e388929ae1b375ce18.jpg);unquoted:url(d68e763c825dc0e388929ae1b375ce18.jpg);query:
url(d68e763c825dc0e388929ae1b375ce18.jpg);hash:url(d68e763c825dc0e388929ae1b375ce18.jpg#hash)}
Expand All @@ -182,22 +179,12 @@ module.exports = test(
assertWebpackOk,
assertNoErrors,
assertDebugMessages,
onlyMeta('meta.version.webpack < 4')(
assertCssSourceMapComment(true),
compose(assertCssContent, trim)`
.some-class-name{single-quoted:url("../images/img.jpg");double-quoted:url("../images/img.jpg");unquoted:
url(../images/img.jpg);query:url(../images/img.jpg?query);hash:url(../images/img.jpg#hash)}
.another-class-name{display:block}
`
),
onlyMeta('meta.version.webpack >= 4')(
assertCssSourceMapComment(false),
compose(assertCssContent, trim)`
.some-class-name{single-quoted:url(../images/img.jpg);double-quoted:url(../images/img.jpg);unquoted:
url(../images/img.jpg);query:url(../images/img.jpg?query);hash:url(../images/img.jpg#hash)}
.another-class-name{display:block}
`
)
assertCssSourceMapComment(false),
compose(assertCssContent, trim)`
.some-class-name{single-quoted:url(../images/img.jpg);double-quoted:url(../images/img.jpg);unquoted:
url(../images/img.jpg);query:url(../images/img.jpg?query);hash:url(../images/img.jpg#hash)}
.another-class-name{display:block}
`
),
buildProdNoDevtool(
assertWebpackOk,
Expand Down
103 changes: 9 additions & 94 deletions test/cases/adjacent-asset.js

Large diffs are not rendered by default.

115 changes: 9 additions & 106 deletions test/cases/declaration-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ module.exports = test(
assertNoErrors,
assertIncludeMessages,
assertCssSourceMapComment(true),
compose(onlyMeta('meta.version.webpack < 5'), assertCssContent, outdent)`
compose(onlyMeta('meta.version.webpack == 4'), assertCssContent, outdent)`
.some-class-name {
background-image: url(d68e763c825dc0e388929ae1b375ce18.jpg); }
`,
Expand All @@ -88,25 +88,6 @@ module.exports = test(
assertNoErrors,
assertIncludeMessages,
assertCssSourceMapComment(true),
compose(
onlyMeta('meta.version.webpack < 4'),
assertCssAndSourceMapContent('main.4f223bc5b560c4a026550f4491acfbd9.css', {sanitiseSources: true}),
outdent
)`
/src/index.scss
---------------------------------------------------------------------------------------------------
2:01 .some-class-name {⏎ 1:01 .some-class-name {⏎
@include feature;⏎ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
}░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
/src/feature/mixins.scss
---------------------------------------------------------------------------------------------------
2:03 ░░background-image: url('img.jpg')░░░░░░░░░░ 2:03 ░░background-image: url("./img.jpg");░░░░░░░
2:35 ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░;⏎ 2:38 ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ }⏎
}░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ⏎
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ /*# sourceMappingURL=main.4f223bc5b560c4a026
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 550f4491acfbd9.css.map*/░░░░░░░░░░░░░░░░░░░░
`,
compose(
onlyMeta('meta.version.webpack == 4'),
assertCssAndSourceMapContent('main.ac9a51ab438078a6f4ae.css', {sourceRoot: 'src'}),
Expand Down Expand Up @@ -152,13 +133,8 @@ module.exports = test(
assertWebpackOk,
assertNoErrors,
assertIncludeMessages,
onlyMeta('meta.version.webpack < 4')(
assertCssSourceMapComment(true)
),
onlyMeta('meta.version.webpack >= 4')(
assertCssSourceMapComment(false)
),
compose(onlyMeta('meta.version.webpack < 5'), assertCssContent, trim)`
assertCssSourceMapComment(false),
compose(onlyMeta('meta.version.webpack == 4'), assertCssContent, trim)`
.some-class-name{background-image:url(d68e763c825dc0e388929ae1b375ce18.jpg)}
`,
compose(onlyMeta('meta.version.webpack >= 5'), assertCssContent, trim)`
Expand All @@ -169,31 +145,7 @@ module.exports = test(
assertWebpackOk,
assertNoErrors,
assertIncludeMessages,
onlyMeta('meta.version.webpack < 4')(
assertCssSourceMapComment(true)
),
onlyMeta('meta.version.webpack >= 4')(
assertCssSourceMapComment(false)
),
compose(
onlyMeta('meta.version.webpack < 4'),
assertCssAndSourceMapContent('main.4d5011bf8252e9bbc18d8b57151e8684.css', {sanitiseSources: true}),
outdent
)`
/src/index.scss
---------------------------------------------------------------------------------------------------
2:01 .some-class-name {⏎ 1:01 .some-class-name{░░░░░░░░░░░░░░░░░░░░░░░░░░░
@include feature;⏎ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
}░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
/src/feature/mixins.scss
---------------------------------------------------------------------------------------------------
2:03 ░░background-image: url('img.jpg')░░░░░░░░░░ 1:18 ░░░░░░░░░░░░░░░░░background-image:url("./img
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ .jpg")░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
2:35 ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░;⏎ 1:51 ░░░░░░}⏎
}░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ /*# sourceMappingURL=main.4d5011bf8252e9bbc1
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 8d8b57151e8684.css.map*/░░░░░░░░░░░░░░░░░░░░
`,
assertCssSourceMapComment(false),
compose(
onlyMeta('meta.version.webpack == 4'),
assertCssAndSourceMapContent('main.1989d2b100f23c3bc54e.css', {sourceRoot: 'src'}),
Expand Down Expand Up @@ -261,7 +213,7 @@ module.exports = test(
assertNoErrors,
assertMixinMessages,
assertCssSourceMapComment(true),
compose(onlyMeta('meta.version.webpack < 5'), assertCssContent, outdent)`
compose(onlyMeta('meta.version.webpack == 4'), assertCssContent, outdent)`
.some-class-name {
background-image: url(d68e763c825dc0e388929ae1b375ce18.jpg); }
`,
Expand All @@ -275,26 +227,6 @@ module.exports = test(
assertNoErrors,
assertMixinMessages,
assertCssSourceMapComment(true),
compose(
onlyMeta('meta.version.webpack < 4'),
assertCssAndSourceMapContent('main.c766c04a6915d3b7c3f26d15d8de1db9.css', {sanitiseSources: true}),
outdent
)`
/src/index.scss
---------------------------------------------------------------------------------------------------
2:01 .some-class-name {⏎ 1:01 .some-class-name {⏎
@include feature;⏎ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
}░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
/src/feature/mixins.scss
---------------------------------------------------------------------------------------------------
2:03 ░░background-image: url('img.jpg')░░░░░░░░░░ 2:03 ░░background-image: url("./feature/img.jpg")
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
2:35 ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░;⏎ 2:46 ░ }⏎
}░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ⏎
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ /*# sourceMappingURL=main.c766c04a6915d3b7c3
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ f26d15d8de1db9.css.map*/░░░░░░░░░░░░░░░░░░░░
`,
compose(
onlyMeta('meta.version.webpack == 4'),
assertCssAndSourceMapContent('main.efbf7d7cec35eab2f203.css', {sourceRoot: 'src'}),
Expand Down Expand Up @@ -340,48 +272,19 @@ module.exports = test(
assertWebpackOk,
assertNoErrors,
assertMixinMessages,
onlyMeta('meta.version.webpack < 4')(
assertCssSourceMapComment(true)
),
onlyMeta('meta.version.webpack >= 4')(
assertCssSourceMapComment(false)
),
compose(onlyMeta('meta.version.webpack < 5'), assertCssContent, trim)`
assertCssSourceMapComment(false),
compose(onlyMeta('meta.version.webpack == 4'), assertCssContent, trim)`
.some-class-name{background-image:url(d68e763c825dc0e388929ae1b375ce18.jpg)}
`,
compose(onlyMeta('meta.version.webpack == 5'), assertCssContent, trim)`
compose(onlyMeta('meta.version.webpack >= 5'), assertCssContent, trim)`
.some-class-name{background-image:url(9eb57a84abbf8abc636d0faa71f9a800.jpg)}
`
),
buildProdNoUrl(
assertWebpackOk,
assertNoErrors,
assertMixinMessages,
onlyMeta('meta.version.webpack < 4')(
assertCssSourceMapComment(true)
),
onlyMeta('meta.version.webpack >= 4')(
assertCssSourceMapComment(false)
),
compose(
onlyMeta('meta.version.webpack < 4'),
assertCssAndSourceMapContent('main.6549357ba014e5f25d88df1c87c53781.css', {sanitiseSources: true}),
outdent
)`
/src/index.scss
---------------------------------------------------------------------------------------------------
2:01 .some-class-name {⏎ 1:01 .some-class-name{░░░░░░░░░░░░░░░░░░░░░░░░░░░
@include feature;⏎ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
}░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
/src/feature/mixins.scss
---------------------------------------------------------------------------------------------------
2:03 ░░background-image: url('img.jpg')░░░░░░░░░░ 1:18 ░░░░░░░░░░░░░░░░░background-image:url("./fea
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ture/img.jpg")░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
2:35 ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░;⏎ 1:59 ░░░░░░░░░░░░░░}⏎
}░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ /*# sourceMappingURL=main.6549357ba014e5f25d
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 88df1c87c53781.css.map*/░░░░░░░░░░░░░░░░░░░░
`,
assertCssSourceMapComment(false),
compose(
onlyMeta('meta.version.webpack == 4'),
assertCssAndSourceMapContent('main.0ba19ee65019ece2ba37.css', {sourceRoot: 'src'}),
Expand Down
Loading

0 comments on commit 5ff7a18

Please sign in to comment.