Skip to content

Commit

Permalink
Merge pull request #223 from bholloway/cleanup-todos
Browse files Browse the repository at this point in the history
Cleanup todos
  • Loading branch information
bholloway authored Jan 17, 2022
2 parents 33a2d79 + 6f1143e commit 8091b2d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 53 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:
cache: 'yarn'
- name: Install Dependencies
run: yarn install
- name: Lint js
run: yarn lint
- name: Unit test
run: yarn test:unit
- name: End-to-End test ${{ matrix.band }}
Expand Down
30 changes: 15 additions & 15 deletions test/cases/misconfiguration.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const {buildDevNormal, buildProdNormal} = require('./common/exec');
const {assertCssContent} = require('../lib/assert');
const {
assertWebpackOk, assertWebpackNotOk, assertNoErrors, assertStdout,
assertSilence, assertMisconfigWarning, assertDeprecationWarning,
assertNoMessages, assertMisconfigWarning, assertDeprecationWarning,
} = require('../lib/assert');

const assertContentDev = compose(assertCssContent, outdent)`
Expand Down Expand Up @@ -72,13 +72,13 @@ module.exports = test(
buildDevNormal(
assertWebpackOk,
assertNoErrors,
assertSilence,
assertNoMessages,
assertContentDev
),
buildProdNormal(
assertWebpackOk,
assertNoErrors,
assertSilence,
assertNoMessages,
assertContentProd
)
)
Expand All @@ -102,13 +102,13 @@ module.exports = test(
buildDevNormal(
assertWebpackOk,
assertNoErrors,
assertSilence,
assertNoMessages,
assertContentDev
),
buildProdNormal(
assertWebpackOk,
assertNoErrors,
assertSilence,
assertNoMessages,
assertContentProd
)
)
Expand All @@ -132,13 +132,13 @@ module.exports = test(
buildDevNormal(
assertWebpackOk,
assertNoErrors,
assertSilence,
assertNoMessages,
assertContentDev
),
buildProdNormal(
assertWebpackOk,
assertNoErrors,
assertSilence,
assertNoMessages,
assertContentProd
)
)
Expand All @@ -162,13 +162,13 @@ module.exports = test(
buildDevNormal(
assertWebpackOk,
assertNoErrors,
assertSilence,
assertNoMessages,
assertContentDev
),
buildProdNormal(
assertWebpackOk,
assertNoErrors,
assertSilence,
assertNoMessages,
assertContentProd
)
)
Expand All @@ -192,13 +192,13 @@ module.exports = test(
buildDevNormal(
assertWebpackOk,
assertNoErrors,
assertSilence,
assertNoMessages,
assertContentDev
),
buildProdNormal(
assertWebpackOk,
assertNoErrors,
assertSilence,
assertNoMessages,
assertContentProd
)
)
Expand All @@ -222,13 +222,13 @@ module.exports = test(
buildDevNormal(
assertWebpackOk,
assertNoErrors,
assertSilence,
assertNoMessages,
assertContentDev
),
buildProdNormal(
assertWebpackOk,
assertNoErrors,
assertSilence,
assertNoMessages,
assertContentProd
)
)
Expand Down Expand Up @@ -284,13 +284,13 @@ module.exports = test(
buildDevNormal(
assertWebpackOk,
assertNoErrors,
assertSilence,
assertNoMessages,
assertContentDev
),
buildProdNormal(
assertWebpackOk,
assertNoErrors,
assertSilence,
assertNoMessages,
assertContentProd
)
)
Expand Down
53 changes: 15 additions & 38 deletions test/lib/assert/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,56 +48,33 @@ exports.assertStdout = assertStream('stdout');

exports.assertStderr = assertStream('stderr');

exports.assertSilence = sequence(
exports.assertStdout('console')(0)`resolve-url-loader:`,
exports.assertStderr('node deprecation warning')(0)`\[DEP_RESOLVE_URL_LOADER[A-Z_]+\]`
);

// TODO v5 - assertNoMessages becomes the same as assertSilence when we remove rework engine
exports.assertNoMessages = sequence(
exports.assertStdout('console')(0)`resolve-url-loader:`,
onlyMeta('meta.engine == "rework"')(
exports.assertStderr('node deprecation warning')(1)`\[DEP_RESOLVE_URL_LOADER[A-Z_]+\]`
),
onlyMeta('meta.engine == "postcss"')(
exports.assertStderr('node deprecation warning')(0)`\[DEP_RESOLVE_URL_LOADER[A-Z_]+\]`
)
exports.assertStderr('node deprecation warning')(0)`\[DEP_RESOLVE_URL_LOADER[A-Z_]+\]`
);

const assertDeprecationWarning = (message= '') => exports.assertStderr('node deprecation warning')(1)`
exports.assertDeprecationWarning = (message= '') => exports.assertStderr('node deprecation warning')(1)`
^[^\n]*\[DEP_RESOLVE_URL_LOADER[A-Z_]+\][ ]DeprecationWarning:[ ]${message}
`;
// TODO v5 - this becomes the same as the internal method when we remove rework engine
exports.assertDeprecationWarning = (message) => sequence(
onlyMeta('meta.engine == "rework"')(
assertDeprecationWarning(
'the "engine" option is deprecated, "postcss" engine is the default, using "rework" engine is not advised'
)
),
assertDeprecationWarning(message)
);

const assertMisconfigWarningWithMessage = (message) => exports.assertStdout('webpack warning')(1)`
^[ ]*WARNING[^\n]*
([^\n]+\n){0,2}[^\n]*resolve-url-loader:[ ]*loader misconfiguration
[ ]+${message}
`;

const assertChildCompilationWarning = exports.assertStdout('webpack warning')(1)`
1 WARNING in child compilations
`;

exports.assertMisconfigWarning = (message) => sequence(
onlyMeta('meta.version.webpack == 4')(assertMisconfigWarningWithMessage(message)),
onlyMeta('meta.version.webpack >= 5')(assertChildCompilationWarning)
onlyMeta('meta.version.webpack == 4')(
exports.assertStdout('webpack warning')(1)`
^[ ]*WARNING[^\n]*
([^\n]+\n){0,2}[^\n]*resolve-url-loader:[ ]*loader misconfiguration
[ ]+${message}
`
),
onlyMeta('meta.version.webpack >= 5')(
exports.assertStdout('webpack warning')(1)`
1 WARNING in child compilations
`
)
);

const assertCantResolveError = exports.assertStdout('webpack "Can\'t resolve" error')(1)`
exports.assertAssetError = exports.assertStdout('webpack "Can\'t resolve" error')(1)`
^[ ]*ERROR[^\n]*
[ ]*Module build failed[^\n]*
[ ]*ModuleBuildError: Module build failed[^\n]*
[ ]*Error: Can't resolve[^\n]*
`;

// TODO inline this
exports.assertAssetError = assertCantResolveError;

0 comments on commit 8091b2d

Please sign in to comment.